From 2ee365e83686dd0d9c52b7a1a73564f9fe883deb Mon Sep 17 00:00:00 2001 From: Luan Santos Date: Mon, 9 Oct 2023 19:12:16 -0700 Subject: [PATCH] ci: add clang-format linter (#54) --- .clang-format | 141 + .gitattributes | 1 + .github/workflows/clang-lint.yml | 53 + source/about_window.cpp | 437 +- source/about_window.h | 9 +- source/action.cpp | 415 +- source/action.h | 111 +- source/actions_history_window.cpp | 51 +- source/actions_history_window.h | 14 +- source/application.cpp | 400 +- source/application.h | 41 +- source/artprovider.cpp | 99 +- source/artprovider.h | 5 +- source/basemap.cpp | 209 +- source/basemap.h | 89 +- source/browse_tile_window.cpp | 84 +- source/browse_tile_window.h | 14 +- source/brush.cpp | 446 +- source/brush.h | 346 +- source/brush_enums.h | 2 +- source/brush_tables.cpp | 33 +- source/carpet_brush.cpp | 140 +- source/carpet_brush.h | 109 +- source/client_version.cpp | 289 +- source/client_version.h | 53 +- source/common.cpp | 147 +- source/common.h | 26 +- source/common_windows.cpp | 672 +- source/common_windows.h | 170 +- source/complexitem.cpp | 54 +- source/complexitem.h | 133 +- source/con_vector.h | 21 +- source/const.h | 50 +- source/container_properties_window.cpp | 118 +- source/container_properties_window.h | 37 +- source/copybuffer.cpp | 191 +- source/copybuffer.h | 11 +- source/dat_debug_view.cpp | 49 +- source/dat_debug_view.h | 8 +- source/dcbutton.cpp | 122 +- source/dcbutton.h | 8 +- source/definitions.h | 125 +- source/doodad_brush.cpp | 242 +- source/doodad_brush.h | 71 +- source/editor.cpp | 919 +-- source/editor.h | 103 +- source/editor_tabs.cpp | 115 +- source/editor_tabs.h | 14 +- source/enums.h | 3 +- source/eraser_brush.cpp | 37 +- source/extension.cpp | 37 +- source/extension.h | 9 +- source/extension_window.cpp | 46 +- source/extension_window.h | 10 +- source/filehandle.cpp | 402 +- source/filehandle.h | 229 +- source/find_item_window.cpp | 198 +- source/find_item_window.h | 31 +- source/graphics.cpp | 1048 +-- source/graphics.h | 105 +- source/ground_brush.cpp | 561 +- source/ground_brush.h | 52 +- source/gui.cpp | 1084 ++- source/gui.h | 192 +- source/gui_ids.h | 3 +- source/house.cpp | 119 +- source/house.h | 54 +- source/house_brush.cpp | 63 +- source/house_brush.h | 31 +- source/house_exit_brush.cpp | 26 +- source/house_exit_brush.h | 37 +- source/iomap.cpp | 9 +- source/iomap.h | 32 +- source/iomap_otbm.cpp | 704 +- source/iomap_otbm.h | 73 +- source/iomap_otmm.cpp | 1268 ++-- source/iomap_otmm.h | 13 +- source/iominimap.cpp | 162 +- source/iominimap.h | 41 +- source/item.cpp | 438 +- source/item.h | 281 +- source/item_attributes.cpp | 247 +- source/item_attributes.h | 50 +- source/items.cpp | 442 +- source/items.h | 152 +- source/light_drawer.cpp | 46 +- source/light_drawer.h | 7 +- source/live_action.cpp | 62 +- source/live_action.h | 15 +- source/live_client.cpp | 220 +- source/live_client.h | 95 +- source/live_packets.h | 4 +- source/live_peer.cpp | 181 +- source/live_peer.h | 123 +- source/live_server.cpp | 128 +- source/live_server.h | 81 +- source/live_socket.cpp | 218 +- source/live_socket.h | 90 +- source/live_tab.cpp | 73 +- source/live_tab.h | 28 +- source/main.h | 44 +- source/main_menubar.cpp | 1088 ++- source/main_menubar.h | 200 +- source/main_toolbar.cpp | 133 +- source/main_toolbar.h | 19 +- source/map.cpp | 427 +- source/map.h | 157 +- source/map_allocator.h | 9 +- source/map_display.cpp | 1689 ++--- source/map_display.h | 142 +- source/map_drawer.cpp | 1285 ++-- source/map_drawer.h | 46 +- source/map_region.cpp | 163 +- source/map_region.h | 93 +- source/map_tab.cpp | 47 +- source/map_window.cpp | 149 +- source/map_window.h | 50 +- source/materials.cpp | 163 +- source/materials.h | 14 +- source/minimap_window.cpp | 97 +- source/minimap_window.h | 17 +- source/monster.cpp | 68 +- source/monster.h | 44 +- source/monster_brush.cpp | 36 +- source/monster_brush.h | 29 +- source/monsters.cpp | 140 +- source/monsters.h | 31 +- source/mt_rand.cpp | 112 +- source/net_connection.cpp | 59 +- source/net_connection.h | 54 +- source/npc.cpp | 72 +- source/npc.h | 44 +- source/npc_brush.cpp | 36 +- source/npc_brush.h | 29 +- source/npcs.cpp | 124 +- source/npcs.h | 31 +- source/numbertextctrl.cpp | 68 +- source/numbertextctrl.h | 17 +- source/old_properties_window.cpp | 252 +- source/old_properties_window.h | 10 +- source/otml.h | 496 +- source/outfit.h | 5 +- source/palette_brushlist.cpp | 341 +- source/palette_brushlist.h | 33 +- source/palette_common.cpp | 567 +- source/palette_common.h | 70 +- source/palette_house.cpp | 242 +- source/palette_house.h | 38 +- source/palette_monster.cpp | 140 +- source/palette_monster.h | 15 +- source/palette_npc.cpp | 138 +- source/palette_npc.h | 15 +- source/palette_waypoints.cpp | 129 +- source/palette_waypoints.h | 12 +- source/palette_window.cpp | 203 +- source/palette_window.h | 29 +- source/pngfiles.cpp | 8805 ++++++++++++------------ source/position.h | 67 +- source/positionctrl.cpp | 23 +- source/positionctrl.h | 32 +- source/preferences.cpp | 221 +- source/preferences.h | 21 +- source/process_com.cpp | 50 +- source/process_com.h | 14 +- source/properties_window.cpp | 112 +- source/properties_window.h | 21 +- source/raw_brush.cpp | 54 +- source/raw_brush.h | 23 +- source/replace_items_window.cpp | 149 +- source/replace_items_window.h | 63 +- source/result_window.cpp | 37 +- source/result_window.h | 9 +- source/rme_net.cpp | 2 +- source/rme_net.h | 44 +- source/selection.cpp | 205 +- source/selection.h | 43 +- source/settings.cpp | 228 +- source/settings.h | 46 +- source/spawn_monster.cpp | 11 +- source/spawn_monster.h | 52 +- source/spawn_monster_brush.cpp | 27 +- source/spawn_monster_brush.h | 25 +- source/spawn_npc.cpp | 11 +- source/spawn_npc.h | 50 +- source/spawn_npc_brush.cpp | 27 +- source/spawn_npc_brush.h | 25 +- source/sprites.h | 2 +- source/table_brush.cpp | 126 +- source/table_brush.h | 43 +- source/templatemap76-74.cpp | 1 - source/templatemap81.cpp | 2 - source/templatemap854.cpp | 1 - source/templates.h | 4 +- source/threads.h | 9 +- source/tile.cpp | 493 +- source/tile.h | 125 +- source/tileset.cpp | 157 +- source/tileset.h | 31 +- source/town.cpp | 38 +- source/town.h | 78 +- source/updater.cpp | 49 +- source/updater.h | 23 +- source/wall_brush.cpp | 442 +- source/wall_brush.h | 39 +- source/waypoint_brush.cpp | 23 +- source/waypoint_brush.h | 37 +- source/waypoints.cpp | 37 +- source/waypoints.h | 29 +- source/welcome_dialog.cpp | 432 +- source/welcome_dialog.h | 114 +- 210 files changed, 19956 insertions(+), 19294 deletions(-) create mode 100644 .clang-format create mode 100644 .gitattributes create mode 100644 .github/workflows/clang-lint.yml diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..2e0a7884 --- /dev/null +++ b/.clang-format @@ -0,0 +1,141 @@ +--- +Language: Cpp +#BasedOnStyle: WebKit +AccessModifierOffset: -4 +AlignAfterOpenBracket: BlockIndent +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Right +AlignOperands: false +AlignTrailingComments: false +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Empty +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: MultiLine +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: All +BreakBeforeBraces: Attach +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: AfterColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 0 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: false +DeriveLineEnding: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: false +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 3 + SortPriority: 0 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 2 + SortPriority: 0 + - Regex: '.*' + Priority: 1 + SortPriority: 0 +IncludeIsMainRegex: '(Test)?$' +IncludeIsMainSourceRegex: '' +#IndentAccessModifiers: true +IndentCaseLabels: true +IndentGotoLabels: true +IndentPPDirectives: BeforeHash +IndentWidth: 4 +IndentWrappedFunctionNames: false +InsertBraces: true +InsertNewlineAtEOF: true +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +LambdaBodyIndentation: Signature +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: All +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 4 +ObjCSpaceAfterProperty: true +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Left +QualifierAlignment: Left +ReferenceAlignment: Right +ReflowComments: true +RemoveBracesLLVM: false +SortIncludes: false +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: true +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +Standard: Latest +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 4 +UseCRLF: false +UseTab: true diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..d01653a8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +text eol=lf diff --git a/.github/workflows/clang-lint.yml b/.github/workflows/clang-lint.yml new file mode 100644 index 00000000..63ac6ed1 --- /dev/null +++ b/.github/workflows/clang-lint.yml @@ -0,0 +1,53 @@ +--- +name: Clang-format +on: + pull_request: + paths: + - "source/**" + - ".github/workflows/clang-lint.yml" + push: + paths: + - "source/**" +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Cancel Previous Runs + if: github.ref != 'refs/heads/main' + uses: fkirc/skip-duplicate-actions@master + with: + concurrent_skipping: "same_content" + cancel_others: true + + - name: Set up Git + if: ${{ github.ref != 'refs/heads/main' }} + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "GitHub Actions" + + - name: Actions checkout + if: ${{ github.ref != 'refs/heads/main' }} + uses: actions/checkout@v3 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Run clang format lint + if: ${{ github.ref != 'refs/heads/main' }} + uses: DoozyX/clang-format-lint-action@v0.16.2 + with: + source: "source" + extensions: "cpp,hpp,h" + clangFormatVersion: 16 + inplace: true + + - name: Run add and commit + if: ${{ github.ref != 'refs/heads/main' }} + uses: EndBug/add-and-commit@v9 + with: + author_name: GitHub Actions + author_email: github-actions[bot]@users.noreply.github.com + message: "Code format - (Clang-format)" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/source/about_window.cpp b/source/about_window.cpp index 443635f2..293479bf 100644 --- a/source/about_window.cpp +++ b/source/about_window.cpp @@ -21,28 +21,36 @@ #include "about_window.h" - class GamePanel : public wxPanel { public: GamePanel(wxWindow* parent, int width, int height); virtual ~GamePanel(); - void OnPaint(wxPaintEvent&); - void OnKeyDown(wxKeyEvent&); - void OnKeyUp(wxKeyEvent&); - void OnIdle(wxIdleEvent&); + void OnPaint(wxPaintEvent &); + void OnKeyDown(wxKeyEvent &); + void OnKeyUp(wxKeyEvent &); + void OnIdle(wxIdleEvent &); + + void pause() { + paused_val = true; + } + void unpause() { + paused_val = false; + } + bool paused() const { + return paused_val || dead; + } - void pause() {paused_val = true;} - void unpause() {paused_val = false;} - bool paused() const {return paused_val || dead;} protected: - virtual void Render(wxDC& pdc) = 0; + virtual void Render(wxDC &pdc) = 0; virtual void GameLoop(int time) = 0; - virtual void OnKey(wxKeyEvent& event, bool down) = 0; + virtual void OnKey(wxKeyEvent &event, bool down) = 0; virtual int getFPS() const = 0; + protected: wxStopWatch game_timer; + private: bool paused_val; @@ -61,11 +69,13 @@ class TetrisPanel : public GamePanel { ~TetrisPanel(); protected: - virtual void Render(wxDC& pdc); + virtual void Render(wxDC &pdc); virtual void GameLoop(int time); - virtual void OnKey(wxKeyEvent& event, bool down); + virtual void OnKey(wxKeyEvent &event, bool down); - virtual int getFPS() const {return lines / 10 + 3;} + virtual int getFPS() const { + return lines / 10 + 3; + } enum Color { NO_COLOR, @@ -95,7 +105,7 @@ class TetrisPanel : public GamePanel { int x, y; } block; - const wxBrush& GetBrush(Color color) const; + const wxBrush &GetBrush(Color color) const; bool BlockCollisionTest(int mx, int my) const; void RemoveRow(int row); void NewBlock(); @@ -119,11 +129,13 @@ class SnakePanel : public GamePanel { ~SnakePanel(); protected: - virtual void Render(wxDC& pdc); + virtual void Render(wxDC &pdc); virtual void GameLoop(int time); - virtual void OnKey(wxKeyEvent& event, bool down); + virtual void OnKey(wxKeyEvent &event, bool down); - virtual int getFPS() const {return 7;} + virtual int getFPS() const { + return 7; + } enum { NORTH, @@ -148,18 +160,17 @@ class SnakePanel : public GamePanel { // About Window - Information window about the application BEGIN_EVENT_TABLE(AboutWindow, wxDialog) - EVT_BUTTON(wxID_OK, AboutWindow::OnClickOK) - EVT_BUTTON(ABOUT_VIEW_LICENSE, AboutWindow::OnClickLicense) - EVT_MENU(ABOUT_RUN_TETRIS, AboutWindow::OnTetris) - EVT_MENU(ABOUT_RUN_SNAKE, AboutWindow::OnSnake) - EVT_MENU(wxID_CANCEL, AboutWindow::OnClickOK) +EVT_BUTTON(wxID_OK, AboutWindow::OnClickOK) +EVT_BUTTON(ABOUT_VIEW_LICENSE, AboutWindow::OnClickLicense) +EVT_MENU(ABOUT_RUN_TETRIS, AboutWindow::OnTetris) +EVT_MENU(ABOUT_RUN_SNAKE, AboutWindow::OnSnake) +EVT_MENU(wxID_CANCEL, AboutWindow::OnClickOK) END_EVENT_TABLE() AboutWindow::AboutWindow(wxWindow* parent) : wxDialog(parent, wxID_ANY, "About", wxDefaultPosition, wxSize(300, 320), wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX), - game_panel(nullptr) -{ - + game_panel(nullptr) { + std::string compiler; #if defined(__clang__) compiler = fmt::format("Clang++ {}.{}.{}", __clang_major__, __clang_minor__, __clang_patchlevel__); @@ -183,7 +194,7 @@ AboutWindow::AboutWindow(wxWindow* parent) : #elif __APPLE__ "macOS"; #else - "Unsupported OS"; + "Unsupported OS"; #endif about << "\n\n"; @@ -217,22 +228,19 @@ AboutWindow::AboutWindow(wxWindow* parent) : Centre(wxBOTH); } -AboutWindow::~AboutWindow() -{ +AboutWindow::~AboutWindow() { //// } -void AboutWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) -{ +void AboutWindow::OnClickOK(wxCommandEvent &WXUNUSED(event)) { EndModal(0); } -void AboutWindow::OnClickLicense(wxCommandEvent& WXUNUSED(event)) -{ +void AboutWindow::OnClickLicense(wxCommandEvent &WXUNUSED(event)) { FileName path; try { path = wxStandardPaths::Get().GetExecutablePath(); - } catch(std::bad_cast&) { + } catch (std::bad_cast &) { return; } path.SetFullName("COPYING.txt"); @@ -240,16 +248,15 @@ void AboutWindow::OnClickLicense(wxCommandEvent& WXUNUSED(event)) std::string gpl_str; char ch; - while(gpl.get(ch)) { + while (gpl.get(ch)) { gpl_str += ch; } - g_gui.ShowTextBox(this, "License", wxstr(gpl_str.size()? gpl_str : "The COPYING.txt file is not available.")); + g_gui.ShowTextBox(this, "License", wxstr(gpl_str.size() ? gpl_str : "The COPYING.txt file is not available.")); } -void AboutWindow::OnTetris(wxCommandEvent&) -{ - if(!game_panel) { +void AboutWindow::OnTetris(wxCommandEvent &) { + if (!game_panel) { DestroyChildren(); game_panel = newd TetrisPanel(this); topsizer->Add(game_panel, 1, wxALIGN_CENTER | wxALL, 7); @@ -260,9 +267,8 @@ void AboutWindow::OnTetris(wxCommandEvent&) } } -void AboutWindow::OnSnake(wxCommandEvent&) -{ - if(!game_panel) { +void AboutWindow::OnSnake(wxCommandEvent &) { + if (!game_panel) { DestroyChildren(); game_panel = newd SnakePanel(this); topsizer->Add(game_panel, 1, wxALIGN_CENTER | wxALL, 7); @@ -277,39 +283,37 @@ void AboutWindow::OnSnake(wxCommandEvent&) // GamePanel - Abstract class for games BEGIN_EVENT_TABLE(GamePanel, wxPanel) - EVT_KEY_DOWN(GamePanel::OnKeyDown) - EVT_KEY_UP(GamePanel::OnKeyUp) - EVT_PAINT(GamePanel::OnPaint) - EVT_IDLE(GamePanel::OnIdle) +EVT_KEY_DOWN(GamePanel::OnKeyDown) +EVT_KEY_UP(GamePanel::OnKeyUp) +EVT_PAINT(GamePanel::OnPaint) +EVT_IDLE(GamePanel::OnIdle) END_EVENT_TABLE() -GamePanel::GamePanel(wxWindow *parent, int width, int height) : +GamePanel::GamePanel(wxWindow* parent, int width, int height) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(width, height), wxWANTS_CHARS), paused_val(false), - dead(false) -{ + dead(false) { // Receive idle events SetExtraStyle(wxWS_EX_PROCESS_IDLE); // Complete redraw SetBackgroundStyle(wxBG_STYLE_CUSTOM); } -GamePanel::~GamePanel() -{ +GamePanel::~GamePanel() { //// } -void GamePanel::OnPaint(wxPaintEvent&) -{ +void GamePanel::OnPaint(wxPaintEvent &) { wxBufferedPaintDC pdc(this); Render(pdc); } -void GamePanel::OnKeyDown(wxKeyEvent& event) -{ - switch(event.GetKeyCode()) { +void GamePanel::OnKeyDown(wxKeyEvent &event) { + switch (event.GetKeyCode()) { case WXK_ESCAPE: { - if(dead) return; + if (dead) { + return; + } wxDialog* dlg = (wxDialog*)GetParent(); dlg->EndModal(0); break; @@ -321,19 +325,19 @@ void GamePanel::OnKeyDown(wxKeyEvent& event) } } -void GamePanel::OnKeyUp(wxKeyEvent& event) -{ +void GamePanel::OnKeyUp(wxKeyEvent &event) { OnKey(event, false); } -void GamePanel::OnIdle(wxIdleEvent& event) -{ +void GamePanel::OnIdle(wxIdleEvent &event) { int time = game_timer.Time(); - if(time > 1000 / getFPS()) { + if (time > 1000 / getFPS()) { game_timer.Start(); - if(!paused()) GameLoop(time); + if (!paused()) { + GameLoop(time); + } } - if(!paused()) { + if (!paused()) { event.RequestMore(true); } } @@ -341,53 +345,70 @@ void GamePanel::OnIdle(wxIdleEvent& event) //============================================================================= // TetrisPanel - A window with a Tetris game! -TetrisPanel::TetrisPanel(wxWindow* parent) : GamePanel(parent, 16*TETRIS_MAPWIDTH, 16*TETRIS_MAPHEIGHT) -{ +TetrisPanel::TetrisPanel(wxWindow* parent) : + GamePanel(parent, 16 * TETRIS_MAPWIDTH, 16 * TETRIS_MAPHEIGHT) { NewGame(); } -TetrisPanel::~TetrisPanel() -{ +TetrisPanel::~TetrisPanel() { //// } -const wxBrush& TetrisPanel::GetBrush(Color color) const -{ +const wxBrush &TetrisPanel::GetBrush(Color color) const { static std::unique_ptr yellow_brush; static std::unique_ptr purple_brush; - if(yellow_brush.get() == nullptr) yellow_brush.reset(newd wxBrush(wxColor(255, 255, 0))); - if(purple_brush.get() == nullptr) purple_brush.reset(newd wxBrush(wxColor(128, 0, 255))); + if (yellow_brush.get() == nullptr) { + yellow_brush.reset(newd wxBrush(wxColor(255, 255, 0))); + } + if (purple_brush.get() == nullptr) { + purple_brush.reset(newd wxBrush(wxColor(128, 0, 255))); + } const wxBrush* brush = nullptr; - switch(color) { - case RED: brush = wxRED_BRUSH; break; - case BLUE: brush = wxCYAN_BRUSH; break; - case GREEN: brush = wxGREEN_BRUSH; break; - case PURPLE: brush = purple_brush.get(); break; - case YELLOW: brush = yellow_brush.get(); break; - case WHITE: brush = wxWHITE_BRUSH; break; - case STEEL: brush = wxGREY_BRUSH; break; - default: brush = wxBLACK_BRUSH; break; + switch (color) { + case RED: + brush = wxRED_BRUSH; + break; + case BLUE: + brush = wxCYAN_BRUSH; + break; + case GREEN: + brush = wxGREEN_BRUSH; + break; + case PURPLE: + brush = purple_brush.get(); + break; + case YELLOW: + brush = yellow_brush.get(); + break; + case WHITE: + brush = wxWHITE_BRUSH; + break; + case STEEL: + brush = wxGREY_BRUSH; + break; + default: + brush = wxBLACK_BRUSH; + break; } return *brush; } -void TetrisPanel::Render(wxDC& pdc) -{ +void TetrisPanel::Render(wxDC &pdc) { pdc.SetBackground(*wxBLACK_BRUSH); pdc.Clear(); - for(int y = 0; y < TETRIS_MAPHEIGHT; ++y) { - for(int x = 0; x < TETRIS_MAPWIDTH; ++x) { + for (int y = 0; y < TETRIS_MAPHEIGHT; ++y) { + for (int x = 0; x < TETRIS_MAPWIDTH; ++x) { pdc.SetBrush(GetBrush(map[x][y])); pdc.DrawRectangle(x * 16, y * 16, 16, 16); } } - for(int y = 0; y < 4; ++y) { - for(int x = 0; x < 4; ++x) { - if(block.structure[x][y] != NO_COLOR) { + for (int y = 0; y < 4; ++y) { + for (int x = 0; x < 4; ++x) { + if (block.structure[x][y] != NO_COLOR) { pdc.SetBrush(GetBrush(block.structure[x][y])); pdc.DrawRectangle((block.x + x) * 16, (block.y + y) * 16, 16, 16); } @@ -395,41 +416,52 @@ void TetrisPanel::Render(wxDC& pdc) } } -void TetrisPanel::OnKey(wxKeyEvent& event, bool down) -{ - if(!down || dead) return; +void TetrisPanel::OnKey(wxKeyEvent &event, bool down) { + if (!down || dead) { + return; + } - switch(event.GetKeyCode()) { + switch (event.GetKeyCode()) { case WXK_SPACE: { - if(paused()) + if (paused()) { unpause(); - else pause(); + } else { + pause(); + } break; } case WXK_NUMPAD_UP: case WXK_UP: { - if(dead) return; + if (dead) { + return; + } unpause(); RotateBlock(); break; } case WXK_NUMPAD_DOWN: case WXK_DOWN: { - if(dead) return; + if (dead) { + return; + } unpause(); MoveBlock(0, 1); break; } case WXK_NUMPAD_LEFT: case WXK_LEFT: { - if(dead) return; + if (dead) { + return; + } unpause(); MoveBlock(-1, 0); break; } case WXK_NUMPAD_RIGHT: case WXK_RIGHT: { - if(dead) return; + if (dead) { + return; + } unpause(); MoveBlock(1, 0); break; @@ -437,8 +469,7 @@ void TetrisPanel::OnKey(wxKeyEvent& event, bool down) } } -void TetrisPanel::NewGame() -{ +void TetrisPanel::NewGame() { NewBlock(); score = 0; lines = 0; @@ -447,48 +478,45 @@ void TetrisPanel::NewGame() dead = false; // Clear map - for(int y = 0; y < TETRIS_MAPHEIGHT; ++y) { - for(int x = 0; x < TETRIS_MAPWIDTH; ++x) { + for (int y = 0; y < TETRIS_MAPHEIGHT; ++y) { + for (int x = 0; x < TETRIS_MAPWIDTH; ++x) { map[x][y] = NO_COLOR; } } AddScore(0); // Update title } -void TetrisPanel::AddScore(int lines_added) -{ +void TetrisPanel::AddScore(int lines_added) { lines += lines_added; - score += lines_added*lines_added * 10; + score += lines_added * lines_added * 10; wxString title = "Remere's Tetris : "; title << score << " points "; title << lines << " lines"; ((wxTopLevelWindow*)GetParent())->SetTitle(title); } -void TetrisPanel::GameLoop(int time) -{ +void TetrisPanel::GameLoop(int time) { MoveBlock(0, 1); } -bool TetrisPanel::BlockCollisionTest(int mx, int my) const -{ +bool TetrisPanel::BlockCollisionTest(int mx, int my) const { int nx = block.x + mx; int ny = block.y + my; - for(int y = 0; y < 4; ++y) { - for(int x = 0; x < 4; ++x) { - if(block.structure[x][y] != NO_COLOR) { - if(nx + x < 0 || nx + x > TETRIS_MAPWIDTH - 1 || ny + y < 0 || ny + y > TETRIS_MAPHEIGHT - 1) { + for (int y = 0; y < 4; ++y) { + for (int x = 0; x < 4; ++x) { + if (block.structure[x][y] != NO_COLOR) { + if (nx + x < 0 || nx + x > TETRIS_MAPWIDTH - 1 || ny + y < 0 || ny + y > TETRIS_MAPHEIGHT - 1) { return true; } } } } - for(int y = 0; y < TETRIS_MAPHEIGHT; ++y) { - for(int x = 0; x < TETRIS_MAPWIDTH; ++x) { - if(x >= nx && x < nx + 4 && y >= ny && y < ny + 4) { - if(map[x][y] != NO_COLOR && block.structure[x - nx][y - ny] != NO_COLOR) { + for (int y = 0; y < TETRIS_MAPHEIGHT; ++y) { + for (int x = 0; x < TETRIS_MAPWIDTH; ++x) { + if (x >= nx && x < nx + 4 && y >= ny && y < ny + 4) { + if (map[x][y] != NO_COLOR && block.structure[x - nx][y - ny] != NO_COLOR) { return true; } } @@ -497,27 +525,25 @@ bool TetrisPanel::BlockCollisionTest(int mx, int my) const return false; } -void TetrisPanel::RemoveRow(int row) -{ - for(int x = 0; x < TETRIS_MAPWIDTH; ++x) { - for(int y = row; y > 0; --y) { //Move all above one step down - map[x][y] = map[x][y-1]; +void TetrisPanel::RemoveRow(int row) { + for (int x = 0; x < TETRIS_MAPWIDTH; ++x) { + for (int y = row; y > 0; --y) { // Move all above one step down + map[x][y] = map[x][y - 1]; } } } -void TetrisPanel::NewBlock() -{ +void TetrisPanel::NewBlock() { block.x = TETRIS_MAPWIDTH / 2; block.y = -1; - for(int y = 0; y < 4; ++y) { - for(int x = 0; x < 4; ++x) { + for (int y = 0; y < 4; ++y) { + for (int x = 0; x < 4; ++x) { block.structure[x][y] = NO_COLOR; } } - switch(random(FIRST_BLOCK, LAST_BLOCK)) { + switch (random(FIRST_BLOCK, LAST_BLOCK)) { case BLOCK_TOWER: { block.structure[1][0] = RED; block.structure[1][1] = RED; @@ -526,7 +552,8 @@ void TetrisPanel::NewBlock() block.y = 0; break; } - default: case BLOCK_SQUARE: { + default: + case BLOCK_SQUARE: { block.structure[1][1] = BLUE; block.structure[1][2] = BLUE; block.structure[2][1] = BLUE; @@ -571,35 +598,34 @@ void TetrisPanel::NewBlock() } } -void TetrisPanel::MoveBlock(int x, int y) -{ - if(BlockCollisionTest(x, y)) { - if(y == 1) { // moving down... - if(block.y < 1) { // Out of bounds! +void TetrisPanel::MoveBlock(int x, int y) { + if (BlockCollisionTest(x, y)) { + if (y == 1) { // moving down... + if (block.y < 1) { // Out of bounds! dead = true; g_gui.PopupDialog("Game Over", "You reached a score of " + i2ws(score) + "!", wxOK); NewGame(); SetFocus(); } else { // Freeze the old block onto the map - for(int y = 0; y < 4; ++y) { - for(int x = 0; x < 4; ++x) { - if(block.structure[x][y] != NO_COLOR) { - map[block.x+x][block.y+y] = block.structure[x][y]; + for (int y = 0; y < 4; ++y) { + for (int x = 0; x < 4; ++x) { + if (block.structure[x][y] != NO_COLOR) { + map[block.x + x][block.y + y] = block.structure[x][y]; } } } // Any cleared rows? int cleared = 0; - for(int y = 0; y < TETRIS_MAPHEIGHT; ++y) { + for (int y = 0; y < TETRIS_MAPHEIGHT; ++y) { bool full = true; - for(int x = 0; x < TETRIS_MAPWIDTH; ++x) { - if(map[x][y] == NO_COLOR) { + for (int x = 0; x < TETRIS_MAPWIDTH; ++x) { + if (map[x][y] == NO_COLOR) { full = false; } } - if(full) { + if (full) { RemoveRow(y); ++cleared; } @@ -617,38 +643,37 @@ void TetrisPanel::MoveBlock(int x, int y) Refresh(); } -void TetrisPanel::RotateBlock() -{ +void TetrisPanel::RotateBlock() { Block temp; - for(int y = 0; y < 4; ++y) { - for(int x = 0; x < 4; ++x) { - temp.structure[3-x][y] = block.structure[y][x]; + for (int y = 0; y < 4; ++y) { + for (int x = 0; x < 4; ++x) { + temp.structure[3 - x][y] = block.structure[y][x]; } } - for(int y = 0; y < 4; ++y) { - for(int x = 0; x < 4; ++x) { - if(temp.structure[x][y] != NO_COLOR) { - if(block.x + x < 0 || block.x + x > TETRIS_MAPWIDTH - 1 || block.y + y < 0 || block.y + y > TETRIS_MAPHEIGHT - 1) { + for (int y = 0; y < 4; ++y) { + for (int x = 0; x < 4; ++x) { + if (temp.structure[x][y] != NO_COLOR) { + if (block.x + x < 0 || block.x + x > TETRIS_MAPWIDTH - 1 || block.y + y < 0 || block.y + y > TETRIS_MAPHEIGHT - 1) { return; } } } } - for(int y = 0; y < TETRIS_MAPWIDTH; ++y) { - for(int x = 0; x < TETRIS_MAPHEIGHT; ++x) { - if(x >= block.x && x < block.x + 4 && y >= block.y && y < block.y +4) { - if(map[x][y] != NO_COLOR && temp.structure[x - block.x][y - block.y] != NO_COLOR) { + for (int y = 0; y < TETRIS_MAPWIDTH; ++y) { + for (int x = 0; x < TETRIS_MAPHEIGHT; ++x) { + if (x >= block.x && x < block.x + 4 && y >= block.y && y < block.y + 4) { + if (map[x][y] != NO_COLOR && temp.structure[x - block.x][y - block.y] != NO_COLOR) { return; } } } } - for(int y = 0; y < 4; ++y) { - for(int x = 0; x < 4; ++x) { + for (int y = 0; y < 4; ++y) { + for (int x = 0; x < 4; ++x) { block.structure[x][y] = temp.structure[x][y]; } } @@ -659,58 +684,58 @@ void TetrisPanel::RotateBlock() //============================================================================= // SnakePanel - A window with a Snake game! -SnakePanel::SnakePanel(wxWindow* parent) : GamePanel(parent, 16*SNAKE_MAPWIDTH, 16*SNAKE_MAPHEIGHT) -{ +SnakePanel::SnakePanel(wxWindow* parent) : + GamePanel(parent, 16 * SNAKE_MAPWIDTH, 16 * SNAKE_MAPHEIGHT) { NewGame(); } -SnakePanel::~SnakePanel() -{ +SnakePanel::~SnakePanel() { //// } -void SnakePanel::Render(wxDC& pdc) -{ +void SnakePanel::Render(wxDC &pdc) { pdc.SetBackground(*wxBLACK_BRUSH); pdc.Clear(); wxBrush snakebrush(wxColor(0, 0, 255)); wxBrush applebrush(wxColor(255, 0, 0)); - double lblue = 1.0; - double lred = 0.5; + double lblue = 1.0; + double lred = 0.5; double lgreen = 0.0; - for(int y = 0; y < SNAKE_MAPHEIGHT; ++y) { - for(int x = 0; x < SNAKE_MAPWIDTH; ++x) { - if(map[x][y] == -1) { // Apple + for (int y = 0; y < SNAKE_MAPHEIGHT; ++y) { + for (int x = 0; x < SNAKE_MAPWIDTH; ++x) { + if (map[x][y] == -1) { // Apple pdc.SetBrush(applebrush); - pdc.DrawRectangle(x*16, y*16, 16, 16); - } else if(map[x][y] > 0) { // Snake + pdc.DrawRectangle(x * 16, y * 16, 16, 16); + } else if (map[x][y] > 0) { // Snake double snook = double(map[x][y]) / length; snakebrush.SetColour(wxColor( int(255.0 * (1.0 - abs(lred - snook))), int(255.0 * (1.0 - abs(lgreen - snook))), int(255.0 * (1.0 - abs(lblue - snook))) - ) + ) ); pdc.SetBrush(snakebrush); - pdc.DrawRectangle(x*16, y*16, 16, 16); + pdc.DrawRectangle(x * 16, y * 16, 16, 16); } } } } -void SnakePanel::OnKey(wxKeyEvent& event, bool down) -{ - if(!down) return; +void SnakePanel::OnKey(wxKeyEvent &event, bool down) { + if (!down) { + return; + } int keyCode = event.GetKeyCode(); if (keyCode == WXK_SPACE) { - if (paused()) + if (paused()) { unpause(); - else + } else { pause(); + } } else if (!dead) { switch (keyCode) { case WXK_NUMPAD_UP: @@ -741,8 +766,7 @@ void SnakePanel::OnKey(wxKeyEvent& event, bool down) } } -void SnakePanel::NewGame() -{ +void SnakePanel::NewGame() { length = 3; game_timer.Start(); last_dir = NORTH; @@ -750,8 +774,8 @@ void SnakePanel::NewGame() dead = false; // Clear map - for(int y = 0; y < SNAKE_MAPHEIGHT; ++y) { - for(int x = 0; x < SNAKE_MAPWIDTH; ++x) { + for (int y = 0; y < SNAKE_MAPHEIGHT; ++y) { + for (int x = 0; x < SNAKE_MAPWIDTH; ++x) { map[x][y] = 0; } } @@ -760,36 +784,37 @@ void SnakePanel::NewGame() UpdateTitle(); // Update title } -void SnakePanel::UpdateTitle() -{ +void SnakePanel::UpdateTitle() { wxString title = "Remere's Snake : "; title << length << " segments"; ((wxTopLevelWindow*)GetParent())->SetTitle(title); } -void SnakePanel::GameLoop(int time) -{ +void SnakePanel::GameLoop(int time) { Move(last_dir); } -void SnakePanel::NewApple() -{ +void SnakePanel::NewApple() { bool possible = false; - for(int y = 0; y < SNAKE_MAPHEIGHT; ++y) { - for(int x = 0; x < SNAKE_MAPWIDTH; ++x) { - if(map[x][y] == 0) { + for (int y = 0; y < SNAKE_MAPHEIGHT; ++y) { + for (int x = 0; x < SNAKE_MAPWIDTH; ++x) { + if (map[x][y] == 0) { possible = true; } - if(possible) break; + if (possible) { + break; + } + } + if (possible) { + break; } - if(possible) break; } - if(possible) { - while(true) { + if (possible) { + while (true) { int x = random(0, SNAKE_MAPWIDTH - 1); int y = random(0, SNAKE_MAPHEIGHT - 1); - if(map[x][y] == 0) { + if (map[x][y] == 0) { map[x][y] = -1; break; } @@ -797,26 +822,22 @@ void SnakePanel::NewApple() } } -void SnakePanel::Move(int dir) -{ - if((last_dir == NORTH && dir == SOUTH) || - (last_dir == WEST && dir == EAST) || - (last_dir == EAST && dir == WEST) || - (last_dir == SOUTH && dir == NORTH)) { +void SnakePanel::Move(int dir) { + if ((last_dir == NORTH && dir == SOUTH) || (last_dir == WEST && dir == EAST) || (last_dir == EAST && dir == WEST) || (last_dir == SOUTH && dir == NORTH)) { return; } int nx = 0, ny = 0; int head_x = 0, head_y = 0; - for(int y = 0; y < SNAKE_MAPHEIGHT; ++y) { - for(int x = 0; x < SNAKE_MAPWIDTH; ++x) { - if(map[x][y] == length) { + for (int y = 0; y < SNAKE_MAPHEIGHT; ++y) { + for (int x = 0; x < SNAKE_MAPWIDTH; ++x) { + if (map[x][y] == length) { head_x = x; head_y = y; } } } - switch(dir) { + switch (dir) { case NORTH: { nx = head_x; ny = head_y - 1; @@ -841,7 +862,7 @@ void SnakePanel::Move(int dir) return; } - if(map[nx][ny] > 0 || nx < 0 || ny < 0 || nx >= SNAKE_MAPWIDTH || ny >= SNAKE_MAPHEIGHT) { + if (map[nx][ny] > 0 || nx < 0 || ny < 0 || nx >= SNAKE_MAPWIDTH || ny >= SNAKE_MAPHEIGHT) { // Crash dead = true; g_gui.PopupDialog("Game Over", "You reached a length of " + i2ws(length) + "!", wxOK); @@ -849,15 +870,15 @@ void SnakePanel::Move(int dir) SetFocus(); } else { // Walk! - if(map[nx][ny] == -1) { + if (map[nx][ny] == -1) { // Took apple! length += 1; UpdateTitle(); NewApple(); } else { - for(int y = 0; y < SNAKE_MAPHEIGHT; ++y) { - for(int x = 0; x < SNAKE_MAPWIDTH; ++x) { - if(map[x][y] > 0) { + for (int y = 0; y < SNAKE_MAPHEIGHT; ++y) { + for (int x = 0; x < SNAKE_MAPWIDTH; ++x) { + if (map[x][y] > 0) { map[x][y] -= 1; } } diff --git a/source/about_window.h b/source/about_window.h index 28169641..730c480f 100644 --- a/source/about_window.h +++ b/source/about_window.h @@ -27,11 +27,12 @@ class AboutWindow : public wxDialog { AboutWindow(wxWindow* parent); ~AboutWindow(); - void OnClickOK(wxCommandEvent&); - void OnClickLicense(wxCommandEvent&); + void OnClickOK(wxCommandEvent &); + void OnClickLicense(wxCommandEvent &); + + void OnTetris(wxCommandEvent &); + void OnSnake(wxCommandEvent &); - void OnTetris(wxCommandEvent&); - void OnSnake(wxCommandEvent&); private: wxSizer* topsizer; GamePanel* game_panel; diff --git a/source/action.cpp b/source/action.cpp index 1e031ae6..3e637a38 100644 --- a/source/action.cpp +++ b/source/action.cpp @@ -23,41 +23,37 @@ #include "editor.h" #include "gui.h" -Change::Change() : type(CHANGE_NONE), data(nullptr) -{ +Change::Change() : + type(CHANGE_NONE), data(nullptr) { //// } -Change::Change(Tile* tile) : type(CHANGE_TILE) -{ +Change::Change(Tile* tile) : + type(CHANGE_TILE) { ASSERT(tile); data = tile; } -Change* Change::Create(House* house, const Position& position) -{ +Change* Change::Create(House* house, const Position &position) { Change* change = new Change(); change->type = CHANGE_MOVE_HOUSE_EXIT; change->data = new HouseData { house->id, position }; return change; } -Change* Change::Create(Waypoint* waypoint, const Position& position) -{ +Change* Change::Create(Waypoint* waypoint, const Position &position) { Change* change = new Change(); change->type = CHANGE_MOVE_WAYPOINT; change->data = new WaypointData { waypoint->name, position }; return change; } -Change::~Change() -{ +Change::~Change() { clear(); } -void Change::clear() -{ - switch(type) { +void Change::clear() { + switch (type) { case CHANGE_TILE: ASSERT(data); delete reinterpret_cast(data); @@ -74,8 +70,9 @@ void Change::clear() break; default: #ifdef __DEBUG_MODE__ - if(data) + if (data) { printf("UNHANDLED CHANGE TYPE! Leak!"); + } #endif break; } @@ -84,44 +81,39 @@ void Change::clear() data = nullptr; } -uint32_t Change::memsize() const -{ +uint32_t Change::memsize() const { uint32_t mem = sizeof(*this); - if(type == CHANGE_TILE) { + if (type == CHANGE_TILE) { mem += reinterpret_cast(data)->memsize(); } return mem; } -Action::Action(Editor& editor, ActionIdentifier ident) : +Action::Action(Editor &editor, ActionIdentifier ident) : commited(false), editor(editor), - type(ident) -{ + type(ident) { } -Action::~Action() -{ - for(Change* change : changes) { +Action::~Action() { + for (Change* change : changes) { delete change; } changes.clear(); } -size_t Action::approx_memsize() const -{ +size_t Action::approx_memsize() const { uint32_t mem = sizeof(*this); - mem += changes.size() * (sizeof(Change) + sizeof(Tile) + sizeof(Item) + 6/* approx overhead*/); + mem += changes.size() * (sizeof(Change) + sizeof(Tile) + sizeof(Item) + 6 /* approx overhead*/); return mem; } -size_t Action::memsize() const -{ +size_t Action::memsize() const { uint32_t mem = sizeof(*this); mem += sizeof(Change*) * 3 * changes.size(); - for(const Change* change : changes) { - if(change && change->getType() == CHANGE_TILE) { + for (const Change* change : changes) { + if (change && change->getType() == CHANGE_TILE) { mem += reinterpret_cast(change->getData())->memsize(); } } @@ -129,24 +121,23 @@ size_t Action::memsize() const return mem; } -void Action::commit(DirtyList* dirty_list) -{ - Map& map = editor.getMap(); - Selection& selection = editor.getSelection(); +void Action::commit(DirtyList* dirty_list) { + Map &map = editor.getMap(); + Selection &selection = editor.getSelection(); selection.start(Selection::INTERNAL); for (Change* change : changes) { - switch(change->getType()) { + switch (change->getType()) { case CHANGE_TILE: { void** data = &change->data; Tile* new_tile = reinterpret_cast(*data); ASSERT(new_tile); - const Position& pos = new_tile->getPosition(); + const Position &pos = new_tile->getPosition(); - if(editor.IsLiveClient()) { + if (editor.IsLiveClient()) { QTreeNode* node = map.getLeaf(pos.x, pos.y); - if(!node || !node->isVisible(pos.z > rme::MapGroundLayer)) { + if (!node || !node->isVisible(pos.z > rme::MapGroundLayer)) { change->clear(); continue; } @@ -156,29 +147,33 @@ void Action::commit(DirtyList* dirty_list) TileLocation* location = new_tile->getLocation(); // Update other nodes in the network - if(editor.IsLiveServer() && dirty_list) + if (editor.IsLiveServer() && dirty_list) { dirty_list->AddPosition(pos.x, pos.y, pos.z); + } new_tile->update(); - //std::cout << "\tSwitched tile at " << pos.x << ";" << pos.y << ";" << pos.z << " from " << (void*)oldtile << " to " << *data << std::endl; - if(new_tile->isSelected()) + // std::cout << "\tSwitched tile at " << pos.x << ";" << pos.y << ";" << pos.z << " from " << (void*)oldtile << " to " << *data << std::endl; + if (new_tile->isSelected()) { selection.addInternal(new_tile); + } - if(old_tile) { - if(new_tile->getHouseID() != old_tile->getHouseID()) { + if (old_tile) { + if (new_tile->getHouseID() != old_tile->getHouseID()) { // oooooomggzzz we need to add it to the appropriate house! House* house = map.houses.getHouse(old_tile->getHouseID()); - if(house) + if (house) { house->removeTile(old_tile); + } house = map.houses.getHouse(new_tile->getHouseID()); - if(house) + if (house) { house->addTile(new_tile); + } } - if(old_tile->spawnMonster) { - if(new_tile->spawnMonster) { - if(*old_tile->spawnMonster != *new_tile->spawnMonster) { + if (old_tile->spawnMonster) { + if (new_tile->spawnMonster) { + if (*old_tile->spawnMonster != *new_tile->spawnMonster) { map.removeSpawnMonster(old_tile); map.addSpawnMonster(new_tile); } @@ -186,12 +181,12 @@ void Action::commit(DirtyList* dirty_list) // Monster spawn has been removed editor.getMap().removeSpawnMonster(old_tile); } - } else if(new_tile->spawnMonster) { + } else if (new_tile->spawnMonster) { editor.getMap().addSpawnMonster(new_tile); } - if(old_tile->spawnNpc) { - if(new_tile->spawnNpc) { - if(*old_tile->spawnNpc != *new_tile->spawnNpc) { + if (old_tile->spawnNpc) { + if (new_tile->spawnNpc) { + if (*old_tile->spawnNpc != *new_tile->spawnNpc) { map.removeSpawnNpc(old_tile); map.addSpawnNpc(new_tile); } @@ -199,36 +194,38 @@ void Action::commit(DirtyList* dirty_list) // SpawnMonster has been removed map.removeSpawnNpc(old_tile); } - } else if(new_tile->spawnNpc) { + } else if (new_tile->spawnNpc) { map.addSpawnNpc(new_tile); } - //oldtile->update(); - if(old_tile->isSelected()) + // oldtile->update(); + if (old_tile->isSelected()) { selection.removeInternal(old_tile); + } *data = old_tile; } else { *data = map.allocator(location); - if(new_tile->getHouseID() != 0) { + if (new_tile->getHouseID() != 0) { // oooooomggzzz we need to add it to the appropriate house! House* house = map.houses.getHouse(new_tile->getHouseID()); - if(house) { + if (house) { house->addTile(new_tile); } } - if(new_tile->spawnMonster) + if (new_tile->spawnMonster) { map.addSpawnMonster(new_tile); + } - if(new_tile->spawnNpc) + if (new_tile->spawnNpc) { map.addSpawnNpc(new_tile); - + } } new_tile->modify(); // Update client dirty list - if(editor.IsLiveClient() && dirty_list && type != ACTION_REMOTE) { + if (editor.IsLiveClient() && dirty_list && type != ACTION_REMOTE) { dirty_list->AddChange(change); } break; @@ -239,8 +236,8 @@ void Action::commit(DirtyList* dirty_list) ASSERT(data); House* house = map.houses.getHouse(data->id); - if(house) { - const Position& old_pos = house->getExit(); + if (house) { + const Position &old_pos = house->getExit(); house->setExit(data->position); data->position = old_pos; } @@ -252,12 +249,13 @@ void Action::commit(DirtyList* dirty_list) ASSERT(data); Waypoint* waypoint = map.waypoints.getWaypoint(data->id); - if(waypoint) { + if (waypoint) { TileLocation* old_tile = map.getTileL(waypoint->pos); TileLocation* new_tile = map.getTileL(data->position); - if(data->position.isValid() && old_tile && old_tile->getWaypointCount() > 0) + if (data->position.isValid() && old_tile && old_tile->getWaypointCount() > 0) { old_tile->decreaseWaypointCount(); + } new_tile->increaseWaypointCount(); @@ -276,26 +274,26 @@ void Action::commit(DirtyList* dirty_list) commited = true; } -void Action::undo(DirtyList* dirty_list) -{ - if(changes.empty()) +void Action::undo(DirtyList* dirty_list) { + if (changes.empty()) { return; + } - Map& map = editor.getMap(); - Selection& selection = editor.getSelection(); + Map &map = editor.getMap(); + Selection &selection = editor.getSelection(); selection.start(Selection::INTERNAL); for (Change* change : changes) { - switch(change->getType()) { + switch (change->getType()) { case CHANGE_TILE: { void** data = &change->data; Tile* old_tile = reinterpret_cast(*data); ASSERT(old_tile); - const Position& pos = old_tile->getPosition(); + const Position &pos = old_tile->getPosition(); - if(editor.IsLiveClient()) { + if (editor.IsLiveClient()) { QTreeNode* node = map.getLeaf(pos.x, pos.y); - if(!node || !node->isVisible(pos.z > rme::MapGroundLayer)) { + if (!node || !node->isVisible(pos.z > rme::MapGroundLayer)) { // Delete all changes that affect tiles outside our view change->clear(); continue; @@ -305,59 +303,61 @@ void Action::undo(DirtyList* dirty_list) Tile* new_tile = map.swapTile(pos, old_tile); // Update server side change list (for broadcast) - if(editor.IsLiveServer() && dirty_list) + if (editor.IsLiveServer() && dirty_list) { dirty_list->AddPosition(pos.x, pos.y, pos.z); + } - - if(old_tile->isSelected()) + if (old_tile->isSelected()) { selection.addInternal(old_tile); - if(new_tile->isSelected()) + } + if (new_tile->isSelected()) { selection.removeInternal(new_tile); + } - if(new_tile->getHouseID() != old_tile->getHouseID()) { + if (new_tile->getHouseID() != old_tile->getHouseID()) { // oooooomggzzz we need to remove it from the appropriate house! House* house = map.houses.getHouse(new_tile->getHouseID()); - if(house) { + if (house) { house->removeTile(new_tile); } else { new_tile->setHouse(nullptr); } house = map.houses.getHouse(old_tile->getHouseID()); - if(house) { + if (house) { house->addTile(old_tile); } } - if(old_tile->spawnMonster) { - if(new_tile->spawnMonster) { - if(*old_tile->spawnMonster != *new_tile->spawnMonster) { + if (old_tile->spawnMonster) { + if (new_tile->spawnMonster) { + if (*old_tile->spawnMonster != *new_tile->spawnMonster) { map.removeSpawnMonster(new_tile); map.addSpawnMonster(old_tile); } } else { map.addSpawnMonster(old_tile); } - } else if(new_tile->spawnMonster) { + } else if (new_tile->spawnMonster) { map.removeSpawnMonster(new_tile); } - if(old_tile->spawnNpc) { - if(new_tile->spawnNpc) { - if(*old_tile->spawnNpc != *new_tile->spawnNpc) { + if (old_tile->spawnNpc) { + if (new_tile->spawnNpc) { + if (*old_tile->spawnNpc != *new_tile->spawnNpc) { map.removeSpawnNpc(new_tile); map.addSpawnNpc(old_tile); } } else { map.addSpawnNpc(old_tile); } - } else if(new_tile->spawnNpc) { + } else if (new_tile->spawnNpc) { map.removeSpawnNpc(new_tile); } *data = new_tile; // Update client dirty list - if(editor.IsLiveClient() && dirty_list && type != ACTION_REMOTE) { + if (editor.IsLiveClient() && dirty_list && type != ACTION_REMOTE) { dirty_list->AddChange(change); } break; @@ -368,8 +368,8 @@ void Action::undo(DirtyList* dirty_list) ASSERT(data); House* house = map.houses.getHouse(data->id); - if(house) { - const Position& oldpos = house->getExit(); + if (house) { + const Position &oldpos = house->getExit(); house->setExit(data->position); data->position = oldpos; } @@ -381,12 +381,13 @@ void Action::undo(DirtyList* dirty_list) ASSERT(data); Waypoint* waypoint = map.waypoints.getWaypoint(data->id); - if(waypoint) { + if (waypoint) { TileLocation* old_tile = map.getTileL(waypoint->pos); TileLocation* new_tile = map.getTileL(data->position); - if(data->position.isValid() && old_tile && old_tile->getWaypointCount() > 0) + if (data->position.isValid() && old_tile && old_tile->getWaypointCount() > 0) { old_tile->decreaseWaypointCount(); + } new_tile->increaseWaypointCount(); @@ -406,35 +407,31 @@ void Action::undo(DirtyList* dirty_list) commited = false; } -BatchAction::BatchAction(Editor& editor, ActionIdentifier ident) : +BatchAction::BatchAction(Editor &editor, ActionIdentifier ident) : editor(editor), - timestamp(0), - memory_size(0), - type(ident) -{ - //// + timestamp(0), + memory_size(0), + type(ident) { + //// } - -BatchAction::~BatchAction() -{ - for(Action* action : batch) { +BatchAction::~BatchAction() { + for (Action* action : batch) { delete action; } batch.clear(); } -size_t BatchAction::memsize(bool recalc) const -{ +size_t BatchAction::memsize(bool recalc) const { // Expensive operation, only evaluate once (won't change anyways) - if(!recalc && memory_size > 0) { + if (!recalc && memory_size > 0) { return memory_size; } uint32_t mem = sizeof(*this); mem += sizeof(Action*) * 3 * batch.size(); - for(const Action* action : batch) { + for (const Action* action : batch) { #ifdef __USE_EXACT_MEMSIZE__ mem += action->memsize(); #else @@ -447,18 +444,16 @@ size_t BatchAction::memsize(bool recalc) const return mem; } -bool BatchAction::isNoSelection() const noexcept -{ +bool BatchAction::isNoSelection() const noexcept { return type != ACTION_SELECT && type != ACTION_UNSELECT; } -void BatchAction::addAction(Action* action) -{ - if(!action) { +void BatchAction::addAction(Action* action) { + if (!action) { return; } - if(action->empty() || !editor.CanEdit()) { + if (action->empty() || !editor.CanEdit()) { delete action; return; } @@ -469,13 +464,12 @@ void BatchAction::addAction(Action* action) timestamp = time(nullptr); } -void BatchAction::addAndCommitAction(Action* action) -{ - if(!action) { +void BatchAction::addAndCommitAction(Action* action) { + if (!action) { return; } - if(!editor.CanEdit() || action->empty()) { + if (!editor.CanEdit() || action->empty()) { delete action; return; } @@ -485,76 +479,66 @@ void BatchAction::addAndCommitAction(Action* action) timestamp = time(nullptr); } -void BatchAction::commit() -{ - for(Action* action : batch) { - if(action && !action->isCommited()) { +void BatchAction::commit() { + for (Action* action : batch) { + if (action && !action->isCommited()) { action->commit(nullptr); } } } -void BatchAction::undo() -{ - for(Action* action : std::views::reverse(batch)) { +void BatchAction::undo() { + for (Action* action : std::views::reverse(batch)) { action->undo(nullptr); } } -void BatchAction::redo() -{ - for(Action* action : batch) { +void BatchAction::redo() { + for (Action* action : batch) { action->redo(nullptr); } } -void BatchAction::merge(BatchAction* other) -{ +void BatchAction::merge(BatchAction* other) { batch.insert(batch.end(), other->batch.begin(), other->batch.end()); other->batch.clear(); } -ActionQueue::ActionQueue(Editor& editor) : - current(0), memory_size(0), editor(editor) -{ +ActionQueue::ActionQueue(Editor &editor) : + current(0), memory_size(0), editor(editor) { //// } -ActionQueue::~ActionQueue() -{ - for(BatchAction* batch : actions) { +ActionQueue::~ActionQueue() { + for (BatchAction* batch : actions) { delete batch; } actions.clear(); } -Action* ActionQueue::createAction(ActionIdentifier identifier) const -{ +Action* ActionQueue::createAction(ActionIdentifier identifier) const { return new Action(editor, identifier); } -Action* ActionQueue::createAction(BatchAction* batch) const -{ +Action* ActionQueue::createAction(BatchAction* batch) const { return new Action(editor, batch->getType()); } -BatchAction* ActionQueue::createBatch(ActionIdentifier identifier) const -{ +BatchAction* ActionQueue::createBatch(ActionIdentifier identifier) const { return new BatchAction(editor, identifier); } -void ActionQueue::resetTimer() -{ - if(!actions.empty()) +void ActionQueue::resetTimer() { + if (!actions.empty()) { actions.back()->resetTimer(); + } } -void ActionQueue::addBatch(BatchAction* batch, int stacking_delay) -{ +void ActionQueue::addBatch(BatchAction* batch, int stacking_delay) { ASSERT(batch); ASSERT(current <= actions.size()); - if(batch->empty()) { + if (batch->empty()) { delete batch; return; } @@ -563,30 +547,30 @@ void ActionQueue::addBatch(BatchAction* batch, int stacking_delay) batch->commit(); // Update title - if(batch->isNoSelection() && editor.getMap().doChange()) { + if (batch->isNoSelection() && editor.getMap().doChange()) { g_gui.UpdateTitle(); } - if(batch->getType() == ACTION_REMOTE) { + if (batch->getType() == ACTION_REMOTE) { delete batch; return; } - while(current != actions.size()) { + while (current != actions.size()) { memory_size -= actions.back()->memsize(); BatchAction* todelete = actions.back(); actions.pop_back(); delete todelete; } - while(memory_size > size_t(1024 * 1024 * g_settings.getInteger(Config::UNDO_MEM_SIZE)) && !actions.empty()) { + while (memory_size > size_t(1024 * 1024 * g_settings.getInteger(Config::UNDO_MEM_SIZE)) && !actions.empty()) { memory_size -= actions.front()->memsize(); delete actions.front(); actions.pop_front(); current--; } - if(actions.size() > size_t(g_settings.getInteger(Config::UNDO_SIZE)) && !actions.empty()) { + if (actions.size() > size_t(g_settings.getInteger(Config::UNDO_SIZE)) && !actions.empty()) { memory_size -= actions.front()->memsize(); BatchAction* todelete = actions.front(); actions.pop_front(); @@ -595,9 +579,9 @@ void ActionQueue::addBatch(BatchAction* batch, int stacking_delay) } do { - if(!actions.empty()) { + if (!actions.empty()) { BatchAction* lastAction = actions.back(); - if(lastAction->type == batch->type && g_settings.getInteger(Config::GROUP_ACTIONS) && time(nullptr) - stacking_delay < lastAction->timestamp) { + if (lastAction->type == batch->type && g_settings.getInteger(Config::GROUP_ACTIONS) && time(nullptr) - stacking_delay < lastAction->timestamp) { lastAction->merge(batch); lastAction->timestamp = time(nullptr); memory_size -= lastAction->memsize(); @@ -610,14 +594,13 @@ void ActionQueue::addBatch(BatchAction* batch, int stacking_delay) actions.push_back(batch); batch->timestamp = time(nullptr); current++; - } while(false); + } while (false); } -void ActionQueue::addAction(Action* action, int stacking_delay) -{ +void ActionQueue::addAction(Action* action, int stacking_delay) { BatchAction* batch = createBatch(action->getType()); batch->addAndCommitAction(action); - if(batch->empty()) { + if (batch->empty()) { delete batch; return; } @@ -625,34 +608,31 @@ void ActionQueue::addAction(Action* action, int stacking_delay) addBatch(batch, stacking_delay); } -const BatchAction* ActionQueue::getAction(size_t index) const -{ - if(index >= 0 && index < actions.size()) { +const BatchAction* ActionQueue::getAction(size_t index) const { + if (index >= 0 && index < actions.size()) { return actions.at(index); } return nullptr; } -void ActionQueue::generateLabels() -{ - for(BatchAction* batch : actions) { - if(batch && batch->label.IsEmpty()) { +void ActionQueue::generateLabels() { + for (BatchAction* batch : actions) { + if (batch && batch->label.IsEmpty()) { batch->label = createLabel(batch->getType()); } } } -bool ActionQueue::undo() -{ - if(current > 0) { +bool ActionQueue::undo() { + if (current > 0) { current--; BatchAction* batch = actions.at(current); - if(batch) { + if (batch) { batch->undo(); } // Update title - if(batch && batch->isNoSelection() && editor.getMap().doChange()) { + if (batch && batch->isNoSelection() && editor.getMap().doChange()) { g_gui.UpdateTitle(); } return true; @@ -660,17 +640,16 @@ bool ActionQueue::undo() return false; } -bool ActionQueue::redo() -{ - if(current < actions.size()) { +bool ActionQueue::redo() { + if (current < actions.size()) { BatchAction* batch = actions.at(current); - if(batch) { + if (batch) { batch->redo(); } current++; // Update title - if(batch && batch->isNoSelection() && editor.getMap().doChange()) { + if (batch && batch->isNoSelection() && editor.getMap().doChange()) { g_gui.UpdateTitle(); } return true; @@ -678,73 +657,81 @@ bool ActionQueue::redo() return false; } -bool ActionQueue::hasChanges() const -{ - for(const BatchAction* batch : actions) { - if(batch && !batch->empty() && batch->isNoSelection()) { +bool ActionQueue::hasChanges() const { + for (const BatchAction* batch : actions) { + if (batch && !batch->empty() && batch->isNoSelection()) { return true; } } return false; } -void ActionQueue::clear() -{ - for(BatchAction* batch : actions) { +void ActionQueue::clear() { + for (BatchAction* batch : actions) { delete batch; } actions.clear(); current = 0; } -wxString ActionQueue::createLabel(ActionIdentifier type) -{ +wxString ActionQueue::createLabel(ActionIdentifier type) { switch (type) { - case ACTION_MOVE: return "Move"; - case ACTION_SELECT: return "Select"; - case ACTION_UNSELECT: return "Unselect"; - case ACTION_DELETE_TILES: return "Delete"; - case ACTION_CUT_TILES: return "Cut"; - case ACTION_PASTE_TILES: return "Paste"; - case ACTION_RANDOMIZE: return "Randomize"; - case ACTION_BORDERIZE: return "Borderize"; - case ACTION_DRAW: return "Draw"; - case ACTION_ERASE: return "Erase"; - case ACTION_SWITCHDOOR: return "Switch Door"; - case ACTION_ROTATE_ITEM: return "Rotate Item"; - case ACTION_REPLACE_ITEMS: return "Replace"; - case ACTION_CHANGE_PROPERTIES: return "Change Properties"; - default: return wxEmptyString; - } -} - -void DirtyList::AddPosition(int x, int y, int z) -{ + case ACTION_MOVE: + return "Move"; + case ACTION_SELECT: + return "Select"; + case ACTION_UNSELECT: + return "Unselect"; + case ACTION_DELETE_TILES: + return "Delete"; + case ACTION_CUT_TILES: + return "Cut"; + case ACTION_PASTE_TILES: + return "Paste"; + case ACTION_RANDOMIZE: + return "Randomize"; + case ACTION_BORDERIZE: + return "Borderize"; + case ACTION_DRAW: + return "Draw"; + case ACTION_ERASE: + return "Erase"; + case ACTION_SWITCHDOOR: + return "Switch Door"; + case ACTION_ROTATE_ITEM: + return "Rotate Item"; + case ACTION_REPLACE_ITEMS: + return "Replace"; + case ACTION_CHANGE_PROPERTIES: + return "Change Properties"; + default: + return wxEmptyString; + } +} + +void DirtyList::AddPosition(int x, int y, int z) { uint32_t m = ((x >> 2) << 18) | ((y >> 2) << 4); - ValueType fi = {m, 0}; + ValueType fi = { m, 0 }; SetType::iterator s = iset.find(fi); - if(s != iset.end()) { + if (s != iset.end()) { ValueType v = *s; iset.erase(s); v.floors = (1 << z) | v.floors; iset.insert(v); } else { - ValueType v = {m, (uint32_t)(1 << z)}; + ValueType v = { m, (uint32_t)(1 << z) }; iset.insert(v); } } -void DirtyList::AddChange(Change* c) -{ +void DirtyList::AddChange(Change* c) { ichanges.push_back(c); } -DirtyList::SetType& DirtyList::GetPosList() -{ +DirtyList::SetType &DirtyList::GetPosList() { return iset; } -ChangeList& DirtyList::GetChanges() -{ +ChangeList &DirtyList::GetChanges() { return ichanges; } diff --git a/source/action.h b/source/action.h index c4da490c..ecee21b2 100644 --- a/source/action.h +++ b/source/action.h @@ -69,13 +69,17 @@ class Change { Change(Tile* tile); ~Change(); - static Change* Create(House* house, const Position& position); - static Change* Create(Waypoint* waypoint, const Position& position); + static Change* Create(House* house, const Position &position); + static Change* Create(Waypoint* waypoint, const Position &position); void clear(); - ChangeType getType() const noexcept { return type; } - void* getData() const noexcept { return data; } + ChangeType getType() const noexcept { + return type; + } + void* getData() const noexcept { + return data; + } uint32_t memsize() const; @@ -90,8 +94,7 @@ class Change { typedef std::vector ChangeList; // A dirty list represents a list of all tiles that was changed in an action -class DirtyList -{ +class DirtyList { public: struct ValueType { uint32_t pos; @@ -102,28 +105,28 @@ class DirtyList protected: struct Comparator { - bool operator()(const ValueType& a, const ValueType& b) const { + bool operator()(const ValueType &a, const ValueType &b) const { return a.pos < b.pos; } }; public: - typedef std::set SetType; void AddPosition(int x, int y, int z); void AddChange(Change* c); - bool Empty() const {return iset.empty() && ichanges.empty();} - SetType& GetPosList(); - ChangeList& GetChanges(); + bool Empty() const { + return iset.empty() && ichanges.empty(); + } + SetType &GetPosList(); + ChangeList &GetChanges(); protected: SetType iset; ChangeList ichanges; }; -class Action -{ +class Action { public: virtual ~Action(); @@ -134,21 +137,31 @@ class Action // Get memory footprint size_t approx_memsize() const; size_t memsize() const; - size_t size() const noexcept { return changes.size(); } - bool empty() const noexcept { return changes.empty(); } - ActionIdentifier getType() const noexcept { return type; } + size_t size() const noexcept { + return changes.size(); + } + bool empty() const noexcept { + return changes.empty(); + } + ActionIdentifier getType() const noexcept { + return type; + } void commit(DirtyList* dirty_list); - bool isCommited() const noexcept { return commited; } + bool isCommited() const noexcept { + return commited; + } void undo(DirtyList* dirty_list); - void redo(DirtyList* dirty_list) {commit(dirty_list);} + void redo(DirtyList* dirty_list) { + commit(dirty_list); + } protected: - Action(Editor& editor, ActionIdentifier ident); + Action(Editor &editor, ActionIdentifier ident); bool commited; ChangeList changes; - Editor& editor; + Editor &editor; ActionIdentifier type; friend class ActionQueue; @@ -156,26 +169,35 @@ class Action typedef std::vector ActionVector; -class BatchAction -{ +class BatchAction { public: virtual ~BatchAction(); - void resetTimer() noexcept { timestamp = 0; } + void resetTimer() noexcept { + timestamp = 0; + } // Get memory footprint size_t memsize(bool resize = false) const; - size_t size() const noexcept { return batch.size(); } - bool empty() const noexcept { return batch.empty(); } - ActionIdentifier getType() const noexcept { return type; } - const wxString& getLabel() const noexcept { return label; } + size_t size() const noexcept { + return batch.size(); + } + bool empty() const noexcept { + return batch.empty(); + } + ActionIdentifier getType() const noexcept { + return type; + } + const wxString &getLabel() const noexcept { + return label; + } bool isNoSelection() const noexcept; virtual void addAction(Action* action); virtual void addAndCommitAction(Action* action); protected: - BatchAction(Editor& editor, ActionIdentifier ident); + BatchAction(Editor &editor, ActionIdentifier ident); virtual void commit(); virtual void undo(); @@ -183,7 +205,7 @@ class BatchAction void merge(BatchAction* other); - Editor& editor; + Editor &editor; int timestamp; uint32_t memory_size; ActionIdentifier type; @@ -193,10 +215,9 @@ class BatchAction friend class ActionQueue; }; -class ActionQueue -{ +class ActionQueue { public: - ActionQueue(Editor& editor); + ActionQueue(Editor &editor); virtual ~ActionQueue(); typedef std::deque ActionList; @@ -214,13 +235,25 @@ class ActionQueue bool redo(); void clear(); - const ActionList& getActions() const noexcept { return actions; } + const ActionList &getActions() const noexcept { + return actions; + } const BatchAction* getAction(size_t index) const; - int getCurrentIndex() const noexcept { return current; } - bool canUndo() const noexcept { return current > 0; } - bool canRedo() const noexcept { return current < actions.size(); } - size_t size() const noexcept { return actions.size(); } - bool empty() const noexcept { return actions.empty(); } + int getCurrentIndex() const noexcept { + return current; + } + bool canUndo() const noexcept { + return current > 0; + } + bool canRedo() const noexcept { + return current < actions.size(); + } + size_t size() const noexcept { + return actions.size(); + } + bool empty() const noexcept { + return actions.empty(); + } bool hasChanges() const; @@ -231,7 +264,7 @@ class ActionQueue size_t current; size_t memory_size; - Editor& editor; + Editor &editor; ActionList actions; }; diff --git a/source/actions_history_window.cpp b/source/actions_history_window.cpp index 43a53de3..05ebcb43 100644 --- a/source/actions_history_window.cpp +++ b/source/actions_history_window.cpp @@ -22,8 +22,7 @@ #include "gui.h" HistoryListBox::HistoryListBox(wxWindow* parent) : - wxVListBox(parent, wxID_ANY) -{ + wxVListBox(parent, wxID_ANY) { wxSize icon_size = FROM_DIP(parent, wxSize(16, 16)); open_bitmap = wxArtProvider::GetBitmap(wxART_FILE_OPEN, wxART_TOOLBAR, icon_size); move_bitmap = wxArtProvider::GetBitmap(ART_MOVE, wxART_LIST, icon_size); @@ -43,27 +42,26 @@ HistoryListBox::HistoryListBox(wxWindow* parent) : change_bitmap = wxArtProvider::GetBitmap(ART_CHANGE, wxART_LIST, icon_size); } -void HistoryListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t index) const -{ +void HistoryListBox::OnDrawItem(wxDC &dc, const wxRect &rect, size_t index) const { const Editor* editor = g_gui.GetCurrentEditor(); - if(!editor) { + if (!editor) { return; } const ActionQueue* actions = editor->getHistoryActions(); - if(!actions) { + if (!actions) { return; } - if(IsSelected(index)) { + if (IsSelected(index)) { dc.SetTextForeground(*wxBLUE); } else { dc.SetTextForeground(*wxBLACK); } const BatchAction* action = actions->getAction(index - 1); - if(action) { - const wxBitmap& bitmap = getIconBitmap(action->getType()); + if (action) { + const wxBitmap &bitmap = getIconBitmap(action->getType()); dc.DrawBitmap(bitmap, rect.GetX() + 4, rect.GetY() + 4, true); dc.DrawText(action->getLabel(), rect.GetX() + 28, rect.GetY() + 3); } else { @@ -72,15 +70,12 @@ void HistoryListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t index) cons } } -wxCoord HistoryListBox::OnMeasureItem(size_t index) const -{ +wxCoord HistoryListBox::OnMeasureItem(size_t index) const { return 24; } -const wxBitmap& HistoryListBox::getIconBitmap(ActionIdentifier identifier) const -{ - switch (identifier) - { +const wxBitmap &HistoryListBox::getIconBitmap(ActionIdentifier identifier) const { + switch (identifier) { case ACTION_MOVE: return move_bitmap; case ACTION_REMOTE: @@ -117,8 +112,7 @@ const wxBitmap& HistoryListBox::getIconBitmap(ActionIdentifier identifier) const } ActionsHistoryWindow::ActionsHistoryWindow(wxWindow* parent) : - wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(230, 250)) -{ + wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(230, 250)) { SetSizeHints(wxDefaultSize, wxDefaultSize); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); @@ -133,19 +127,18 @@ ActionsHistoryWindow::ActionsHistoryWindow(wxWindow* parent) : list->Connect(wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler(ActionsHistoryWindow::OnListSelected), NULL, this); } -ActionsHistoryWindow::~ActionsHistoryWindow() -{ +ActionsHistoryWindow::~ActionsHistoryWindow() { // Disconnect Events list->Disconnect(wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler(ActionsHistoryWindow::OnListSelected), NULL, this); } -void ActionsHistoryWindow::RefreshActions() -{ - if(!IsShownOnScreen()) +void ActionsHistoryWindow::RefreshActions() { + if (!IsShownOnScreen()) { return; + } const Editor* editor = g_gui.GetCurrentEditor(); - if(!editor) { + if (!editor) { list->SetItemCount(0); list->Refresh(); return; @@ -155,7 +148,7 @@ void ActionsHistoryWindow::RefreshActions() int selection = 0; const ActionQueue* actions = editor->getHistoryActions(); - if(actions) { + if (actions) { count += actions->size(); selection += actions->getCurrentIndex(); } @@ -165,16 +158,16 @@ void ActionsHistoryWindow::RefreshActions() list->Refresh(); } -void ActionsHistoryWindow::OnListSelected(wxCommandEvent& event) -{ +void ActionsHistoryWindow::OnListSelected(wxCommandEvent &event) { int index = list->GetSelection(); - if(index == wxNOT_FOUND) + if (index == wxNOT_FOUND) { return; + } Editor* editor = g_gui.GetCurrentEditor(); - if(editor && editor->getHistoryActions()) { + if (editor && editor->getHistoryActions()) { int current = editor->getHistoryActions()->getCurrentIndex(); - if(index > current) { + if (index > current) { editor->redo(index - current); } else if (index < current) { editor->undo(current - index); diff --git a/source/actions_history_window.h b/source/actions_history_window.h index 2007f6b8..55041a31 100644 --- a/source/actions_history_window.h +++ b/source/actions_history_window.h @@ -21,16 +21,15 @@ #include "main.h" #include "action.h" -class HistoryListBox : public wxVListBox -{ +class HistoryListBox : public wxVListBox { public: - HistoryListBox(wxWindow *parent); + HistoryListBox(wxWindow* parent); - void OnDrawItem(wxDC& dc, const wxRect& rect, size_t index) const override; + void OnDrawItem(wxDC &dc, const wxRect &rect, size_t index) const override; wxCoord OnMeasureItem(size_t index) const override; private: - const wxBitmap& getIconBitmap(ActionIdentifier identifier) const; + const wxBitmap &getIconBitmap(ActionIdentifier identifier) const; wxBitmap open_bitmap; wxBitmap move_bitmap; @@ -50,15 +49,14 @@ class HistoryListBox : public wxVListBox wxBitmap change_bitmap; }; -class ActionsHistoryWindow : public wxPanel -{ +class ActionsHistoryWindow : public wxPanel { public: ActionsHistoryWindow(wxWindow* parent); virtual ~ActionsHistoryWindow(); void RefreshActions(); - void OnListSelected(wxCommandEvent& event); + void OnListSelected(wxCommandEvent &event); protected: HistoryListBox* list; diff --git a/source/application.cpp b/source/application.cpp index f8f503a6..dd53650b 100644 --- a/source/application.cpp +++ b/source/application.cpp @@ -37,66 +37,64 @@ #include "npc.h" #if defined(__LINUX__) || defined(__WINDOWS__) -#include + #include #endif #include "../brushes/icon/rme_icon.xpm" BEGIN_EVENT_TABLE(MainFrame, wxFrame) - EVT_CLOSE(MainFrame::OnExit) +EVT_CLOSE(MainFrame::OnExit) - // Update check complete +// Update check complete #ifdef _USE_UPDATER_ - EVT_ON_UPDATE_CHECK_FINISHED(wxID_ANY, MainFrame::OnUpdateReceived) +EVT_ON_UPDATE_CHECK_FINISHED(wxID_ANY, MainFrame::OnUpdateReceived) #endif - EVT_ON_UPDATE_MENUS(wxID_ANY, MainFrame::OnUpdateMenus) - EVT_ON_UPDATE_ACTIONS(wxID_ANY, MainFrame::OnUpdateActions) +EVT_ON_UPDATE_MENUS(wxID_ANY, MainFrame::OnUpdateMenus) +EVT_ON_UPDATE_ACTIONS(wxID_ANY, MainFrame::OnUpdateActions) - // Idle event handler - EVT_IDLE(MainFrame::OnIdle) +// Idle event handler +EVT_IDLE(MainFrame::OnIdle) END_EVENT_TABLE() BEGIN_EVENT_TABLE(MapWindow, wxPanel) - EVT_SIZE(MapWindow::OnSize) - - EVT_COMMAND_SCROLL_TOP (MAP_WINDOW_HSCROLL, MapWindow::OnScroll) - EVT_COMMAND_SCROLL_BOTTOM (MAP_WINDOW_HSCROLL, MapWindow::OnScroll) - EVT_COMMAND_SCROLL_THUMBTRACK(MAP_WINDOW_HSCROLL, MapWindow::OnScroll) - EVT_COMMAND_SCROLL_LINEUP (MAP_WINDOW_HSCROLL, MapWindow::OnScrollLineUp) - EVT_COMMAND_SCROLL_LINEDOWN (MAP_WINDOW_HSCROLL, MapWindow::OnScrollLineDown) - EVT_COMMAND_SCROLL_PAGEUP (MAP_WINDOW_HSCROLL, MapWindow::OnScrollPageUp) - EVT_COMMAND_SCROLL_PAGEDOWN (MAP_WINDOW_HSCROLL, MapWindow::OnScrollPageDown) - - EVT_COMMAND_SCROLL_TOP (MAP_WINDOW_VSCROLL, MapWindow::OnScroll) - EVT_COMMAND_SCROLL_BOTTOM (MAP_WINDOW_VSCROLL, MapWindow::OnScroll) - EVT_COMMAND_SCROLL_THUMBTRACK(MAP_WINDOW_VSCROLL, MapWindow::OnScroll) - EVT_COMMAND_SCROLL_LINEUP (MAP_WINDOW_VSCROLL, MapWindow::OnScrollLineUp) - EVT_COMMAND_SCROLL_LINEDOWN (MAP_WINDOW_VSCROLL, MapWindow::OnScrollLineDown) - EVT_COMMAND_SCROLL_PAGEUP (MAP_WINDOW_VSCROLL, MapWindow::OnScrollPageUp) - EVT_COMMAND_SCROLL_PAGEDOWN (MAP_WINDOW_VSCROLL, MapWindow::OnScrollPageDown) - - EVT_BUTTON(MAP_WINDOW_GEM, MapWindow::OnGem) +EVT_SIZE(MapWindow::OnSize) + +EVT_COMMAND_SCROLL_TOP(MAP_WINDOW_HSCROLL, MapWindow::OnScroll) +EVT_COMMAND_SCROLL_BOTTOM(MAP_WINDOW_HSCROLL, MapWindow::OnScroll) +EVT_COMMAND_SCROLL_THUMBTRACK(MAP_WINDOW_HSCROLL, MapWindow::OnScroll) +EVT_COMMAND_SCROLL_LINEUP(MAP_WINDOW_HSCROLL, MapWindow::OnScrollLineUp) +EVT_COMMAND_SCROLL_LINEDOWN(MAP_WINDOW_HSCROLL, MapWindow::OnScrollLineDown) +EVT_COMMAND_SCROLL_PAGEUP(MAP_WINDOW_HSCROLL, MapWindow::OnScrollPageUp) +EVT_COMMAND_SCROLL_PAGEDOWN(MAP_WINDOW_HSCROLL, MapWindow::OnScrollPageDown) + +EVT_COMMAND_SCROLL_TOP(MAP_WINDOW_VSCROLL, MapWindow::OnScroll) +EVT_COMMAND_SCROLL_BOTTOM(MAP_WINDOW_VSCROLL, MapWindow::OnScroll) +EVT_COMMAND_SCROLL_THUMBTRACK(MAP_WINDOW_VSCROLL, MapWindow::OnScroll) +EVT_COMMAND_SCROLL_LINEUP(MAP_WINDOW_VSCROLL, MapWindow::OnScrollLineUp) +EVT_COMMAND_SCROLL_LINEDOWN(MAP_WINDOW_VSCROLL, MapWindow::OnScrollLineDown) +EVT_COMMAND_SCROLL_PAGEUP(MAP_WINDOW_VSCROLL, MapWindow::OnScrollPageUp) +EVT_COMMAND_SCROLL_PAGEDOWN(MAP_WINDOW_VSCROLL, MapWindow::OnScrollPageDown) + +EVT_BUTTON(MAP_WINDOW_GEM, MapWindow::OnGem) END_EVENT_TABLE() BEGIN_EVENT_TABLE(MapScrollBar, wxScrollBar) - EVT_KEY_DOWN(MapScrollBar::OnKey) - EVT_KEY_UP(MapScrollBar::OnKey) - EVT_CHAR(MapScrollBar::OnKey) - EVT_SET_FOCUS(MapScrollBar::OnFocus) - EVT_MOUSEWHEEL(MapScrollBar::OnWheel) +EVT_KEY_DOWN(MapScrollBar::OnKey) +EVT_KEY_UP(MapScrollBar::OnKey) +EVT_CHAR(MapScrollBar::OnKey) +EVT_SET_FOCUS(MapScrollBar::OnFocus) +EVT_MOUSEWHEEL(MapScrollBar::OnWheel) END_EVENT_TABLE() wxIMPLEMENT_APP(Application); -Application::~Application() -{ +Application::~Application() { // Destroy } -bool Application::OnInit() -{ +bool Application::OnInit() { #if defined __DEBUG_MODE__ && defined __WINDOWS__ - _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif std::cout << "This is free software: you are free to change and redistribute it." << std::endl; @@ -125,31 +123,31 @@ bool Application::OnInit() ClientVersion::loadVersions(); #ifdef _USE_PROCESS_COM - m_single_instance_checker = newd wxSingleInstanceChecker; //Instance checker has to stay alive throughout the applications lifetime + m_single_instance_checker = newd wxSingleInstanceChecker; // Instance checker has to stay alive throughout the applications lifetime if (g_settings.getInteger(Config::ONLY_ONE_INSTANCE) && m_single_instance_checker->IsAnotherRunning()) { RMEProcessClient client; wxConnectionBase* connection = client.MakeConnection("localhost", "rme_host", "rme_talk"); if (connection) { wxString fileName; if (ParseCommandLineMap(fileName)) { - wxLogNull nolog; //We might get a timeout message if the file fails to open on the running instance. Let's not show that message. + wxLogNull nolog; // We might get a timeout message if the file fails to open on the running instance. Let's not show that message. connection->Execute(fileName); } connection->Disconnect(); wxDELETE(connection); } wxDELETE(m_single_instance_checker); - return false; //Since we return false - OnExit is never called + return false; // Since we return false - OnExit is never called } // We act as server then m_proc_server = newd RMEProcessServer(); - if(!m_proc_server->Create("rme_host")) { + if (!m_proc_server->Create("rme_host")) { wxLogWarning("Could not register IPC service!"); } #endif // Image handlers - //wxImage::AddHandler(newd wxBMPHandler); + // wxImage::AddHandler(newd wxBMPHandler); wxImage::AddHandler(newd wxPNGHandler); wxImage::AddHandler(newd wxJPEGHandler); wxImage::AddHandler(newd wxTGAHandler); @@ -157,16 +155,16 @@ bool Application::OnInit() g_gui.gfx.loadEditorSprites(); #ifndef __DEBUG_MODE__ - //wxHandleFatalExceptions(true); + // wxHandleFatalExceptions(true); #endif - // Load all the dependency files - std::string error; - StringVector warnings; + // Load all the dependency files + std::string error; + StringVector warnings; - m_file_to_open = wxEmptyString; - ParseCommandLineMap(m_file_to_open); + m_file_to_open = wxEmptyString; + ParseCommandLineMap(m_file_to_open); - g_gui.root = newd MainFrame(__W_RME_APPLICATION_NAME__, wxDefaultPosition, wxSize(700,500)); + g_gui.root = newd MainFrame(__W_RME_APPLICATION_NAME__, wxDefaultPosition, wxSize(700, 500)); SetTopWindow(g_gui.root); g_gui.SetTitle(""); @@ -175,39 +173,41 @@ bool Application::OnInit() // Load palette g_gui.LoadPerspective(); - wxIcon icon(rme_icon); - g_gui.root->SetIcon(icon); + wxIcon icon(rme_icon); + g_gui.root->SetIcon(icon); - if (g_settings.getInteger(Config::WELCOME_DIALOG) == 1 && m_file_to_open == wxEmptyString) { - g_gui.ShowWelcomeDialog(icon); - } else { - g_gui.root->Show(); - } + if (g_settings.getInteger(Config::WELCOME_DIALOG) == 1 && m_file_to_open == wxEmptyString) { + g_gui.ShowWelcomeDialog(icon); + } else { + g_gui.root->Show(); + } // Set idle event handling mode wxIdleEvent::SetMode(wxIDLE_PROCESS_SPECIFIED); // Goto RME website? - if(g_settings.getInteger(Config::GOTO_WEBSITE_ON_BOOT) == 1) { + if (g_settings.getInteger(Config::GOTO_WEBSITE_ON_BOOT) == 1) { ::wxLaunchDefaultBrowser("http://www.remeresmapeditor.com/", wxBROWSER_NEW_WINDOW); g_settings.setInteger(Config::GOTO_WEBSITE_ON_BOOT, 0); } // Check for updates #ifdef _USE_UPDATER_ - if(g_settings.getInteger(Config::USE_UPDATER) == -1) { + if (g_settings.getInteger(Config::USE_UPDATER) == -1) { int ret = g_gui.PopupDialog( "Notice", "Do you want the editor to automatically check for updates?\n" "It will connect to the internet if you choose yes.\n" - "You can change this setting in the preferences later.", wxYES | wxNO); - if(ret == wxID_YES) { + "You can change this setting in the preferences later.", + wxYES | wxNO + ); + if (ret == wxID_YES) { g_settings.setInteger(Config::USE_UPDATER, 1); } else { g_settings.setInteger(Config::USE_UPDATER, 0); } } - if(g_settings.getInteger(Config::USE_UPDATER) == 1) { + if (g_settings.getInteger(Config::USE_UPDATER) == 1) { UpdateChecker updater; updater.connect(g_gui.root); } @@ -215,7 +215,7 @@ bool Application::OnInit() FileName save_failed_file = GUI::GetLocalDataDirectory(); save_failed_file.SetName(".saving.txt"); - if(save_failed_file.FileExists()) { + if (save_failed_file.FileExists()) { std::ifstream f(nstr(save_failed_file.GetFullPath()).c_str(), std::ios::in); std::string backup_otbm, backup_house, backup_spawn, backup_spawn_npc; @@ -230,32 +230,34 @@ bool Application::OnInit() std::remove(nstr(save_failed_file.GetFullPath()).c_str()); // Query file retrieval if possible - if(!backup_otbm.empty()) { + if (!backup_otbm.empty()) { long ret = g_gui.PopupDialog( "Editor Crashed", wxString( "IMPORTANT! THE EDITOR CRASHED WHILE SAVING!\n\n" - "Do you want to recover the lost map? (it will be opened immediately):\n") << - wxstr(backup_otbm) << "\n" << - wxstr(backup_house) << "\n" << - wxstr(backup_spawn) << "\n" << - wxstr(backup_spawn_npc) << "\n", - wxYES | wxNO); - - if(ret == wxID_YES) { + "Do you want to recover the lost map? (it will be opened immediately):\n" + ) << wxstr(backup_otbm) + << "\n" + << wxstr(backup_house) << "\n" + << wxstr(backup_spawn) << "\n" + << wxstr(backup_spawn_npc) << "\n", + wxYES | wxNO + ); + + if (ret == wxID_YES) { // Recover if the user so wishes std::remove(backup_otbm.substr(0, backup_otbm.size() - 1).c_str()); std::rename(backup_otbm.c_str(), backup_otbm.substr(0, backup_otbm.size() - 1).c_str()); - if(!backup_house.empty()) { + if (!backup_house.empty()) { std::remove(backup_house.substr(0, backup_house.size() - 1).c_str()); std::rename(backup_house.c_str(), backup_house.substr(0, backup_house.size() - 1).c_str()); } - if(!backup_spawn.empty()) { + if (!backup_spawn.empty()) { std::remove(backup_spawn.substr(0, backup_spawn.size() - 1).c_str()); std::rename(backup_spawn.c_str(), backup_spawn.substr(0, backup_spawn.size() - 1).c_str()); } - if(!backup_spawn_npc.empty()) { + if (!backup_spawn_npc.empty()) { std::remove(backup_spawn_npc.substr(0, backup_spawn_npc.size() - 1).c_str()); std::rename(backup_spawn_npc.c_str(), backup_spawn_npc.substr(0, backup_spawn_npc.size() - 1).c_str()); } @@ -266,51 +268,51 @@ bool Application::OnInit() } } } - // Keep track of first event loop entry - m_startup = true; + // Keep track of first event loop entry + m_startup = true; return true; } void Application::OnEventLoopEnter(wxEventLoopBase* loop) { - //First startup? - if (!m_startup) - return; - m_startup = false; - - //Don't try to create a map if we didn't load the client map. - if(ClientVersion::getLatestVersion() == nullptr) - return; - - //Open a map. - if (m_file_to_open != wxEmptyString) { - g_gui.LoadMap(FileName(m_file_to_open)); - } else if (!g_gui.IsWelcomeDialogShown() && g_gui.NewMap()) { //Open a new empty map - // You generally don't want to save this map... - g_gui.GetCurrentEditor()->clearChanges(); - } + // First startup? + if (!m_startup) { + return; + } + m_startup = false; + + // Don't try to create a map if we didn't load the client map. + if (ClientVersion::getLatestVersion() == nullptr) { + return; + } + + // Open a map. + if (m_file_to_open != wxEmptyString) { + g_gui.LoadMap(FileName(m_file_to_open)); + } else if (!g_gui.IsWelcomeDialogShown() && g_gui.NewMap()) { // Open a new empty map + // You generally don't want to save this map... + g_gui.GetCurrentEditor()->clearChanges(); + } } -void Application::MacOpenFiles(const wxArrayString& fileNames) -{ +void Application::MacOpenFiles(const wxArrayString &fileNames) { if (!fileNames.IsEmpty()) { g_gui.LoadMap(FileName(fileNames.Item(0))); } } -void Application::FixVersionDiscrapencies() -{ +void Application::FixVersionDiscrapencies() { // Here the registry should be fixed, if the version has been changed - if(g_settings.getInteger(Config::VERSION_ID) < MAKE_VERSION_ID(1, 0, 5)) { + if (g_settings.getInteger(Config::VERSION_ID) < MAKE_VERSION_ID(1, 0, 5)) { g_settings.setInteger(Config::USE_MEMCACHED_SPRITES_TO_SAVE, 0); } - if(g_settings.getInteger(Config::VERSION_ID) < __RME_VERSION_ID__ && ClientVersion::getLatestVersion() != nullptr){ + if (g_settings.getInteger(Config::VERSION_ID) < __RME_VERSION_ID__ && ClientVersion::getLatestVersion() != nullptr) { g_settings.setInteger(Config::DEFAULT_CLIENT_VERSION, ClientVersion::getLatestVersion()->getID()); } wxString ss = wxstr(g_settings.getString(Config::SCREENSHOT_DIRECTORY)); - if(ss.empty()) { + if (ss.empty()) { ss = wxStandardPaths::Get().GetDocumentsDir(); #ifdef __WINDOWS__ ss += "/My Pictures/RME/"; @@ -322,8 +324,7 @@ void Application::FixVersionDiscrapencies() g_settings.setInteger(Config::VERSION_ID, __RME_VERSION_ID__); } -void Application::Unload() -{ +void Application::Unload() { g_gui.CloseAllEditors(); g_gui.UnloadVersion(); g_gui.SaveHotkeys(); @@ -335,8 +336,7 @@ void Application::Unload() g_gui.root = nullptr; } -int Application::OnExit() -{ +int Application::OnExit() { #ifdef _USE_PROCESS_COM wxDELETE(m_proc_server); wxDELETE(m_single_instance_checker); @@ -344,30 +344,27 @@ int Application::OnExit() return 1; } -void Application::OnFatalException() -{ +void Application::OnFatalException() { //// } -bool Application::ParseCommandLineMap(wxString& fileName) -{ - if(argc == 2) { +bool Application::ParseCommandLineMap(wxString &fileName) { + if (argc == 2) { fileName = wxString(argv[1]); return true; } return false; } -MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size) : - wxFrame((wxFrame *)nullptr, -1, title, pos, size, wxDEFAULT_FRAME_STYLE) -{ +MainFrame::MainFrame(const wxString &title, const wxPoint &pos, const wxSize &size) : + wxFrame((wxFrame*)nullptr, -1, title, pos, size, wxDEFAULT_FRAME_STYLE) { // Receive idle events SetExtraStyle(wxWS_EX_PROCESS_IDLE); - #if wxCHECK_VERSION(3, 1, 0) //3.1.0 or higher - // Make sure ShowFullScreen() uses the full screen API on macOS - EnableFullScreenView(true); - #endif +#if wxCHECK_VERSION(3, 1, 0) // 3.1.0 or higher + // Make sure ShowFullScreen() uses the full screen API on macOS + EnableFullScreenView(true); +#endif // Creates the file-dropdown menu menu_bar = newd MainMenuBar(this); @@ -376,10 +373,11 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si wxFileName filename; filename.Assign(g_gui.getFoundDataDirectory() + "menubar.xml"); - if(!filename.FileExists()) + if (!filename.FileExists()) { filename = FileName(GUI::GetDataDirectory() + "menubar.xml"); + } - if(!menu_bar->Load(filename, warnings, error)) { + if (!menu_bar->Load(filename, warnings, error)) { wxLogError(wxString() + "Could not load menubar.xml, editor will NOT be able to show its menu.\n"); } @@ -401,83 +399,81 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si MainFrame::~MainFrame() = default; -void MainFrame::OnIdle(wxIdleEvent& event) -{ +void MainFrame::OnIdle(wxIdleEvent &event) { //// } #ifdef _USE_UPDATER_ -void MainFrame::OnUpdateReceived(wxCommandEvent& event) -{ +void MainFrame::OnUpdateReceived(wxCommandEvent &event) { std::string data = *(std::string*)event.GetClientData(); delete (std::string*)event.GetClientData(); size_t first_colon = data.find(':'); - size_t second_colon = data.find(':', first_colon+1); + size_t second_colon = data.find(':', first_colon + 1); - if(first_colon == std::string::npos || second_colon == std::string::npos) + if (first_colon == std::string::npos || second_colon == std::string::npos) { return; + } std::string update = data.substr(0, first_colon); - std::string verstr = data.substr(first_colon+1, second_colon-first_colon-1); - std::string url = (second_colon == data.size()? "" : data.substr(second_colon+1)); + std::string verstr = data.substr(first_colon + 1, second_colon - first_colon - 1); + std::string url = (second_colon == data.size() ? "" : data.substr(second_colon + 1)); - if(update == "yes") { + if (update == "yes") { int ret = g_gui.PopupDialog( "Update Notice", - wxString("There is a newd update available (") << wxstr(verstr) << - "). Do you want to go to the website and download it?", + wxString("There is a newd update available (") << wxstr(verstr) << "). Do you want to go to the website and download it?", wxYES | wxNO, "I don't want any update notices", Config::AUTOCHECK_FOR_UPDATES - ); - if(ret == wxID_YES) - ::wxLaunchDefaultBrowser(wxstr(url), wxBROWSER_NEW_WINDOW); + ); + if (ret == wxID_YES) { + ::wxLaunchDefaultBrowser(wxstr(url), wxBROWSER_NEW_WINDOW); + } } } #endif -void MainFrame::OnUpdateMenus(wxCommandEvent&) -{ +void MainFrame::OnUpdateMenus(wxCommandEvent &) { UpdateMenubar(); g_gui.UpdateMinimap(true); g_gui.UpdateTitle(); } -void MainFrame::OnUpdateActions(wxCommandEvent&) -{ +void MainFrame::OnUpdateActions(wxCommandEvent &) { tool_bar->UpdateButtons(); g_gui.RefreshActions(); } #ifdef __WINDOWS__ -bool MainFrame::MSWTranslateMessage(WXMSG *msg) -{ - if(g_gui.AreHotkeysEnabled()) { - if(wxFrame::MSWTranslateMessage(msg)) +bool MainFrame::MSWTranslateMessage(WXMSG* msg) { + if (g_gui.AreHotkeysEnabled()) { + if (wxFrame::MSWTranslateMessage(msg)) { return true; + } } else { - if(wxWindow::MSWTranslateMessage(msg)) + if (wxWindow::MSWTranslateMessage(msg)) { return true; + } } return false; } #endif -void MainFrame::UpdateMenubar() -{ +void MainFrame::UpdateMenubar() { menu_bar->Update(); tool_bar->UpdateButtons(); } bool MainFrame::DoQueryClose() { Editor* editor = g_gui.GetCurrentEditor(); - if(editor) { - if(editor->IsLive()) { + if (editor) { + if (editor->IsLive()) { long ret = g_gui.PopupDialog( "Must Close Server", wxString("You are currently connected to a live server, to close this map the connection must be severed."), - wxOK | wxCANCEL); - if(ret == wxID_OK) { + wxOK | wxCANCEL + ); + if (ret == wxID_OK) { editor->CloseLiveServer(); } else { return false; @@ -487,64 +483,63 @@ bool MainFrame::DoQueryClose() { return true; } -bool MainFrame::DoQuerySave(bool doclose) -{ - if(!g_gui.IsEditorOpen()) { +bool MainFrame::DoQuerySave(bool doclose) { + if (!g_gui.IsEditorOpen()) { return true; } - Editor& editor = *g_gui.GetCurrentEditor(); - if(editor.IsLiveClient()) { + Editor &editor = *g_gui.GetCurrentEditor(); + if (editor.IsLiveClient()) { long ret = g_gui.PopupDialog( "Disconnect", "Do you want to disconnect?", wxYES | wxNO ); - if(ret != wxID_YES) { + if (ret != wxID_YES) { return false; } editor.CloseLiveServer(); return DoQuerySave(doclose); - } else if(editor.IsLiveServer()) { + } else if (editor.IsLiveServer()) { long ret = g_gui.PopupDialog( "Shutdown", "Do you want to shut down the server? (any clients will be disconnected)", wxYES | wxNO ); - if(ret != wxID_YES) { + if (ret != wxID_YES) { return false; } editor.CloseLiveServer(); return DoQuerySave(doclose); - } else if(g_gui.ShouldSave()) { + } else if (g_gui.ShouldSave()) { long ret = g_gui.PopupDialog( "Save changes", "Do you want to save your changes to \"" + wxstr(g_gui.GetCurrentMap().getName()) + "\"?", wxYES | wxNO | wxCANCEL ); - if(ret == wxID_YES) { - if(g_gui.GetCurrentMap().hasFile()) { + if (ret == wxID_YES) { + if (g_gui.GetCurrentMap().hasFile()) { g_gui.SaveCurrentMap(true); } else { wxFileDialog file(this, "Save...", "", "", "*.otbm", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); int32_t result = file.ShowModal(); - if(result == wxID_OK) { + if (result == wxID_OK) { g_gui.SaveCurrentMap(file.GetPath(), true); } else { return false; } } - } else if(ret == wxID_CANCEL) { + } else if (ret == wxID_CANCEL) { return false; } } - if(doclose) { + if (doclose) { UnnamedRenderingLock(); g_gui.CloseCurrentEditor(); } @@ -552,80 +547,77 @@ bool MainFrame::DoQuerySave(bool doclose) return true; } -bool MainFrame::DoQueryImportCreatures() -{ +bool MainFrame::DoQueryImportCreatures() { // Monsters - if(g_monsters.hasMissing()) { + if (g_monsters.hasMissing()) { long ret = g_gui.PopupDialog("Missing monsters", "There are missing monsters in the editor, do you want to load them from an OT monster file?", wxYES | wxNO); - if(ret == wxID_YES) { + if (ret == wxID_YES) { do { - wxFileDialog dlg(g_gui.root, "Import monster file", "","","*.xml", wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST); - if(dlg.ShowModal() == wxID_OK) { + wxFileDialog dlg(g_gui.root, "Import monster file", "", "", "*.xml", wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST); + if (dlg.ShowModal() == wxID_OK) { wxArrayString paths; dlg.GetPaths(paths); - for(uint32_t i = 0; i < paths.GetCount(); ++i) { + for (uint32_t i = 0; i < paths.GetCount(); ++i) { wxString error; wxArrayString warnings; bool ok = g_monsters.importXMLFromOT(FileName(paths[i]), error, warnings); - if(ok) + if (ok) { g_gui.ListDialog("Monster loader errors", warnings); - else + } else { wxMessageBox("Error OT data file \"" + paths[i] + "\".\n" + error, "Error", wxOK | wxICON_INFORMATION, g_gui.root); + } } } else { break; } - } while(g_monsters.hasMissing()); + } while (g_monsters.hasMissing()); } } // Npcs - if(g_npcs.hasMissing()) { + if (g_npcs.hasMissing()) { long ret = g_gui.PopupDialog("Missing npcs", "There are missing npcs in the editor, do you want to load them from an OT npc file?", wxYES | wxNO); - if(ret == wxID_YES) { + if (ret == wxID_YES) { do { - wxFileDialog dlg(g_gui.root, "Import npc file", "","","*.xml", wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST); - if(dlg.ShowModal() == wxID_OK) { + wxFileDialog dlg(g_gui.root, "Import npc file", "", "", "*.xml", wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST); + if (dlg.ShowModal() == wxID_OK) { wxArrayString paths; dlg.GetPaths(paths); - for(uint32_t i = 0; i < paths.GetCount(); ++i) { + for (uint32_t i = 0; i < paths.GetCount(); ++i) { wxString error; wxArrayString warnings; bool ok = g_npcs.importXMLFromOT(FileName(paths[i]), error, warnings); - if(ok) + if (ok) { g_gui.ListDialog("Npc loader errors", warnings); - else + } else { wxMessageBox("Error OT data file \"" + paths[i] + "\".\n" + error, "Error", wxOK | wxICON_INFORMATION, g_gui.root); + } } } else { break; } - } while(g_npcs.hasMissing()); + } while (g_npcs.hasMissing()); } } g_gui.RefreshPalettes(); return true; } -void MainFrame::UpdateFloorMenu() -{ +void MainFrame::UpdateFloorMenu() { menu_bar->UpdateFloorMenu(); } -void MainFrame::UpdateIndicatorsMenu() -{ +void MainFrame::UpdateIndicatorsMenu() { menu_bar->UpdateIndicatorsMenu(); } -bool MainFrame::LoadMap(FileName name) -{ +bool MainFrame::LoadMap(FileName name) { return g_gui.LoadMap(name); } -void MainFrame::OnExit(wxCloseEvent& event) -{ - while(g_gui.IsEditorOpen()) { - if(!DoQuerySave()) { - if(event.CanVeto()) { +void MainFrame::OnExit(wxCloseEvent &event) { + while (g_gui.IsEditorOpen()) { + if (!DoQuerySave()) { + if (event.CanVeto()) { event.Veto(); return; } else { @@ -634,7 +626,7 @@ void MainFrame::OnExit(wxCloseEvent& event) } } g_gui.aui_manager->UnInit(); - ((Application&)wxGetApp()).Unload(); + ((Application &)wxGetApp()).Unload(); #ifdef __RELEASE__ // Hack, "crash" gracefully in release builds, let OS handle cleanup of windows exit(0); @@ -642,38 +634,32 @@ void MainFrame::OnExit(wxCloseEvent& event) Destroy(); } -void MainFrame::AddRecentFile(const FileName& file) -{ +void MainFrame::AddRecentFile(const FileName &file) { menu_bar->AddRecentFile(file); } -void MainFrame::LoadRecentFiles() -{ +void MainFrame::LoadRecentFiles() { menu_bar->LoadRecentFiles(); } -void MainFrame::SaveRecentFiles() -{ +void MainFrame::SaveRecentFiles() { menu_bar->SaveRecentFiles(); } -std::vector MainFrame::GetRecentFiles() -{ - return menu_bar->GetRecentFiles(); +std::vector MainFrame::GetRecentFiles() { + return menu_bar->GetRecentFiles(); } -void MainFrame::PrepareDC(wxDC& dc) -{ - dc.SetLogicalOrigin( 0, 0 ); - dc.SetAxisOrientation( 1, 0); - dc.SetUserScale( 1.0, 1.0 ); - dc.SetMapMode( wxMM_TEXT ); +void MainFrame::PrepareDC(wxDC &dc) { + dc.SetLogicalOrigin(0, 0); + dc.SetAxisOrientation(1, 0); + dc.SetUserScale(1.0, 1.0); + dc.SetMapMode(wxMM_TEXT); } #ifdef _MSC_VER // This is necessary for cmake with visual studio link the executable -int main(int argc, char** argv) -{ +int main(int argc, char** argv) { wxEntryStart(argc, argv); // Start the wxWidgets library Application* app = new Application(); // Create the application object wxApp::SetInstance(app); // Informs wxWidgets that app is the application object diff --git a/source/application.h b/source/application.h index e7cb2987..80910183 100644 --- a/source/application.h +++ b/source/application.h @@ -36,21 +36,20 @@ class MapWindow; class wxEventLoopBase; class wxSingleInstanceChecker; -class Application : public wxApp -{ +class Application : public wxApp { public: ~Application(); virtual bool OnInit(); - virtual void OnEventLoopEnter(wxEventLoopBase* loop); - virtual void MacOpenFiles(const wxArrayString& fileNames); + virtual void OnEventLoopEnter(wxEventLoopBase* loop); + virtual void MacOpenFiles(const wxArrayString &fileNames); virtual int OnExit(); void Unload(); private: - bool m_startup; - wxString m_file_to_open; + bool m_startup; + wxString m_file_to_open; void FixVersionDiscrapencies(); - bool ParseCommandLineMap(wxString& fileName); + bool ParseCommandLineMap(wxString &fileName); virtual void OnFatalException(); @@ -58,16 +57,13 @@ class Application : public wxApp RMEProcessServer* m_proc_server; wxSingleInstanceChecker* m_single_instance_checker; #endif - }; class MainMenuBar; -class MainFrame : public wxFrame -{ +class MainFrame : public wxFrame { public: - MainFrame(const wxString& title, - const wxPoint& pos, const wxSize& size); + MainFrame(const wxString &title, const wxPoint &pos, const wxSize &size); ~MainFrame(); void UpdateMenubar(); @@ -76,29 +72,32 @@ class MainFrame : public wxFrame bool DoQueryImportCreatures(); bool LoadMap(FileName name); - void AddRecentFile(const FileName& file); + void AddRecentFile(const FileName &file); void LoadRecentFiles(); void SaveRecentFiles(); std::vector GetRecentFiles(); - MainToolBar* GetAuiToolBar() const { return tool_bar; } + MainToolBar* GetAuiToolBar() const { + return tool_bar; + } - void OnUpdateMenus(wxCommandEvent& event); - void OnUpdateActions(wxCommandEvent& event); + void OnUpdateMenus(wxCommandEvent &event); + void OnUpdateActions(wxCommandEvent &event); void UpdateFloorMenu(); void UpdateIndicatorsMenu(); - void OnIdle(wxIdleEvent& event); - void OnExit(wxCloseEvent& event); + void OnIdle(wxIdleEvent &event); + void OnExit(wxCloseEvent &event); #ifdef _USE_UPDATER_ - void OnUpdateReceived(wxCommandEvent& event); + void OnUpdateReceived(wxCommandEvent &event); #endif #ifdef __WINDOWS__ - virtual bool MSWTranslateMessage(WXMSG *msg); + virtual bool MSWTranslateMessage(WXMSG* msg); #endif - void PrepareDC(wxDC& dc); + void PrepareDC(wxDC &dc); + protected: MainMenuBar* menu_bar; MainToolBar* tool_bar; diff --git a/source/artprovider.cpp b/source/artprovider.cpp index f9def880..4bbfcdd0 100644 --- a/source/artprovider.cpp +++ b/source/artprovider.cpp @@ -61,100 +61,101 @@ #include "../icons/mini_replace.xpm" #include "../icons/mini_change.xpm" - -wxBitmap ArtProvider::CreateBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& WXUNUSED(size)) -{ +wxBitmap ArtProvider::CreateBitmap(const wxArtID &id, const wxArtClient &client, const wxSize &WXUNUSED(size)) { if (client == wxART_TOOLBAR) { - if (id == ART_CIRCULAR) + if (id == ART_CIRCULAR) { return wxBitmap(circular_4_xpm); - else if (id == ART_CIRCULAR_1) + } else if (id == ART_CIRCULAR_1) { return wxBitmap(circular_1_xpm); - else if (id == ART_CIRCULAR_2) + } else if (id == ART_CIRCULAR_2) { return wxBitmap(circular_2_xpm); - else if (id == ART_CIRCULAR_3) + } else if (id == ART_CIRCULAR_3) { return wxBitmap(circular_3_xpm); - else if (id == ART_CIRCULAR_4) + } else if (id == ART_CIRCULAR_4) { return wxBitmap(circular_4_xpm); - else if (id == ART_CIRCULAR_5) + } else if (id == ART_CIRCULAR_5) { return wxBitmap(circular_5_xpm); - else if (id == ART_CIRCULAR_6) + } else if (id == ART_CIRCULAR_6) { return wxBitmap(circular_6_xpm); - else if (id == ART_CIRCULAR_7) + } else if (id == ART_CIRCULAR_7) { return wxBitmap(circular_7_xpm); - else if (id == ART_NOLOOUT_BRUSH) + } else if (id == ART_NOLOOUT_BRUSH) { return wxBitmap(nologout_zone_xpm); - else if (id == ART_NOPVP_BRUSH) + } else if (id == ART_NOPVP_BRUSH) { return wxBitmap(nopvp_zone_xpm); - else if (id == ART_POSITION_GO) + } else if (id == ART_POSITION_GO) { return wxBitmap(position_go_xpm); - else if (id == ART_PVP_BRUSH) + } else if (id == ART_PVP_BRUSH) { return wxBitmap(pvp_zone_xpm); - else if (id == ART_PZ_BRUSH) + } else if (id == ART_PZ_BRUSH) { return wxBitmap(protected_zone_xpm); - else if (id == ART_RECTANGULAR) + } else if (id == ART_RECTANGULAR) { return wxBitmap(rectangular_4_xpm); - else if (id == ART_RECTANGULAR_1) + } else if (id == ART_RECTANGULAR_1) { return wxBitmap(rectangular_1_xpm); - else if (id == ART_RECTANGULAR_2) + } else if (id == ART_RECTANGULAR_2) { return wxBitmap(rectangular_2_xpm); - else if (id == ART_RECTANGULAR_3) + } else if (id == ART_RECTANGULAR_3) { return wxBitmap(rectangular_3_xpm); - else if (id == ART_RECTANGULAR_4) + } else if (id == ART_RECTANGULAR_4) { return wxBitmap(rectangular_4_xpm); - else if (id == ART_RECTANGULAR_5) + } else if (id == ART_RECTANGULAR_5) { return wxBitmap(rectangular_5_xpm); - else if (id == ART_RECTANGULAR_6) + } else if (id == ART_RECTANGULAR_6) { return wxBitmap(rectangular_6_xpm); - else if (id == ART_RECTANGULAR_7) + } else if (id == ART_RECTANGULAR_7) { return wxBitmap(rectangular_7_xpm); - else if (id == ART_HOOKS_TOOLBAR) + } else if (id == ART_HOOKS_TOOLBAR) { return wxBitmap(toolbar_hooks_xpm); - else if (id == ART_PICKUPABLE_TOOLBAR) + } else if (id == ART_PICKUPABLE_TOOLBAR) { return wxBitmap(toolbar_pickupables_xpm); - else if (id == ART_MOVEABLE_TOOLBAR) + } else if (id == ART_MOVEABLE_TOOLBAR) { return wxBitmap(toolbar_moveable_xpm); - } else if(client == wxART_LIST) { - if(id == ART_MOVE) + } + } else if (client == wxART_LIST) { + if (id == ART_MOVE) { return wxBitmap(mini_move_xpm); - else if(id == ART_REMOTE) + } else if (id == ART_REMOTE) { return wxBitmap(mini_remote_xpm); - else if(id == ART_SELECT) + } else if (id == ART_SELECT) { return wxBitmap(mini_select_xpm); - else if(id == ART_UNSELECT) + } else if (id == ART_UNSELECT) { return wxBitmap(mini_unselect_xpm); - else if(id == ART_DELETE) + } else if (id == ART_DELETE) { return wxBitmap(mini_delete_xpm); - else if(id == ART_CUT) + } else if (id == ART_CUT) { return wxBitmap(mini_cut_xpm); - else if(id == ART_PASTE) + } else if (id == ART_PASTE) { return wxBitmap(mini_paste_xpm); - else if(id == ART_RANDOMIZE) + } else if (id == ART_RANDOMIZE) { return wxBitmap(mini_randomize_xpm); - else if(id == ART_BORDERIZE) + } else if (id == ART_BORDERIZE) { return wxBitmap(mini_borderize_xpm); - else if(id == ART_DRAW) + } else if (id == ART_DRAW) { return wxBitmap(mini_draw_xpm); - else if(id == ART_ERASE) + } else if (id == ART_ERASE) { return wxBitmap(mini_erase_xpm); - else if(id == ART_SWITCH) + } else if (id == ART_SWITCH) { return wxBitmap(mini_switch_xpm); - else if(id == ART_ROTATE) + } else if (id == ART_ROTATE) { return wxBitmap(mini_rotate_xpm); - else if(id == ART_REPLACE) + } else if (id == ART_REPLACE) { return wxBitmap(mini_replace_xpm); - else if(id == ART_CHANGE) + } else if (id == ART_CHANGE) { return wxBitmap(mini_change_xpm); - } else if(client == wxART_OTHER) { - if(id == ART_SPAWNS) + } + } else if (client == wxART_OTHER) { + if (id == ART_SPAWNS) { return wxBitmap(spawns_xpm); - else if (id == ART_HOUSE_EXIT) + } else if (id == ART_HOUSE_EXIT) { return wxBitmap(house_exit_xpm); - else if (id == ART_PICKUPABLE) + } else if (id == ART_PICKUPABLE) { return wxBitmap(pickupable_xpm); - else if (id == ART_MOVEABLE) + } else if (id == ART_MOVEABLE) { return wxBitmap(moveable_xpm); - else if (id == ART_PICKUPABLE_MOVEABLE) + } else if (id == ART_PICKUPABLE_MOVEABLE) { return wxBitmap(pickupable_moveable_xpm); + } } return wxNullBitmap; diff --git a/source/artprovider.h b/source/artprovider.h index f0d53903..a42d7281 100644 --- a/source/artprovider.h +++ b/source/artprovider.h @@ -68,10 +68,9 @@ #define ART_REPLACE wxART_MAKE_ART_ID(ART_REPLACE) #define ART_CHANGE wxART_MAKE_ART_ID(ART_CHANGE) -class ArtProvider : public wxArtProvider -{ +class ArtProvider : public wxArtProvider { protected: - virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size) override; + virtual wxBitmap CreateBitmap(const wxArtID &id, const wxArtClient &client, const wxSize &size) override; }; #endif // RME_ART_PROVIDER_H_ diff --git a/source/basemap.cpp b/source/basemap.cpp index 0d52bd5d..50b5e92b 100644 --- a/source/basemap.cpp +++ b/source/basemap.cpp @@ -23,76 +23,68 @@ BaseMap::BaseMap() : allocator(), tilecount(0), - root(*this) -{ + root(*this) { //// } -BaseMap::~BaseMap() -{ +BaseMap::~BaseMap() { //// } -void BaseMap::clear(bool del) -{ +void BaseMap::clear(bool del) { PositionVector pos_vec; - for(MapIterator map_iter = begin(); map_iter != end(); ++map_iter) { + for (MapIterator map_iter = begin(); map_iter != end(); ++map_iter) { Tile* t = (*map_iter)->get(); pos_vec.push_back(t->getPosition()); } - for(PositionVector::iterator pos_iter = pos_vec.begin(); pos_iter != pos_vec.end(); ++pos_iter) { + for (PositionVector::iterator pos_iter = pos_vec.begin(); pos_iter != pos_vec.end(); ++pos_iter) { setTile(*pos_iter, nullptr, del); } } -void BaseMap::clearVisible(uint32_t mask) -{ +void BaseMap::clearVisible(uint32_t mask) { root.clearVisible(mask); } -Tile* BaseMap::createTile(int x, int y, int z) -{ +Tile* BaseMap::createTile(int x, int y, int z) { ASSERT(z < rme::MapLayers); QTreeNode* leaf = root.getLeafForce(x, y); TileLocation* loc = leaf->createTile(x, y, z); - if(loc->get()) + if (loc->get()) { return loc->get(); + } Tile* t = allocator(loc); leaf->setTile(x, y, z, t); return t; } -TileLocation* BaseMap::getTileL(int x, int y, int z) -{ +TileLocation* BaseMap::getTileL(int x, int y, int z) { ASSERT(z < rme::MapLayers); QTreeNode* leaf = root.getLeaf(x, y); - if(leaf) { + if (leaf) { Floor* floor = leaf->getFloor(z); - if(floor) - return &floor->locs[(x & 3)*4 + (y & 3)]; + if (floor) { + return &floor->locs[(x & 3) * 4 + (y & 3)]; + } } return nullptr; } -const TileLocation* BaseMap::getTileL(int x, int y, int z) const -{ +const TileLocation* BaseMap::getTileL(int x, int y, int z) const { // Don't create static const maps! BaseMap* self = const_cast(this); return self->getTileL(x, y, z); } -TileLocation* BaseMap::getTileL(const Position& pos) -{ +TileLocation* BaseMap::getTileL(const Position &pos) { return getTileL(pos.x, pos.y, pos.z); } -const TileLocation* BaseMap::getTileL(const Position& pos) const -{ +const TileLocation* BaseMap::getTileL(const Position &pos) const { return getTileL(pos.x, pos.y, pos.z); } -TileLocation* BaseMap::createTileL(int x, int y, int z) -{ +TileLocation* BaseMap::createTileL(int x, int y, int z) { ASSERT(z < rme::MapLayers); QTreeNode* leaf = root.getLeafForce(x, y); @@ -100,16 +92,14 @@ TileLocation* BaseMap::createTileL(int x, int y, int z) uint32_t offsetX = x & 3; uint32_t offsetY = y & 3; - return &floor->locs[offsetX*4+offsetY]; + return &floor->locs[offsetX * 4 + offsetY]; } -TileLocation* BaseMap::createTileL(const Position& pos) -{ +TileLocation* BaseMap::createTileL(const Position &pos) { return createTileL(pos.x, pos.y, pos.z); } -void BaseMap::setTile(int x, int y, int z, Tile* new_tile, bool remove) -{ +void BaseMap::setTile(int x, int y, int z, Tile* new_tile, bool remove) { ASSERT(!new_tile || new_tile->getX() == x); ASSERT(!new_tile || new_tile->getY() == y); ASSERT(!new_tile || new_tile->getZ() == z); @@ -117,29 +107,27 @@ void BaseMap::setTile(int x, int y, int z, Tile* new_tile, bool remove) QTreeNode* leaf = root.getLeafForce(x, y); Tile* old_tile = leaf->setTile(x, y, z, new_tile); - if ((remove && old_tile) || new_tile) + if ((remove && old_tile) || new_tile) { updateUniqueIds(remove ? old_tile : nullptr, new_tile); + } if (remove) { delete old_tile; } } -void BaseMap::setTile(const Position& position, Tile* new_tile, bool remove) -{ +void BaseMap::setTile(const Position &position, Tile* new_tile, bool remove) { setTile(position.x, position.y, position.z, new_tile, remove); } -void BaseMap::setTile(Tile* new_tile, bool remove) -{ +void BaseMap::setTile(Tile* new_tile, bool remove) { ASSERT(new_tile); - const Position& position = new_tile->getPosition(); + const Position &position = new_tile->getPosition(); setTile(position.x, position.y, position.z, new_tile, remove); } -Tile* BaseMap::swapTile(int x, int y, int z, Tile* new_tile) -{ +Tile* BaseMap::swapTile(int x, int y, int z, Tile* new_tile) { ASSERT(z < rme::MapLayers); ASSERT(!new_tile || new_tile->getX() == x); ASSERT(!new_tile || new_tile->getY() == y); @@ -148,14 +136,14 @@ Tile* BaseMap::swapTile(int x, int y, int z, Tile* new_tile) QTreeNode* leaf = root.getLeafForce(x, y); Tile* old_tile = leaf->setTile(x, y, z, new_tile); - if (old_tile || new_tile) + if (old_tile || new_tile) { updateUniqueIds(old_tile, new_tile); + } return old_tile; } -Tile* BaseMap::swapTile(const Position& position, Tile* new_tile) -{ +Tile* BaseMap::swapTile(const Position &position, Tile* new_tile) { return swapTile(position.x, position.y, position.z, new_tile); } @@ -165,19 +153,16 @@ MapIterator::MapIterator(BaseMap* _map) : local_i(0), local_z(0), current_tile(nullptr), - map(_map) -{ + map(_map) { //// } -MapIterator::~MapIterator() -{ +MapIterator::~MapIterator() { //// } -MapIterator::MapIterator(const MapIterator& other) -{ - for(std::vector::const_iterator it = other.nodestack.begin(); it != other.nodestack.end(); it++) { +MapIterator::MapIterator(const MapIterator &other) { + for (std::vector::const_iterator it = other.nodestack.begin(); it != other.nodestack.end(); it++) { nodestack.push_back(MapIterator::NodeIndex(*it)); } local_i = other.local_i; @@ -186,31 +171,30 @@ MapIterator::MapIterator(const MapIterator& other) current_tile = other.current_tile; } -MapIterator BaseMap::begin() -{ +MapIterator BaseMap::begin() { MapIterator it(this); it.nodestack.push_back(MapIterator::NodeIndex(&root)); - while(true) { - MapIterator::NodeIndex& current = it.nodestack.back(); + while (true) { + MapIterator::NodeIndex ¤t = it.nodestack.back(); QTreeNode* node = current.node; - int& index = current.index; - //printf("Contemplating %p of %p (stack size %d)\n", node, this, it.nodestack.size()); + int &index = current.index; + // printf("Contemplating %p of %p (stack size %d)\n", node, this, it.nodestack.size()); bool unwind = false; - for(; index < 16; ++index) { - //printf("\tChecking index %d of %p\n", index, node); - if(QTreeNode* child = node->child[index]) { - if(child->isLeaf) { + for (; index < 16; ++index) { + // printf("\tChecking index %d of %p\n", index, node); + if (QTreeNode* child = node->child[index]) { + if (child->isLeaf) { QTreeNode* leaf = child; - //printf("\t%p is leaf\n", child); - for(it.local_z = 0; it.local_z < rme::MapLayers; ++it.local_z) { - if(Floor* floor = leaf->array[it.local_z]) { - for(it.local_i = 0; it.local_i < 16; ++it.local_i) { - //printf("\tit(%d;%d;%d)\n", it.local_x, it.local_y, it.local_z); - TileLocation& t = floor->locs[it.local_i]; - if(t.get()) { - //printf("return it\n"); + // printf("\t%p is leaf\n", child); + for (it.local_z = 0; it.local_z < rme::MapLayers; ++it.local_z) { + if (Floor* floor = leaf->array[it.local_z]) { + for (it.local_i = 0; it.local_i < 16; ++it.local_i) { + // printf("\tit(%d;%d;%d)\n", it.local_x, it.local_y, it.local_z); + TileLocation &t = floor->locs[it.local_i]; + if (t.get()) { + // printf("return it\n"); it.current_tile = &t; return it; } @@ -218,7 +202,7 @@ MapIterator BaseMap::begin() } } } else { - //printf("\tAdding %p\n", child); + // printf("\tAdding %p\n", child); ++index; it.nodestack.push_back(MapIterator::NodeIndex(child)); unwind = true; @@ -226,87 +210,86 @@ MapIterator BaseMap::begin() } } } - if(unwind) + if (unwind) { continue; + } - //printf("Discarding dead node %p\n", node); + // printf("Discarding dead node %p\n", node); it.nodestack.pop_back(); - if(it.nodestack.empty()) + if (it.nodestack.empty()) { break; + } } return end(); } -MapIterator BaseMap::end() -{ +MapIterator BaseMap::end() { MapIterator it(this); it.local_i = -1; it.local_z = -1; return it; } -TileLocation* MapIterator::operator*() -{ +TileLocation* MapIterator::operator*() { return current_tile; } -TileLocation* MapIterator::operator->() -{ +TileLocation* MapIterator::operator->() { return current_tile; } -MapIterator& MapIterator::operator++() -{ - //printf("MapIterator::operator++"); +MapIterator &MapIterator::operator++() { + // printf("MapIterator::operator++"); bool increased = false; bool first = true; - while(true) { - MapIterator::NodeIndex& current = nodestack.back(); + while (true) { + MapIterator::NodeIndex ¤t = nodestack.back(); QTreeNode* node = current.node; - int& index = current.index; - //printf("Contemplating %p (stack size %d)\n", node, nodestack.size()); + int &index = current.index; + // printf("Contemplating %p (stack size %d)\n", node, nodestack.size()); bool unwind = false; - for(; index < rme::MapLayers; ++index) { - //printf("\tChecking index %d of %p\n", index, node); - if(QTreeNode* child = node->child[index]) { - if(child->isLeaf) { + for (; index < rme::MapLayers; ++index) { + // printf("\tChecking index %d of %p\n", index, node); + if (QTreeNode* child = node->child[index]) { + if (child->isLeaf) { QTreeNode* leaf = child; - //printf("\t%p is leaf\n", child); - for(; local_z < rme::MapLayers; ++local_z) { - //printf("\t\tIterating over Z:%d of %p", local_z, child); - if(Floor* floor = leaf->array[local_z]) { - //printf("\n"); - for(; local_i < rme::MapLayers; ++local_i) { - //printf("\t\tIterating over Y:%d of %p\n", local_y, child); - TileLocation& t = floor->locs[local_i]; - if(t.get()) { - if(increased) { - //printf("Modified %p to %p\n", current_tile, t); + // printf("\t%p is leaf\n", child); + for (; local_z < rme::MapLayers; ++local_z) { + // printf("\t\tIterating over Z:%d of %p", local_z, child); + if (Floor* floor = leaf->array[local_z]) { + // printf("\n"); + for (; local_i < rme::MapLayers; ++local_i) { + // printf("\t\tIterating over Y:%d of %p\n", local_y, child); + TileLocation &t = floor->locs[local_i]; + if (t.get()) { + if (increased) { + // printf("Modified %p to %p\n", current_tile, t); current_tile = &t; return *this; } else { increased = true; } - } else if(first) { + } else if (first) { increased = true; first = false; } } - if(local_i > rme::MapMaxLayer) { - //printf("\t\tReset local_x\n"); + if (local_i > rme::MapMaxLayer) { + // printf("\t\tReset local_x\n"); local_i = 0; } } else { - //printf(":dead floor\n"); + // printf(":dead floor\n"); } - } if(local_z == rme::MapLayers) { - //printf("\t\tReset local_z\n"); - local_z = 0; + } + if (local_z == rme::MapLayers) { + // printf("\t\tReset local_z\n"); + local_z = 0; } } else { - //printf("\tAdding %p\n", child); + // printf("\tAdding %p\n", child); ++index; nodestack.push_back(MapIterator::NodeIndex(child)); unwind = true; @@ -314,14 +297,15 @@ MapIterator& MapIterator::operator++() } } } - if(unwind) + if (unwind) { continue; + } - //printf("Discarding dead node %p\n", node); + // printf("Discarding dead node %p\n", node); nodestack.pop_back(); - if(nodestack.size() == 0) { + if (nodestack.size() == 0) { // Set all values to "end" - //printf("END\n"); + // printf("END\n"); local_z = -1; local_i = -1; return *this; @@ -330,8 +314,7 @@ MapIterator& MapIterator::operator++() return *this; } -MapIterator MapIterator::operator++(int) -{ +MapIterator MapIterator::operator++(int) { MapIterator i(*this); ++*this; return i; diff --git a/source/basemap.h b/source/basemap.h index aeafb78e..fb896fd5 100644 --- a/source/basemap.h +++ b/source/basemap.h @@ -32,38 +32,48 @@ class Floor; class QTreeNode; class TileLocation; -class MapIterator -{ +class MapIterator { public: MapIterator(BaseMap* _map = nullptr); ~MapIterator(); - MapIterator(const MapIterator& other); + MapIterator(const MapIterator &other); TileLocation* operator*(); TileLocation* operator->(); - MapIterator& operator++(); + MapIterator &operator++(); MapIterator operator++(int); - bool operator==(const MapIterator& other) const { - if(other.local_z != local_z) return false; - if(other.local_i != local_i) return false; - if(other.nodestack == nodestack) return true; - if(other.current_tile == current_tile) return true; + bool operator==(const MapIterator &other) const { + if (other.local_z != local_z) { + return false; + } + if (other.local_i != local_i) { + return false; + } + if (other.nodestack == nodestack) { + return true; + } + if (other.current_tile == current_tile) { + return true; + } return false; } - bool operator!=(const MapIterator& other) const { + bool operator!=(const MapIterator &other) const { return !(other == *this); } struct NodeIndex { - NodeIndex(QTreeNode* _node) : index(0), node(_node) {} - NodeIndex(const NodeIndex& other) : index(other.index), node(other.node) {} + NodeIndex(QTreeNode* _node) : + index(0), node(_node) { } + NodeIndex(const NodeIndex &other) : + index(other.index), node(other.node) { } int index; QTreeNode* node; - bool operator==(const NodeIndex& n) const { + bool operator==(const NodeIndex &n) const { return n.node == node && n.index == index; } }; + private: std::vector nodestack; int local_i, local_z; @@ -73,8 +83,7 @@ class MapIterator friend class BaseMap; }; -class BaseMap -{ +class BaseMap { public: BaseMap(); virtual ~BaseMap(); @@ -83,37 +92,45 @@ class BaseMap void clear(bool del = true); MapIterator begin(); MapIterator end(); - uint64_t size() const noexcept { return tilecount; } + uint64_t size() const noexcept { + return tilecount; + } // these functions take a position and returns a tile on the map Tile* createTile(int x, int y, int z); Tile* getTile(int x, int y, int z); - Tile* getTile(const Position& pos); + Tile* getTile(const Position &pos); const Tile* getTile(int x, int y, int z) const; - const Tile* getTile(const Position& pos) const; + const Tile* getTile(const Position &pos) const; TileLocation* getTileL(int x, int y, int z); - TileLocation* getTileL(const Position& pos); + TileLocation* getTileL(const Position &pos); TileLocation* createTileL(int x, int y, int z); - TileLocation* createTileL(const Position& pos); + TileLocation* createTileL(const Position &pos); const TileLocation* getTileL(int x, int y, int z) const; - const TileLocation* getTileL(const Position& pos) const; + const TileLocation* getTileL(const Position &pos) const; // Get a Quad Tree Leaf from the map - QTreeNode* getLeaf(int x, int y) {return root.getLeaf(x, y);} - QTreeNode* createLeaf(int x, int y) {return root.getLeafForce(x, y);} + QTreeNode* getLeaf(int x, int y) { + return root.getLeaf(x, y); + } + QTreeNode* createLeaf(int x, int y) { + return root.getLeafForce(x, y); + } // Assigns a tile, it might seem pointless to provide position, but it is not, as the passed tile may be nullptr void setTile(int x, int y, int z, Tile* new_tile, bool remove = false); - void setTile(const Position& position, Tile* new_tile, bool remove = false); + void setTile(const Position &position, Tile* new_tile, bool remove = false); void setTile(Tile* new_tile, bool remove = false); // Replaces a tile and returns the old one Tile* swapTile(int x, int y, int z, Tile* new_tile); - Tile* swapTile(const Position& position, Tile* new_tile); + Tile* swapTile(const Position &position, Tile* new_tile); // Clears the visiblity according to the mask passed void clearVisible(uint32_t mask); - uint64_t getTileCount() const noexcept { return tilecount; } + uint64_t getTileCount() const noexcept { + return tilecount; + } public: MapAllocator allocator; @@ -128,28 +145,24 @@ class BaseMap friend class QTreeNode; }; -inline Tile* BaseMap::getTile(int x, int y, int z) -{ +inline Tile* BaseMap::getTile(int x, int y, int z) { TileLocation* l = getTileL(x, y, z); - return l? l->get() : nullptr; + return l ? l->get() : nullptr; } -inline Tile* BaseMap::getTile(const Position& pos) -{ +inline Tile* BaseMap::getTile(const Position &pos) { TileLocation* l = getTileL(pos); - return l? l->get() : nullptr; + return l ? l->get() : nullptr; } -inline const Tile* BaseMap::getTile(int x, int y, int z) const -{ +inline const Tile* BaseMap::getTile(int x, int y, int z) const { const TileLocation* l = getTileL(x, y, z); - return l? l->get() : nullptr; + return l ? l->get() : nullptr; } -inline const Tile* BaseMap::getTile(const Position& pos) const -{ +inline const Tile* BaseMap::getTile(const Position &pos) const { const TileLocation* l = getTileL(pos); - return l? l->get() : nullptr; + return l ? l->get() : nullptr; } #endif diff --git a/source/browse_tile_window.cpp b/source/browse_tile_window.cpp index 45e61618..de399fb4 100644 --- a/source/browse_tile_window.cpp +++ b/source/browse_tile_window.cpp @@ -28,13 +28,12 @@ // ============================================================================ // -class BrowseTileListBox : public wxVListBox -{ +class BrowseTileListBox : public wxVListBox { public: BrowseTileListBox(wxWindow* parent, wxWindowID id, Tile* tile); ~BrowseTileListBox(); - void OnDrawItem(wxDC& dc, const wxRect& rect, size_t index) const; + void OnDrawItem(wxDC &dc, const wxRect &rect, size_t index) const; wxCoord OnMeasureItem(size_t index) const; Item* GetSelectedItem(); void RemoveSelected(); @@ -48,31 +47,30 @@ class BrowseTileListBox : public wxVListBox }; BrowseTileListBox::BrowseTileListBox(wxWindow* parent, wxWindowID id, Tile* tile) : -wxVListBox(parent, id, wxDefaultPosition, wxSize(200, 180), wxLB_MULTIPLE), edit_tile(tile) -{ + wxVListBox(parent, id, wxDefaultPosition, wxSize(200, 180), wxLB_MULTIPLE), edit_tile(tile) { UpdateItems(); } -BrowseTileListBox::~BrowseTileListBox() -{ +BrowseTileListBox::~BrowseTileListBox() { //// } -void BrowseTileListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const -{ +void BrowseTileListBox::OnDrawItem(wxDC &dc, const wxRect &rect, size_t n) const { ItemsMap::const_iterator item_iterator = items.find(int(n)); Item* item = item_iterator->second; Sprite* sprite = g_gui.gfx.getSprite(item->getClientID()); - if(sprite) + if (sprite) { sprite->DrawTo(&dc, SPRITE_SIZE_32x32, rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight()); + } - if(IsSelected(n)) { + if (IsSelected(n)) { item->select(); - if(HasFocus()) + if (HasFocus()) { dc.SetTextForeground(wxColor(0xFF, 0xFF, 0xFF)); - else + } else { dc.SetTextForeground(wxColor(0x00, 0x00, 0xFF)); + } } else { item->deselect(); dc.SetTextForeground(wxColor(0x00, 0x00, 0x00)); @@ -83,29 +81,29 @@ void BrowseTileListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const dc.DrawText(label, rect.GetX() + 40, rect.GetY() + 6); } -wxCoord BrowseTileListBox::OnMeasureItem(size_t n) const -{ +wxCoord BrowseTileListBox::OnMeasureItem(size_t n) const { return 32; } -Item* BrowseTileListBox::GetSelectedItem() -{ - if(GetItemCount() == 0 || GetSelectedCount() == 0) +Item* BrowseTileListBox::GetSelectedItem() { + if (GetItemCount() == 0 || GetSelectedCount() == 0) { return nullptr; + } return edit_tile->getTopSelectedItem(); } -void BrowseTileListBox::RemoveSelected() -{ - if(GetItemCount() == 0 || GetSelectedCount() == 0) return; +void BrowseTileListBox::RemoveSelected() { + if (GetItemCount() == 0 || GetSelectedCount() == 0) { + return; + } Clear(); items.clear(); // Delete the items from the tile ItemVector tile_selection = edit_tile->popSelectedItems(true); - for(ItemVector::iterator iit = tile_selection.begin(); iit != tile_selection.end(); ++iit) { + for (ItemVector::iterator iit = tile_selection.begin(); iit != tile_selection.end(); ++iit) { delete *iit; } @@ -113,15 +111,14 @@ void BrowseTileListBox::RemoveSelected() Refresh(); } -void BrowseTileListBox::UpdateItems() -{ +void BrowseTileListBox::UpdateItems() { int n = 0; - for(ItemVector::reverse_iterator it = edit_tile->items.rbegin(); it != edit_tile->items.rend(); ++it) { + for (ItemVector::reverse_iterator it = edit_tile->items.rbegin(); it != edit_tile->items.rend(); ++it) { items[n] = (*it); ++n; } - if(edit_tile->ground) { + if (edit_tile->ground) { items[n] = edit_tile->ground; ++n; } @@ -133,15 +130,14 @@ void BrowseTileListBox::UpdateItems() // BEGIN_EVENT_TABLE(BrowseTileWindow, wxDialog) - EVT_BUTTON(wxID_REMOVE, BrowseTileWindow::OnClickDelete) - EVT_BUTTON(wxID_FIND, BrowseTileWindow::OnClickSelectRaw) - EVT_BUTTON(wxID_OK, BrowseTileWindow::OnClickOK) - EVT_BUTTON(wxID_CANCEL, BrowseTileWindow::OnClickCancel) +EVT_BUTTON(wxID_REMOVE, BrowseTileWindow::OnClickDelete) +EVT_BUTTON(wxID_FIND, BrowseTileWindow::OnClickSelectRaw) +EVT_BUTTON(wxID_OK, BrowseTileWindow::OnClickOK) +EVT_BUTTON(wxID_CANCEL, BrowseTileWindow::OnClickCancel) END_EVENT_TABLE() BrowseTileWindow::BrowseTileWindow(wxWindow* parent, Tile* tile, wxPoint position /* = wxDefaultPosition */) : -wxDialog(parent, wxID_ANY, "Browse Field", position, wxSize(600, 400), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER) -{ + wxDialog(parent, wxID_ANY, "Browse Field", position, wxSize(600, 400), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER) { wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); item_list = newd BrowseTileListBox(this, wxID_ANY, tile); sizer->Add(item_list, wxSizerFlags(1).Expand()); @@ -150,7 +146,7 @@ wxDialog(parent, wxID_ANY, "Browse Field", position, wxSize(600, 400), wxCAPTION pos << "x=" << tile->getX() << ", y=" << tile->getY() << ", z=" << tile->getZ(); wxSizer* infoSizer = newd wxBoxSizer(wxVERTICAL); - wxBoxSizer* buttons = newd wxBoxSizer(wxHORIZONTAL); + wxBoxSizer* buttons = newd wxBoxSizer(wxHORIZONTAL); delete_button = newd wxButton(this, wxID_REMOVE, "Delete"); delete_button->Enable(false); buttons->Add(delete_button); @@ -182,41 +178,35 @@ wxDialog(parent, wxID_ANY, "Browse Field", position, wxSize(600, 400), wxCAPTION item_list->Connect(wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler(BrowseTileWindow::OnItemSelected), NULL, this); } -BrowseTileWindow::~BrowseTileWindow() -{ +BrowseTileWindow::~BrowseTileWindow() { // Disconnect Events item_list->Disconnect(wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler(BrowseTileWindow::OnItemSelected), NULL, this); } -void BrowseTileWindow::OnItemSelected(wxCommandEvent& WXUNUSED(event)) -{ +void BrowseTileWindow::OnItemSelected(wxCommandEvent &WXUNUSED(event)) { const size_t count = item_list->GetSelectedCount(); delete_button->Enable(count != 0); select_raw_button->Enable(count == 1); } -void BrowseTileWindow::OnClickDelete(wxCommandEvent& WXUNUSED(event)) -{ +void BrowseTileWindow::OnClickDelete(wxCommandEvent &WXUNUSED(event)) { item_list->RemoveSelected(); item_count_txt->SetLabelText("Item count: " + i2ws(item_list->GetItemCount())); } -void BrowseTileWindow::OnClickSelectRaw(wxCommandEvent& WXUNUSED(event)) -{ +void BrowseTileWindow::OnClickSelectRaw(wxCommandEvent &WXUNUSED(event)) { Item* item = item_list->GetSelectedItem(); - if(item && item->getRAWBrush()) + if (item && item->getRAWBrush()) { g_gui.SelectBrush(item->getRAWBrush(), TILESET_RAW); + } EndModal(1); } -void BrowseTileWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) -{ +void BrowseTileWindow::OnClickOK(wxCommandEvent &WXUNUSED(event)) { EndModal(1); } -void BrowseTileWindow::OnClickCancel(wxCommandEvent& WXUNUSED(event)) -{ +void BrowseTileWindow::OnClickCancel(wxCommandEvent &WXUNUSED(event)) { EndModal(0); } - diff --git a/source/browse_tile_window.h b/source/browse_tile_window.h index b0e773fe..75235112 100644 --- a/source/browse_tile_window.h +++ b/source/browse_tile_window.h @@ -24,17 +24,16 @@ class BrowseTileListBox; -class BrowseTileWindow : public wxDialog -{ +class BrowseTileWindow : public wxDialog { public: BrowseTileWindow(wxWindow* parent, Tile* tile, wxPoint position = wxDefaultPosition); ~BrowseTileWindow(); - void OnItemSelected(wxCommandEvent&); - void OnClickDelete(wxCommandEvent&); - void OnClickSelectRaw(wxCommandEvent&); - void OnClickOK(wxCommandEvent&); - void OnClickCancel(wxCommandEvent&); + void OnItemSelected(wxCommandEvent &); + void OnClickDelete(wxCommandEvent &); + void OnClickSelectRaw(wxCommandEvent &); + void OnClickOK(wxCommandEvent &); + void OnClickCancel(wxCommandEvent &); protected: BrowseTileListBox* item_list; @@ -46,4 +45,3 @@ class BrowseTileWindow : public wxDialog }; #endif - diff --git a/source/brush.cpp b/source/brush.cpp index b5a26e7b..391ddbc5 100644 --- a/source/brush.cpp +++ b/source/brush.cpp @@ -48,31 +48,27 @@ Brushes g_brushes; -Brushes::Brushes() -{ +Brushes::Brushes() { //// } -Brushes::~Brushes() -{ +Brushes::~Brushes() { //// } -void Brushes::clear() -{ - for(auto brushEntry : brushes) { +void Brushes::clear() { + for (auto brushEntry : brushes) { delete brushEntry.second; } brushes.clear(); - for(auto borderEntry : borders) { + for (auto borderEntry : borders) { delete borderEntry.second; } borders.clear(); } -void Brushes::init() -{ +void Brushes::init() { addBrush(g_gui.optional_brush = newd OptionalBorderBrush()); addBrush(g_gui.eraser = newd EraserBrush()); addBrush(g_gui.spawn_brush = newd SpawnMonsterBrush()); @@ -98,39 +94,38 @@ void Brushes::init() CarpetBrush::init(); } -bool Brushes::unserializeBrush(pugi::xml_node node, wxArrayString& warnings) -{ +bool Brushes::unserializeBrush(pugi::xml_node node, wxArrayString &warnings) { pugi::xml_attribute attribute; - if(!(attribute = node.attribute("name"))) { + if (!(attribute = node.attribute("name"))) { warnings.push_back("Brush node without name."); return false; } - const std::string& brushName = attribute.as_string(); - if(brushName == "all" || brushName == "none") { + const std::string &brushName = attribute.as_string(); + if (brushName == "all" || brushName == "none") { warnings.push_back(wxString("Using reserved brushname \"") << wxstr(brushName) << "\"."); return false; } Brush* brush = getBrush(brushName); - if(!brush) { - if(!(attribute = node.attribute("type"))) { + if (!brush) { + if (!(attribute = node.attribute("type"))) { warnings.push_back("Couldn't read brush type"); return false; } const std::string brushType = attribute.as_string(); - if(brushType == "border" || brushType == "ground") { + if (brushType == "border" || brushType == "ground") { brush = newd GroundBrush(); - } else if(brushType == "wall") { + } else if (brushType == "wall") { brush = newd WallBrush(); - } else if(brushType == "wall decoration") { + } else if (brushType == "wall decoration") { brush = newd WallDecorationBrush(); - } else if(brushType == "carpet") { + } else if (brushType == "carpet") { brush = newd CarpetBrush(); - } else if(brushType == "table") { + } else if (brushType == "table") { brush = newd TableBrush(); - } else if(brushType == "doodad") { + } else if (brushType == "doodad") { brush = newd DoodadBrush(); } else { warnings.push_back(wxString("Unknown brush type ") << wxstr(brushType)); @@ -141,7 +136,7 @@ bool Brushes::unserializeBrush(pugi::xml_node node, wxArrayString& warnings) brush->setName(brushName); } - if(!node.first_child()) { + if (!node.first_child()) { brushes.insert(std::make_pair(brush->getName(), brush)); return true; } @@ -149,20 +144,20 @@ bool Brushes::unserializeBrush(pugi::xml_node node, wxArrayString& warnings) wxArrayString subWarnings; brush->load(node, subWarnings); - if(!subWarnings.empty()) { + if (!subWarnings.empty()) { warnings.push_back(wxString("Errors while loading brush \"") << wxstr(brush->getName()) << "\""); warnings.insert(warnings.end(), subWarnings.begin(), subWarnings.end()); } - if(brush->getName() == "all" || brush->getName() == "none") { + if (brush->getName() == "all" || brush->getName() == "none") { warnings.push_back(wxString("Using reserved brushname '") << wxstr(brush->getName()) << "'."); delete brush; return false; } Brush* otherBrush = getBrush(brush->getName()); - if(otherBrush) { - if(otherBrush != brush) { + if (otherBrush) { + if (otherBrush != brush) { warnings.push_back(wxString("Duplicate brush name ") << wxstr(brush->getName()) << ". Undefined behaviour may ensue."); } else { // Don't insert @@ -174,16 +169,15 @@ bool Brushes::unserializeBrush(pugi::xml_node node, wxArrayString& warnings) return true; } -bool Brushes::unserializeBorder(pugi::xml_node node, wxArrayString& warnings) -{ +bool Brushes::unserializeBorder(pugi::xml_node node, wxArrayString &warnings) { pugi::xml_attribute attribute = node.attribute("id"); - if(!attribute) { + if (!attribute) { warnings.push_back("Couldn't read border id node"); return false; } uint32_t id = attribute.as_uint(); - if(borders[id]) { + if (borders[id]) { warnings.push_back("Border ID " + std::to_string(id) + " already exists"); return false; } @@ -194,15 +188,13 @@ bool Brushes::unserializeBorder(pugi::xml_node node, wxArrayString& warnings) return true; } -void Brushes::addBrush(Brush *brush) -{ +void Brushes::addBrush(Brush* brush) { brushes.insert(std::make_pair(brush->getName(), brush)); } -Brush* Brushes::getBrush(const std::string& name) const -{ +Brush* Brushes::getBrush(const std::string &name) const { auto it = brushes.find(name); - if(it != brushes.end()) { + if (it != brushes.end()) { return it->second; } return nullptr; @@ -211,41 +203,36 @@ Brush* Brushes::getBrush(const std::string& name) const // Brush uint32_t Brush::id_counter = 0; Brush::Brush() : - id(++id_counter), visible(false) -{ + id(++id_counter), visible(false) { //// } -Brush::~Brush() -{ +Brush::~Brush() { //// } // TerrainBrush TerrainBrush::TerrainBrush() : - look_id(0), hate_friends(false) -{ + look_id(0), hate_friends(false) { //// } -TerrainBrush::~TerrainBrush() -{ +TerrainBrush::~TerrainBrush() { //// } -bool TerrainBrush::friendOf(TerrainBrush* other) -{ +bool TerrainBrush::friendOf(TerrainBrush* other) { uint32_t borderID = other->getID(); - for(uint32_t friendId : friends) { - if(friendId == borderID) { - //printf("%s is friend of %s\n", getName().c_str(), other->getName().c_str()); + for (uint32_t friendId : friends) { + if (friendId == borderID) { + // printf("%s is friend of %s\n", getName().c_str(), other->getName().c_str()); return !hate_friends; - } else if(friendId == 0xFFFFFFFF) { - //printf("%s is generic friend of %s\n", getName().c_str(), other->getName().c_str()); + } else if (friendId == 0xFFFFFFFF) { + // printf("%s is generic friend of %s\n", getName().c_str(), other->getName().c_str()); return !hate_friends; } } - //printf("%s is enemy of %s\n", getName().c_str(), other->getName().c_str()); + // printf("%s is enemy of %s\n", getName().c_str(), other->getName().c_str()); return hate_friends; } @@ -253,52 +240,54 @@ bool TerrainBrush::friendOf(TerrainBrush* other) // Flag brush // draws pz etc. -FlagBrush::FlagBrush(uint32_t _flag) : flag(_flag) -{ +FlagBrush::FlagBrush(uint32_t _flag) : + flag(_flag) { //// } -FlagBrush::~FlagBrush() -{ +FlagBrush::~FlagBrush() { //// } -std::string FlagBrush::getName() const -{ - switch(flag) { - case TILESTATE_PROTECTIONZONE: return "PZ brush (0x01)"; - case TILESTATE_NOPVP: return "No combat zone brush (0x04)"; - case TILESTATE_NOLOGOUT: return "No logout zone brush (0x08)"; - case TILESTATE_PVPZONE: return "PVP Zone brush (0x10)"; +std::string FlagBrush::getName() const { + switch (flag) { + case TILESTATE_PROTECTIONZONE: + return "PZ brush (0x01)"; + case TILESTATE_NOPVP: + return "No combat zone brush (0x04)"; + case TILESTATE_NOLOGOUT: + return "No logout zone brush (0x08)"; + case TILESTATE_PVPZONE: + return "PVP Zone brush (0x10)"; } return "Unknown flag brush"; } -int FlagBrush::getLookID() const -{ - switch(flag) { - case TILESTATE_PROTECTIONZONE: return EDITOR_SPRITE_PZ_TOOL; - case TILESTATE_NOPVP: return EDITOR_SPRITE_NOPVP_TOOL; - case TILESTATE_NOLOGOUT: return EDITOR_SPRITE_NOLOG_TOOL; - case TILESTATE_PVPZONE: return EDITOR_SPRITE_PVPZ_TOOL; +int FlagBrush::getLookID() const { + switch (flag) { + case TILESTATE_PROTECTIONZONE: + return EDITOR_SPRITE_PZ_TOOL; + case TILESTATE_NOPVP: + return EDITOR_SPRITE_NOPVP_TOOL; + case TILESTATE_NOLOGOUT: + return EDITOR_SPRITE_NOLOG_TOOL; + case TILESTATE_PVPZONE: + return EDITOR_SPRITE_PVPZ_TOOL; } return 0; } -bool FlagBrush::canDraw(BaseMap* map, const Position& position) const -{ +bool FlagBrush::canDraw(BaseMap* map, const Position &position) const { Tile* tile = map->getTile(position); return tile && tile->hasGround(); } -void FlagBrush::undraw(BaseMap* map, Tile* tile) -{ +void FlagBrush::undraw(BaseMap* map, Tile* tile) { tile->unsetMapFlags(flag); } -void FlagBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ - if(tile->hasGround()) { +void FlagBrush::draw(BaseMap* map, Tile* tile, void* parameter) { + if (tile->hasGround()) { tile->setMapFlags(flag); } } @@ -306,71 +295,85 @@ void FlagBrush::draw(BaseMap* map, Tile* tile, void* parameter) //============================================================================= // Door brush -DoorBrush::DoorBrush(DoorType _doortype) : doortype(_doortype) -{ +DoorBrush::DoorBrush(DoorType _doortype) : + doortype(_doortype) { //// } -DoorBrush::~DoorBrush() -{ +DoorBrush::~DoorBrush() { //// } -std::string DoorBrush::getName() const -{ - switch(doortype) { - case WALL_DOOR_NORMAL: return "Normal door brush"; - case WALL_DOOR_LOCKED: return "Locked door brush"; - case WALL_DOOR_MAGIC: return "Magic door brush"; - case WALL_DOOR_QUEST: return "Quest door brush"; - case WALL_WINDOW: return "Window brush"; - case WALL_HATCH_WINDOW: return "Hatch window brush"; - default: return "Unknown door brush"; +std::string DoorBrush::getName() const { + switch (doortype) { + case WALL_DOOR_NORMAL: + return "Normal door brush"; + case WALL_DOOR_LOCKED: + return "Locked door brush"; + case WALL_DOOR_MAGIC: + return "Magic door brush"; + case WALL_DOOR_QUEST: + return "Quest door brush"; + case WALL_WINDOW: + return "Window brush"; + case WALL_HATCH_WINDOW: + return "Hatch window brush"; + default: + return "Unknown door brush"; } } -int DoorBrush::getLookID() const -{ - switch(doortype) { - case WALL_DOOR_NORMAL: return EDITOR_SPRITE_DOOR_NORMAL; - case WALL_DOOR_LOCKED: return EDITOR_SPRITE_DOOR_LOCKED; - case WALL_DOOR_MAGIC: return EDITOR_SPRITE_DOOR_MAGIC; - case WALL_DOOR_QUEST: return EDITOR_SPRITE_DOOR_QUEST; - case WALL_WINDOW: return EDITOR_SPRITE_WINDOW_NORMAL; - case WALL_HATCH_WINDOW: return EDITOR_SPRITE_WINDOW_HATCH; - default: return EDITOR_SPRITE_DOOR_NORMAL; +int DoorBrush::getLookID() const { + switch (doortype) { + case WALL_DOOR_NORMAL: + return EDITOR_SPRITE_DOOR_NORMAL; + case WALL_DOOR_LOCKED: + return EDITOR_SPRITE_DOOR_LOCKED; + case WALL_DOOR_MAGIC: + return EDITOR_SPRITE_DOOR_MAGIC; + case WALL_DOOR_QUEST: + return EDITOR_SPRITE_DOOR_QUEST; + case WALL_WINDOW: + return EDITOR_SPRITE_WINDOW_NORMAL; + case WALL_HATCH_WINDOW: + return EDITOR_SPRITE_WINDOW_HATCH; + default: + return EDITOR_SPRITE_DOOR_NORMAL; } } -void DoorBrush::switchDoor(Item* item) -{ +void DoorBrush::switchDoor(Item* item) { ASSERT(item); ASSERT(item->isBrushDoor()); WallBrush* wb = item->getWallBrush(); - if(!wb) return; + if (!wb) { + return; + } bool new_open = !item->isOpen(); BorderType wall_alignment = item->getWallAlignment(); DoorType doortype = WALL_UNDEFINED; - for(std::vector::iterator iter = wb->door_items[wall_alignment].begin(); iter != wb->door_items[wall_alignment].end(); ++iter) { - WallBrush::DoorType& dt = *iter; - if(dt.id == item->getID()) { + for (std::vector::iterator iter = wb->door_items[wall_alignment].begin(); iter != wb->door_items[wall_alignment].end(); ++iter) { + WallBrush::DoorType &dt = *iter; + if (dt.id == item->getID()) { doortype = dt.type; break; } } - if(doortype == WALL_UNDEFINED) return; + if (doortype == WALL_UNDEFINED) { + return; + } - for(std::vector::iterator iter = wb->door_items[wall_alignment].begin(); iter != wb->door_items[wall_alignment].end(); ++iter) { - WallBrush::DoorType& dt = *iter; - if(dt.type == doortype) { + for (std::vector::iterator iter = wb->door_items[wall_alignment].begin(); iter != wb->door_items[wall_alignment].end(); ++iter) { + WallBrush::DoorType &dt = *iter; + if (dt.type == doortype) { ASSERT(dt.id); - const ItemType& type = g_items.getItemType(dt.id); + const ItemType &type = g_items.getItemType(dt.id); ASSERT(type.id != 0); - if(type.isOpen == new_open) { + if (type.isOpen == new_open) { item->setID(dt.id); return; } @@ -378,20 +381,19 @@ void DoorBrush::switchDoor(Item* item) } } -bool DoorBrush::canDraw(BaseMap* map, const Position& position) const -{ +bool DoorBrush::canDraw(BaseMap* map, const Position &position) const { Tile* tile = map->getTile(position); - if(!tile) { + if (!tile) { return false; } Item* item = tile->getWall(); - if(!item) { + if (!item) { return false; } WallBrush* wb = item->getWallBrush(); - if(!wb) { + if (!wb) { return false; } @@ -401,66 +403,63 @@ bool DoorBrush::canDraw(BaseMap* map, const Position& position) const bool close_match = false; bool open = false; - if(item->isBrushDoor()) { + if (item->isBrushDoor()) { open = item->isOpen(); } WallBrush* test_brush = wb; do { - for(std::vector::iterator iter = test_brush->door_items[wall_alignment].begin(); - iter != test_brush->door_items[wall_alignment].end(); - ++iter) { - WallBrush::DoorType& dt = *iter; - if(dt.type == doortype) { + for (std::vector::iterator iter = test_brush->door_items[wall_alignment].begin(); + iter != test_brush->door_items[wall_alignment].end(); + ++iter) { + WallBrush::DoorType &dt = *iter; + if (dt.type == doortype) { ASSERT(dt.id); - const ItemType& type = g_items.getItemType(dt.id); + const ItemType &type = g_items.getItemType(dt.id); ASSERT(type.id != 0); - if(type.isOpen == open) { + if (type.isOpen == open) { return true; - } else if(!close_match) { + } else if (!close_match) { discarded_id = dt.id; close_match = true; } - if(!close_match && discarded_id == 0) { + if (!close_match && discarded_id == 0) { discarded_id = dt.id; } } } test_brush = test_brush->redirect_to; - } while(test_brush != wb && test_brush != nullptr); + } while (test_brush != wb && test_brush != nullptr); // If we've found no perfect match, use a close-to perfect - if(discarded_id) { + if (discarded_id) { return true; } return false; } -void DoorBrush::undraw(BaseMap* map, Tile* tile) -{ - for(ItemVector::iterator it = tile->items.begin(); it != tile->items.end(); ++it) { +void DoorBrush::undraw(BaseMap* map, Tile* tile) { + for (ItemVector::iterator it = tile->items.begin(); it != tile->items.end(); ++it) { Item* item = *it; - if(item->isBrushDoor()) { + if (item->isBrushDoor()) { item->getWallBrush()->draw(map, tile, nullptr); - if(g_settings.getInteger(Config::USE_AUTOMAGIC)) { + if (g_settings.getInteger(Config::USE_AUTOMAGIC)) { tile->wallize(map); } return; } } - } -void DoorBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ - for(ItemVector::iterator item_iter = tile->items.begin(); item_iter != tile->items.end();) { +void DoorBrush::draw(BaseMap* map, Tile* tile, void* parameter) { + for (ItemVector::iterator item_iter = tile->items.begin(); item_iter != tile->items.end();) { Item* item = *item_iter; - if(!item->isWall()) { + if (!item->isWall()) { ++item_iter; continue; } WallBrush* wb = item->getWallBrush(); - if(!wb) { + if (!wb) { ++item_iter; continue; } @@ -472,74 +471,73 @@ void DoorBrush::draw(BaseMap* map, Tile* tile, void* parameter) bool perfect_match = false; bool open = false; - if(parameter) { + if (parameter) { open = *reinterpret_cast(parameter); } - if(item->isBrushDoor()) { + if (item->isBrushDoor()) { open = item->isOpen(); } WallBrush* test_brush = wb; do { - for(std::vector::iterator iter = test_brush->door_items[wall_alignment].begin(); - iter != test_brush->door_items[wall_alignment].end(); - ++iter) - { - WallBrush::DoorType& dt = *iter; - if(dt.type == doortype) { + for (std::vector::iterator iter = test_brush->door_items[wall_alignment].begin(); + iter != test_brush->door_items[wall_alignment].end(); + ++iter) { + WallBrush::DoorType &dt = *iter; + if (dt.type == doortype) { ASSERT(dt.id); - const ItemType& type = g_items.getItemType(dt.id); + const ItemType &type = g_items.getItemType(dt.id); ASSERT(type.id != 0); - if(type.isOpen == open) { + if (type.isOpen == open) { item = transformItem(item, dt.id, tile); perfect_match = true; break; - } else if(!close_match) { + } else if (!close_match) { discarded_id = dt.id; close_match = true; } - if(!close_match && discarded_id == 0) { + if (!close_match && discarded_id == 0) { discarded_id = dt.id; } } } test_brush = test_brush->redirect_to; - if(perfect_match) { + if (perfect_match) { break; } - } while(test_brush != wb && test_brush != nullptr); + } while (test_brush != wb && test_brush != nullptr); // If we've found no perfect match, use a close-to perfect - if(!perfect_match && discarded_id) { + if (!perfect_match && discarded_id) { item = transformItem(item, discarded_id, tile); } - if(g_settings.getInteger(Config::AUTO_ASSIGN_DOORID) && tile->isHouseTile()) { + if (g_settings.getInteger(Config::AUTO_ASSIGN_DOORID) && tile->isHouseTile()) { Map* mmap = dynamic_cast(map); Door* door = dynamic_cast(item); - if(mmap && door) { + if (mmap && door) { House* house = mmap->houses.getHouse(tile->getHouseID()); ASSERT(house); Map* real_map = dynamic_cast(map); - if(real_map) { + if (real_map) { door->setDoorID(house->getEmptyDoorID()); } } } // We need to consider decorations! - while(true) { + while (true) { // Vector has been modified, before we can use the iterator again we need to find the wall item again item_iter = tile->items.begin(); - while(true) { - if(item_iter == tile->items.end()) { + while (true) { + if (item_iter == tile->items.end()) { return; } - if(*item_iter == item) { + if (*item_iter == item) { ++item_iter; - if(item_iter == tile->items.end()) { + if (item_iter == tile->items.end()) { return; } break; @@ -549,32 +547,32 @@ void DoorBrush::draw(BaseMap* map, Tile* tile, void* parameter) // Now it points to the correct item! item = *item_iter; - if(item->isWall()) { + if (item->isWall()) { WallBrush* brush = item->getWallBrush(); - if(brush && brush->isWallDecoration()) { + if (brush && brush->isWallDecoration()) { // We got a decoration! for (std::vector::iterator it = brush->door_items[wall_alignment].begin(); it != brush->door_items[wall_alignment].end(); ++it) { - WallBrush::DoorType& dt = (*it); - if(dt.type == doortype) { + WallBrush::DoorType &dt = (*it); + if (dt.type == doortype) { ASSERT(dt.id); - const ItemType& type = g_items.getItemType(dt.id); + const ItemType &type = g_items.getItemType(dt.id); ASSERT(type.id != 0); - if(type.isOpen == open) { + if (type.isOpen == open) { item = transformItem(item, dt.id, tile); perfect_match = true; break; - } else if(!close_match) { + } else if (!close_match) { discarded_id = dt.id; close_match = true; } - if(!close_match && discarded_id == 0) { + if (!close_match && discarded_id == 0) { discarded_id = dt.id; } } } // If we've found no perfect match, use a close-to perfect - if(!perfect_match && discarded_id) { + if (!perfect_match && discarded_id) { item = transformItem(item, discarded_id, tile); } continue; @@ -590,34 +588,29 @@ void DoorBrush::draw(BaseMap* map, Tile* tile, void* parameter) //============================================================================= // Gravel brush -OptionalBorderBrush::OptionalBorderBrush() -{ +OptionalBorderBrush::OptionalBorderBrush() { //// } -OptionalBorderBrush::~OptionalBorderBrush() -{ +OptionalBorderBrush::~OptionalBorderBrush() { //// } -std::string OptionalBorderBrush::getName() const -{ +std::string OptionalBorderBrush::getName() const { return "Optional Border Tool"; } -int OptionalBorderBrush::getLookID() const -{ +int OptionalBorderBrush::getLookID() const { return EDITOR_SPRITE_OPTIONAL_BORDER_TOOL; } -bool OptionalBorderBrush::canDraw(BaseMap* map, const Position& position) const -{ +bool OptionalBorderBrush::canDraw(BaseMap* map, const Position &position) const { Tile* tile = map->getTile(position); // You can't do gravel on a mountain tile - if(tile) { - if(GroundBrush* bb = tile->getGroundBrush()) { - if(bb->hasOptionalBorder()) { + if (tile) { + if (GroundBrush* bb = tile->getGroundBrush()) { + if (bb->hasOptionalBorder()) { return false; } } @@ -628,32 +621,77 @@ bool OptionalBorderBrush::canDraw(BaseMap* map, const Position& position) const uint32_t z = position.z; tile = map->getTile(x - 1, y - 1, z); - if(tile) if(GroundBrush* bb = tile->getGroundBrush()) if(bb->hasOptionalBorder()) return true; - tile = map->getTile(x , y - 1, z); - if(tile) if(GroundBrush* bb = tile->getGroundBrush()) if(bb->hasOptionalBorder()) return true; + if (tile) { + if (GroundBrush* bb = tile->getGroundBrush()) { + if (bb->hasOptionalBorder()) { + return true; + } + } + } + tile = map->getTile(x, y - 1, z); + if (tile) { + if (GroundBrush* bb = tile->getGroundBrush()) { + if (bb->hasOptionalBorder()) { + return true; + } + } + } tile = map->getTile(x + 1, y - 1, z); - if(tile) if(GroundBrush* bb = tile->getGroundBrush()) if(bb->hasOptionalBorder()) return true; - tile = map->getTile(x - 1, y , z); - if(tile) if(GroundBrush* bb = tile->getGroundBrush()) if(bb->hasOptionalBorder()) return true; - tile = map->getTile(x + 1, y , z); - if(tile) if(GroundBrush* bb = tile->getGroundBrush()) if(bb->hasOptionalBorder()) return true; + if (tile) { + if (GroundBrush* bb = tile->getGroundBrush()) { + if (bb->hasOptionalBorder()) { + return true; + } + } + } + tile = map->getTile(x - 1, y, z); + if (tile) { + if (GroundBrush* bb = tile->getGroundBrush()) { + if (bb->hasOptionalBorder()) { + return true; + } + } + } + tile = map->getTile(x + 1, y, z); + if (tile) { + if (GroundBrush* bb = tile->getGroundBrush()) { + if (bb->hasOptionalBorder()) { + return true; + } + } + } tile = map->getTile(x - 1, y + 1, z); - if(tile) if(GroundBrush* bb = tile->getGroundBrush()) if(bb->hasOptionalBorder()) return true; - tile = map->getTile(x , y + 1, z); - if(tile) if(GroundBrush* bb = tile->getGroundBrush()) if(bb->hasOptionalBorder()) return true; + if (tile) { + if (GroundBrush* bb = tile->getGroundBrush()) { + if (bb->hasOptionalBorder()) { + return true; + } + } + } + tile = map->getTile(x, y + 1, z); + if (tile) { + if (GroundBrush* bb = tile->getGroundBrush()) { + if (bb->hasOptionalBorder()) { + return true; + } + } + } tile = map->getTile(x + 1, y + 1, z); - if(tile) if(GroundBrush* bb = tile->getGroundBrush()) if(bb->hasOptionalBorder()) return true; + if (tile) { + if (GroundBrush* bb = tile->getGroundBrush()) { + if (bb->hasOptionalBorder()) { + return true; + } + } + } return false; } -void OptionalBorderBrush::undraw(BaseMap* map, Tile* tile) -{ +void OptionalBorderBrush::undraw(BaseMap* map, Tile* tile) { tile->setOptionalBorder(false); // The bordering algorithm will handle this automagicaly } -void OptionalBorderBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void OptionalBorderBrush::draw(BaseMap* map, Tile* tile, void* parameter) { tile->setOptionalBorder(true); // The bordering algorithm will handle this automagicaly } - diff --git a/source/brush.h b/source/brush.h index ad52397e..b58454b4 100644 --- a/source/brush.h +++ b/source/brush.h @@ -60,8 +60,7 @@ class EraserBrush; typedef std::multimap BrushMap; -class Brushes -{ +class Brushes { public: Brushes(); ~Brushes(); @@ -69,14 +68,16 @@ class Brushes void init(); void clear(); - Brush* getBrush(const std::string& name) const; + Brush* getBrush(const std::string &name) const; void addBrush(Brush* brush); - bool unserializeBorder(pugi::xml_node node, wxArrayString& warnings); - bool unserializeBrush(pugi::xml_node node, wxArrayString& warnings); + bool unserializeBorder(pugi::xml_node node, wxArrayString &warnings); + bool unserializeBrush(pugi::xml_node node, wxArrayString &warnings); - const BrushMap& getMap() const noexcept { return brushes; } + const BrushMap &getMap() const noexcept { + return brushes; + } protected: typedef std::map BorderMap; @@ -92,81 +93,172 @@ extern Brushes g_brushes; //============================================================================= // Common brush interface -class Brush -{ +class Brush { public: Brush(); virtual ~Brush(); - virtual bool load(pugi::xml_node node, wxArrayString& warnings) { + virtual bool load(pugi::xml_node node, wxArrayString &warnings) { return true; } virtual void draw(BaseMap* map, Tile* tile, void* parameter = nullptr) = 0; virtual void undraw(BaseMap* map, Tile* tile) = 0; - virtual bool canDraw(BaseMap* map, const Position& position) const = 0; + virtual bool canDraw(BaseMap* map, const Position &position) const = 0; // - uint32_t getID() const noexcept { return id; } + uint32_t getID() const noexcept { + return id; + } virtual std::string getName() const = 0; - virtual void setName(const std::string& newName) { + virtual void setName(const std::string &newName) { ASSERT(_MSG("setName attempted on nameless brush!")); } virtual int getLookID() const = 0; - virtual bool needBorders() const { return false; } - - virtual bool canDrag() const { return false; } - virtual bool canSmear() const { return true; } - - virtual bool oneSizeFitsAll() const { return false; } - - virtual int32_t getMaxVariation() const { return 0; } - - virtual bool isRaw() const { return false; } - virtual bool isDoodad() const { return false; } - virtual bool isTerrain() const { return false; } - virtual bool isGround() const { return false; } - virtual bool isWall() const { return false; } - virtual bool isWallDecoration() const { return false; } - virtual bool isTable() const { return false; } - virtual bool isCarpet() const { return false; } - virtual bool isDoor() const { return false; } - virtual bool isOptionalBorder() const { return false; } - virtual bool isMonster() const { return false; } - virtual bool isSpawnMonster() const { return false; } - virtual bool isNpc() const { return false; } - virtual bool isSpawnNpc() const { return false; } - virtual bool isHouse() const { return false; } - virtual bool isHouseExit() const { return false; } - virtual bool isWaypoint() const { return false; } - virtual bool isFlag() const { return false; } - virtual bool isEraser() const { return false; } - - virtual RAWBrush* asRaw() { return nullptr; } - virtual DoodadBrush* asDoodad() { return nullptr; } - virtual TerrainBrush* asTerrain() { return nullptr; } - virtual GroundBrush* asGround() { return nullptr; } - virtual WallBrush* asWall() { return nullptr; } - virtual WallDecorationBrush* asWallDecoration() { return nullptr; } - virtual TableBrush* asTable() { return nullptr; } - virtual CarpetBrush* asCarpet() { return nullptr; } - virtual DoorBrush* asDoor() { return nullptr; } - virtual OptionalBorderBrush* asOptionalBorder() { return nullptr; } - virtual MonsterBrush* asMonster() { return nullptr; } - virtual SpawnMonsterBrush* asSpawnMonster() { return nullptr; } - virtual NpcBrush* asNpc() { return nullptr; } - virtual SpawnNpcBrush* asSpawnNpc() { return nullptr; } - virtual HouseBrush* asHouse() { return nullptr; } - virtual HouseExitBrush* asHouseExit() { return nullptr; } - virtual WaypointBrush* asWaypoint() { return nullptr; } - virtual FlagBrush* asFlag() { return nullptr; } - virtual EraserBrush* asEraser() { return nullptr; } - - bool visibleInPalette() const { return visible; } - void flagAsVisible() { visible = true; } + virtual bool needBorders() const { + return false; + } + + virtual bool canDrag() const { + return false; + } + virtual bool canSmear() const { + return true; + } + + virtual bool oneSizeFitsAll() const { + return false; + } + + virtual int32_t getMaxVariation() const { + return 0; + } + + virtual bool isRaw() const { + return false; + } + virtual bool isDoodad() const { + return false; + } + virtual bool isTerrain() const { + return false; + } + virtual bool isGround() const { + return false; + } + virtual bool isWall() const { + return false; + } + virtual bool isWallDecoration() const { + return false; + } + virtual bool isTable() const { + return false; + } + virtual bool isCarpet() const { + return false; + } + virtual bool isDoor() const { + return false; + } + virtual bool isOptionalBorder() const { + return false; + } + virtual bool isMonster() const { + return false; + } + virtual bool isSpawnMonster() const { + return false; + } + virtual bool isNpc() const { + return false; + } + virtual bool isSpawnNpc() const { + return false; + } + virtual bool isHouse() const { + return false; + } + virtual bool isHouseExit() const { + return false; + } + virtual bool isWaypoint() const { + return false; + } + virtual bool isFlag() const { + return false; + } + virtual bool isEraser() const { + return false; + } + + virtual RAWBrush* asRaw() { + return nullptr; + } + virtual DoodadBrush* asDoodad() { + return nullptr; + } + virtual TerrainBrush* asTerrain() { + return nullptr; + } + virtual GroundBrush* asGround() { + return nullptr; + } + virtual WallBrush* asWall() { + return nullptr; + } + virtual WallDecorationBrush* asWallDecoration() { + return nullptr; + } + virtual TableBrush* asTable() { + return nullptr; + } + virtual CarpetBrush* asCarpet() { + return nullptr; + } + virtual DoorBrush* asDoor() { + return nullptr; + } + virtual OptionalBorderBrush* asOptionalBorder() { + return nullptr; + } + virtual MonsterBrush* asMonster() { + return nullptr; + } + virtual SpawnMonsterBrush* asSpawnMonster() { + return nullptr; + } + virtual NpcBrush* asNpc() { + return nullptr; + } + virtual SpawnNpcBrush* asSpawnNpc() { + return nullptr; + } + virtual HouseBrush* asHouse() { + return nullptr; + } + virtual HouseExitBrush* asHouseExit() { + return nullptr; + } + virtual WaypointBrush* asWaypoint() { + return nullptr; + } + virtual FlagBrush* asFlag() { + return nullptr; + } + virtual EraserBrush* asEraser() { + return nullptr; + } + + bool visibleInPalette() const { + return visible; + } + void flagAsVisible() { + visible = true; + } protected: static uint32_t id_counter; @@ -177,25 +269,42 @@ class Brush //============================================================================= // Terrain brush interface -class TerrainBrush : public Brush -{ +class TerrainBrush : public Brush { public: TerrainBrush(); virtual ~TerrainBrush(); - bool isTerrain() const { return true; } - TerrainBrush* asTerrain() { return static_cast(this); } + bool isTerrain() const { + return true; + } + TerrainBrush* asTerrain() { + return static_cast(this); + } - virtual bool canDraw(BaseMap* map, const Position& position) const { return true; } + virtual bool canDraw(BaseMap* map, const Position &position) const { + return true; + } - virtual std::string getName() const { return name; } - virtual void setName(const std::string& newName) { name = newName; } + virtual std::string getName() const { + return name; + } + virtual void setName(const std::string &newName) { + name = newName; + } - virtual int32_t getZ() const { return 0; } - virtual int32_t getLookID() const { return look_id; } + virtual int32_t getZ() const { + return 0; + } + virtual int32_t getLookID() const { + return look_id; + } - virtual bool needBorders() const { return true; } - virtual bool canDrag() const { return true; } + virtual bool needBorders() const { + return true; + } + virtual bool canDrag() const { + return true; + } bool friendOf(TerrainBrush* other); @@ -209,20 +318,25 @@ class TerrainBrush : public Brush //============================================================================= // FlagBrush, draw PZ etc. -class FlagBrush : public Brush -{ +class FlagBrush : public Brush { public: FlagBrush(uint32_t _flag); virtual ~FlagBrush(); - bool isFlag() const { return true; } - FlagBrush* asFlag() { return static_cast(this); } + bool isFlag() const { + return true; + } + FlagBrush* asFlag() { + return static_cast(this); + } - virtual bool canDraw(BaseMap* map, const Position& position) const; + virtual bool canDraw(BaseMap* map, const Position &position) const; virtual void draw(BaseMap* map, Tile* tile, void* parameter); virtual void undraw(BaseMap* map, Tile* tile); - virtual bool canDrag() const {return true;} + virtual bool canDrag() const { + return true; + } virtual int getLookID() const; virtual std::string getName() const; @@ -233,24 +347,29 @@ class FlagBrush : public Brush //============================================================================= // Doorbrush, add doors, windows etc. -class DoorBrush : public Brush -{ +class DoorBrush : public Brush { public: DoorBrush(DoorType _doortype); virtual ~DoorBrush(); - bool isDoor() const { return true; } - DoorBrush* asDoor() { return static_cast(this); } + bool isDoor() const { + return true; + } + DoorBrush* asDoor() { + return static_cast(this); + } static void switchDoor(Item* door); - virtual bool canDraw(BaseMap* map, const Position& position) const; + virtual bool canDraw(BaseMap* map, const Position &position) const; virtual void draw(BaseMap* map, Tile* tile, void* parameter); virtual void undraw(BaseMap* map, Tile* tile); virtual int getLookID() const; virtual std::string getName() const; - virtual bool oneSizeFitsAll() const { return true; } + virtual bool oneSizeFitsAll() const { + return true; + } protected: DoorType doortype; @@ -259,20 +378,25 @@ class DoorBrush : public Brush //============================================================================= // OptionalBorderBrush, add gravel 'round mountains. -class OptionalBorderBrush : public Brush -{ +class OptionalBorderBrush : public Brush { public: OptionalBorderBrush(); virtual ~OptionalBorderBrush(); - bool isOptionalBorder() const { return true; } - OptionalBorderBrush* asOptionalBorder() { return static_cast(this); } + bool isOptionalBorder() const { + return true; + } + OptionalBorderBrush* asOptionalBorder() { + return static_cast(this); + } - virtual bool canDraw(BaseMap* map, const Position& position) const; + virtual bool canDraw(BaseMap* map, const Position &position) const; virtual void draw(BaseMap* map, Tile* tile, void* parameter); virtual void undraw(BaseMap* map, Tile* tile); - virtual bool canDrag() const { return true; } + virtual bool canDrag() const { + return true; + } virtual int getLookID() const; virtual std::string getName() const; }; @@ -280,21 +404,28 @@ class OptionalBorderBrush : public Brush //============================================================================= // Rampbrush, add ramps to mountains. -class EraserBrush : public Brush -{ +class EraserBrush : public Brush { public: EraserBrush(); virtual ~EraserBrush(); - bool isEraser() const { return true; } - EraserBrush* asEraser() { return static_cast(this); } + bool isEraser() const { + return true; + } + EraserBrush* asEraser() { + return static_cast(this); + } - virtual bool canDraw(BaseMap* map, const Position& position) const; + virtual bool canDraw(BaseMap* map, const Position &position) const; virtual void draw(BaseMap* map, Tile* tile, void* parameter); virtual void undraw(BaseMap* map, Tile* tile); - virtual bool needBorders() const { return true; } - virtual bool canDrag() const { return true; } + virtual bool needBorders() const { + return true; + } + virtual bool canDrag() const { + return true; + } virtual int getLookID() const; virtual std::string getName() const; }; @@ -302,16 +433,18 @@ class EraserBrush : public Brush //============================================================================= // Autoborder, used by GroundBrush, should be transparent to users -class AutoBorder -{ +class AutoBorder { public: - AutoBorder(int _id) : id(_id), group(0), ground(false) { - for(int i = 0; i < 13; i++) tiles[i] = 0; + AutoBorder(int _id) : + id(_id), group(0), ground(false) { + for (int i = 0; i < 13; i++) { + tiles[i] = 0; + } } - ~AutoBorder() {} + ~AutoBorder() { } - static int edgeNameToID(const std::string& edgename); - bool load(pugi::xml_node node, wxArrayString& warnings, GroundBrush* owner = nullptr, uint16_t ground_equivalent = 0); + static int edgeNameToID(const std::string &edgename); + bool load(pugi::xml_node node, wxArrayString &warnings, GroundBrush* owner = nullptr, uint16_t ground_equivalent = 0); uint32_t tiles[13]; uint32_t id; @@ -320,4 +453,3 @@ class AutoBorder }; #endif - diff --git a/source/brush_enums.h b/source/brush_enums.h index 086c45bd..bc7742e4 100644 --- a/source/brush_enums.h +++ b/source/brush_enums.h @@ -64,7 +64,7 @@ enum BorderType { }; enum TileAlignement { - TILE_NORTHWEST =1, + TILE_NORTHWEST = 1, TILE_NORTH = 2, TILE_NORTHEAST = 4, TILE_WEST = 8, diff --git a/source/brush_tables.cpp b/source/brush_tables.cpp index 3f3d315a..80a20c1c 100644 --- a/source/brush_tables.cpp +++ b/source/brush_tables.cpp @@ -25,13 +25,12 @@ //============================================================================= // Border lookup tables -void GroundBrush::init() -{ +void GroundBrush::init() { GroundBrush::border_types[0] // 0 = BORDER_NONE; GroundBrush::border_types[TILE_NORTHWEST] // 1 = NORTHWEST_CORNER; - GroundBrush::border_types[TILE_NORTH] //10 + GroundBrush::border_types[TILE_NORTH] // 10 = NORTH_HORIZONTAL; GroundBrush::border_types[TILE_NORTH | TILE_NORTHWEST] // 11 = NORTH_HORIZONTAL; @@ -75,12 +74,12 @@ void GroundBrush::init() = NORTHEAST_DIAGONAL; GroundBrush::border_types[TILE_EAST | TILE_NORTHEAST | TILE_NORTH | TILE_NORTHWEST] // 10111 = NORTHEAST_DIAGONAL; - GroundBrush::border_types[TILE_EAST | TILE_WEST] //11000 + GroundBrush::border_types[TILE_EAST | TILE_WEST] // 11000 = WEST_HORIZONTAL | EAST_HORIZONTAL << 8; GroundBrush::border_types[TILE_EAST | TILE_WEST | TILE_NORTHWEST] // 11001 = WEST_HORIZONTAL | EAST_HORIZONTAL << 8; GroundBrush::border_types[TILE_EAST | TILE_WEST | TILE_NORTH] // 11010 - = NORTH_HORIZONTAL | WEST_HORIZONTAL << 8 | EAST_HORIZONTAL << 16; + = NORTH_HORIZONTAL | WEST_HORIZONTAL << 8 | EAST_HORIZONTAL << 16; GroundBrush::border_types[TILE_EAST | TILE_WEST | TILE_NORTH | TILE_NORTHWEST] // 11011 = NORTH_HORIZONTAL | WEST_HORIZONTAL << 8 | EAST_HORIZONTAL << 16; GroundBrush::border_types[TILE_EAST | TILE_WEST | TILE_NORTHEAST] // 11100 @@ -288,7 +287,7 @@ void GroundBrush::init() = SOUTHEAST_CORNER; GroundBrush::border_types[TILE_SOUTHEAST | TILE_NORTHWEST] // 1 = NORTHWEST_CORNER | SOUTHEAST_CORNER << 8; - GroundBrush::border_types[TILE_SOUTHEAST | TILE_NORTH] //10 + GroundBrush::border_types[TILE_SOUTHEAST | TILE_NORTH] // 10 = NORTH_HORIZONTAL | SOUTHEAST_CORNER << 8; GroundBrush::border_types[TILE_SOUTHEAST | TILE_NORTH | TILE_NORTHWEST] // 11 = NORTH_HORIZONTAL | SOUTHEAST_CORNER << 8; @@ -332,7 +331,7 @@ void GroundBrush::init() = NORTHEAST_DIAGONAL; GroundBrush::border_types[TILE_SOUTHEAST | TILE_EAST | TILE_NORTHEAST | TILE_NORTH | TILE_NORTHWEST] // 10111 = NORTHEAST_DIAGONAL; - GroundBrush::border_types[TILE_SOUTHEAST | TILE_EAST | TILE_WEST] //11000 + GroundBrush::border_types[TILE_SOUTHEAST | TILE_EAST | TILE_WEST] // 11000 = EAST_HORIZONTAL | WEST_HORIZONTAL << 8; GroundBrush::border_types[TILE_SOUTHEAST | TILE_EAST | TILE_WEST | TILE_NORTHWEST] // 11001 = EAST_HORIZONTAL | WEST_HORIZONTAL << 8; @@ -615,7 +614,7 @@ void TableBrush::init() { = TABLE_ALONE; TableBrush::table_types[TILE_NORTHWEST] // 1 = TABLE_ALONE; - TableBrush::table_types[TILE_NORTH] //10 + TableBrush::table_types[TILE_NORTH] // 10 = TABLE_SOUTH_END; TableBrush::table_types[TILE_NORTH | TILE_NORTHWEST] // 11 = TABLE_ALONE; @@ -659,7 +658,7 @@ void TableBrush::init() { = TABLE_WEST_END; TableBrush::table_types[TILE_EAST | TILE_NORTHEAST | TILE_NORTH | TILE_NORTHWEST] // 10111 = TABLE_WEST_END; - TableBrush::table_types[TILE_EAST | TILE_WEST] //11000 + TableBrush::table_types[TILE_EAST | TILE_WEST] // 11000 = TABLE_HORIZONTAL; TableBrush::table_types[TILE_EAST | TILE_WEST | TILE_NORTHWEST] // 11001 = TABLE_HORIZONTAL; @@ -872,7 +871,7 @@ void TableBrush::init() { = TABLE_ALONE; TableBrush::table_types[TILE_SOUTHEAST | TILE_NORTHWEST] // 1 = TABLE_ALONE; - TableBrush::table_types[TILE_SOUTHEAST | TILE_NORTH] //10 + TableBrush::table_types[TILE_SOUTHEAST | TILE_NORTH] // 10 = TABLE_SOUTH_END; TableBrush::table_types[TILE_SOUTHEAST | TILE_NORTH | TILE_NORTHWEST] // 11 = TABLE_ALONE; @@ -916,7 +915,7 @@ void TableBrush::init() { = TABLE_WEST_END; TableBrush::table_types[TILE_SOUTHEAST | TILE_EAST | TILE_NORTHEAST | TILE_NORTH | TILE_NORTHWEST] // 10111 = TABLE_WEST_END; - TableBrush::table_types[TILE_SOUTHEAST | TILE_EAST | TILE_WEST] //11000 + TableBrush::table_types[TILE_SOUTHEAST | TILE_EAST | TILE_WEST] // 11000 = TABLE_HORIZONTAL; TableBrush::table_types[TILE_SOUTHEAST | TILE_EAST | TILE_WEST | TILE_NORTHWEST] // 11001 = TABLE_HORIZONTAL; @@ -1131,7 +1130,7 @@ void CarpetBrush::init() { = CARPET_CENTER; CarpetBrush::carpet_types[TILE_NORTHWEST] // 1 = CARPET_CENTER; - CarpetBrush::carpet_types[TILE_NORTH] //10 + CarpetBrush::carpet_types[TILE_NORTH] // 10 = CARPET_CENTER; CarpetBrush::carpet_types[TILE_NORTH | TILE_NORTHWEST] // 11 = NORTHWEST_CORNER; @@ -1175,7 +1174,7 @@ void CarpetBrush::init() { = NORTHEAST_CORNER; CarpetBrush::carpet_types[TILE_EAST | TILE_NORTHEAST | TILE_NORTH | TILE_NORTHWEST] // 10111 = NORTHEAST_CORNER; - CarpetBrush::carpet_types[TILE_EAST | TILE_WEST] //11000 + CarpetBrush::carpet_types[TILE_EAST | TILE_WEST] // 11000 = CARPET_CENTER; CarpetBrush::carpet_types[TILE_EAST | TILE_WEST | TILE_NORTHWEST] // 11001 = NORTH_HORIZONTAL; @@ -1266,7 +1265,8 @@ void CarpetBrush::init() { CarpetBrush::carpet_types[TILE_SOUTH | TILE_NORTHEAST] // 1000100 = NORTHEAST_CORNER; CarpetBrush::carpet_types[TILE_SOUTH | TILE_NORTHEAST | TILE_NORTHWEST] // 1000101 - = NORTH_HORIZONTAL;; + = NORTH_HORIZONTAL; + ; CarpetBrush::carpet_types[TILE_SOUTH | TILE_NORTHEAST | TILE_NORTH] // 1000110 = NORTHEAST_CORNER; CarpetBrush::carpet_types[TILE_SOUTH | TILE_NORTHEAST | TILE_NORTH | TILE_NORTHWEST] // 1000111 @@ -1388,7 +1388,7 @@ void CarpetBrush::init() { = SOUTHEAST_CORNER; CarpetBrush::carpet_types[TILE_SOUTHEAST | TILE_NORTHWEST] // 1 = NORTHWEST_CORNER; - CarpetBrush::carpet_types[TILE_SOUTHEAST | TILE_NORTH] //10 + CarpetBrush::carpet_types[TILE_SOUTHEAST | TILE_NORTH] // 10 = SOUTHEAST_CORNER; CarpetBrush::carpet_types[TILE_SOUTHEAST | TILE_NORTH | TILE_NORTHWEST] // 11 = NORTHWEST_CORNER; @@ -1432,7 +1432,7 @@ void CarpetBrush::init() { = NORTHEAST_CORNER; CarpetBrush::carpet_types[TILE_SOUTHEAST | TILE_EAST | TILE_NORTHEAST | TILE_NORTH | TILE_NORTHWEST] // 10111 = NORTHEAST_CORNER; - CarpetBrush::carpet_types[TILE_SOUTHEAST | TILE_EAST | TILE_WEST] //11000 + CarpetBrush::carpet_types[TILE_SOUTHEAST | TILE_EAST | TILE_WEST] // 11000 = SOUTH_HORIZONTAL; CarpetBrush::carpet_types[TILE_SOUTHEAST | TILE_EAST | TILE_WEST | TILE_NORTHWEST] // 11001 = SOUTH_HORIZONTAL; @@ -1641,4 +1641,3 @@ void CarpetBrush::init() { CarpetBrush::carpet_types[TILE_SOUTHEAST | TILE_SOUTH | TILE_SOUTHWEST | TILE_EAST | TILE_WEST | TILE_NORTHEAST | TILE_NORTH | TILE_NORTHWEST] // 1111111 = CARPET_CENTER; } - diff --git a/source/carpet_brush.cpp b/source/carpet_brush.cpp index 19f15418..70acab85 100644 --- a/source/carpet_brush.cpp +++ b/source/carpet_brush.cpp @@ -28,38 +28,35 @@ uint32_t CarpetBrush::carpet_types[256]; CarpetBrush::CarpetBrush() : - look_id(0) -{ + look_id(0) { //// } -CarpetBrush::~CarpetBrush() -{ +CarpetBrush::~CarpetBrush() { //// } -bool CarpetBrush::load(pugi::xml_node node, wxArrayString& warnings) -{ +bool CarpetBrush::load(pugi::xml_node node, wxArrayString &warnings) { pugi::xml_attribute attribute; - if((attribute = node.attribute("lookid"))) { + if ((attribute = node.attribute("lookid"))) { look_id = attribute.as_uint(); } - if((attribute = node.attribute("server_lookid"))) { + if ((attribute = node.attribute("server_lookid"))) { look_id = g_items.getItemType(attribute.as_uint()).clientID; } - for(pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { - if(as_lower_str(childNode.name()) != "carpet") { + for (pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { + if (as_lower_str(childNode.name()) != "carpet") { continue; } uint32_t alignment; - if((attribute = childNode.attribute("align"))) { - const std::string& alignString = attribute.as_string(); + if ((attribute = childNode.attribute("align"))) { + const std::string &alignString = attribute.as_string(); alignment = AutoBorder::edgeNameToID(alignString); - if(alignment == BORDER_NONE) { - if(alignString == "center") { + if (alignment == BORDER_NONE) { + if (alignString == "center") { alignment = CARPET_CENTER; } else { warnings.push_back("Invalid alignment of carpet node\n"); @@ -72,19 +69,19 @@ bool CarpetBrush::load(pugi::xml_node node, wxArrayString& warnings) } bool use_local_id = true; - for(pugi::xml_node subChildNode = childNode.first_child(); subChildNode; subChildNode = subChildNode.next_sibling()) { - if(as_lower_str(subChildNode.name()) != "item") { + for (pugi::xml_node subChildNode = childNode.first_child(); subChildNode; subChildNode = subChildNode.next_sibling()) { + if (as_lower_str(subChildNode.name()) != "item") { continue; } use_local_id = false; - if(!(attribute = subChildNode.attribute("id"))) { + if (!(attribute = subChildNode.attribute("id"))) { warnings.push_back("Could not read id tag of item node\n"); continue; } int32_t id = attribute.as_int(); - if(!(attribute = subChildNode.attribute("chance"))) { + if (!(attribute = subChildNode.attribute("chance"))) { warnings.push_back("Could not read chance tag of item node\n"); continue; } @@ -92,10 +89,10 @@ bool CarpetBrush::load(pugi::xml_node node, wxArrayString& warnings) int32_t chance = attribute.as_int(); ItemType* type = g_items.getRawItemType(id); - if(!type) { + if (!type) { warnings.push_back("There is no itemtype with id " + std::to_string(id)); continue; - } else if(type->brush && type->brush != this) { + } else if (type->brush && type->brush != this) { warnings.push_back("Itemtype id " + std::to_string(id) + " already has a brush"); continue; } @@ -103,7 +100,7 @@ bool CarpetBrush::load(pugi::xml_node node, wxArrayString& warnings) type->isCarpet = true; type->brush = this; - auto& alignItem = carpet_items[alignment]; + auto &alignItem = carpet_items[alignment]; alignItem.total_chance += chance; CarpetType t; @@ -113,18 +110,18 @@ bool CarpetBrush::load(pugi::xml_node node, wxArrayString& warnings) alignItem.items.push_back(t); } - if(use_local_id) { - if(!(attribute = childNode.attribute("id"))) { + if (use_local_id) { + if (!(attribute = childNode.attribute("id"))) { warnings.push_back("Could not read id tag of carpet node\n"); continue; } uint16_t id = attribute.as_uint(); ItemType* type = g_items.getRawItemType(id); - if(!type) { + if (!type) { warnings.push_back("There is no itemtype with id " + std::to_string(id)); return false; - } else if(type->brush && type->brush != this) { + } else if (type->brush && type->brush != this) { warnings.push_back("Itemtype id " + std::to_string(id) + " already has a brush"); return false; } @@ -132,7 +129,7 @@ bool CarpetBrush::load(pugi::xml_node node, wxArrayString& warnings) type->isCarpet = true; type->brush = this; - auto& alignItem = carpet_items[alignment]; + auto &alignItem = carpet_items[alignment]; alignItem.total_chance = 1; CarpetType carpetType; @@ -145,25 +142,22 @@ bool CarpetBrush::load(pugi::xml_node node, wxArrayString& warnings) return true; } -bool CarpetBrush::canDraw(BaseMap* map, const Position& position) const -{ +bool CarpetBrush::canDraw(BaseMap* map, const Position &position) const { return true; } -void CarpetBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void CarpetBrush::draw(BaseMap* map, Tile* tile, void* parameter) { undraw(map, tile); // Remove old tile->addItem(Item::Create(getRandomCarpet(CARPET_CENTER))); } -void CarpetBrush::undraw(BaseMap* map, Tile* tile) -{ - auto& items = tile->items; - for(auto it = items.begin(); it != items.end(); ) { +void CarpetBrush::undraw(BaseMap* map, Tile* tile) { + auto &items = tile->items; + for (auto it = items.begin(); it != items.end();) { Item* item = *it; - if(item->isCarpet()) { + if (item->isCarpet()) { CarpetBrush* carpetBrush = item->getCarpetBrush(); - if(carpetBrush) { + if (carpetBrush) { delete item; it = items.erase(it); } else { @@ -175,16 +169,15 @@ void CarpetBrush::undraw(BaseMap* map, Tile* tile) } } -void CarpetBrush::doCarpets(BaseMap* map, Tile* tile) -{ +void CarpetBrush::doCarpets(BaseMap* map, Tile* tile) { static const auto hasMatchingCarpetBrushAtTile = [](BaseMap* map, CarpetBrush* carpetBrush, uint32_t x, uint32_t y, uint32_t z) -> bool { Tile* tile = map->getTile(x, y, z); - if(!tile) { + if (!tile) { return false; } - for(Item* item : tile->items) { - if(item->getCarpetBrush() == carpetBrush) { + for (Item* item : tile->items) { + if (item->getCarpetBrush() == carpetBrush) { return true; } } @@ -192,11 +185,11 @@ void CarpetBrush::doCarpets(BaseMap* map, Tile* tile) }; ASSERT(tile); - if(!tile->hasCarpet()) { + if (!tile->hasCarpet()) { return; } - const Position& position = tile->getPosition(); + const Position &position = tile->getPosition(); uint32_t x = position.x; uint32_t y = position.y; uint32_t z = position.z; @@ -210,58 +203,58 @@ void CarpetBrush::doCarpets(BaseMap* map, Tile* tile) // } */ - for(Item* item : tile->items) { + for (Item* item : tile->items) { ASSERT(item); CarpetBrush* carpetBrush = item->getCarpetBrush(); - if(!carpetBrush) { + if (!carpetBrush) { continue; } bool neighbours[8] = { false }; - if(x == 0) { - if(y == 0) { + if (x == 0) { + if (y == 0) { neighbours[0] = false; neighbours[1] = false; neighbours[2] = false; neighbours[3] = false; - neighbours[4] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x + 1, y, z); + neighbours[4] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x + 1, y, z); neighbours[5] = false; - neighbours[6] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x, y + 1, z); + neighbours[6] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x, y + 1, z); neighbours[7] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x + 1, y + 1, z); } else { neighbours[0] = false; - neighbours[1] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x, y - 1, z); + neighbours[1] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x, y - 1, z); neighbours[2] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x + 1, y - 1, z); neighbours[3] = false; - neighbours[4] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x + 1, y, z); + neighbours[4] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x + 1, y, z); neighbours[5] = false; - neighbours[6] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x, y + 1, z); + neighbours[6] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x, y + 1, z); neighbours[7] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x + 1, y + 1, z); } - } else if(y == 0) { + } else if (y == 0) { neighbours[0] = false; neighbours[1] = false; neighbours[2] = false; - neighbours[3] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x - 1, y, z); - neighbours[4] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x + 1, y, z); + neighbours[3] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x - 1, y, z); + neighbours[4] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x + 1, y, z); neighbours[5] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x - 1, y + 1, z); - neighbours[6] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x, y + 1, z); + neighbours[6] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x, y + 1, z); neighbours[7] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x + 1, y + 1, z); } else { neighbours[0] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x - 1, y - 1, z); - neighbours[1] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x, y - 1, z); + neighbours[1] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x, y - 1, z); neighbours[2] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x + 1, y - 1, z); - neighbours[3] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x - 1, y, z); - neighbours[4] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x + 1, y, z); + neighbours[3] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x - 1, y, z); + neighbours[4] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x + 1, y, z); neighbours[5] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x - 1, y + 1, z); - neighbours[6] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x, y + 1, z); + neighbours[6] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x, y + 1, z); neighbours[7] = hasMatchingCarpetBrushAtTile(map, carpetBrush, x + 1, y + 1, z); } uint32_t tileData = 0; - for(uint32_t i = 0; i < 8; ++i) { - if(neighbours[i]) { + for (uint32_t i = 0; i < 8; ++i) { + if (neighbours[i]) { // Same table as this one, calculate what border tileData |= static_cast(1) << i; } @@ -269,18 +262,17 @@ void CarpetBrush::doCarpets(BaseMap* map, Tile* tile) // border type is always valid. uint16_t id = carpetBrush->getRandomCarpet(static_cast(carpet_types[tileData])); - if(id != 0) { + if (id != 0) { item->setID(id); } } } -uint16_t CarpetBrush::getRandomCarpet(BorderType alignment) -{ - static const auto findRandomCarpet = [](const CarpetNode& node) -> uint16_t { +uint16_t CarpetBrush::getRandomCarpet(BorderType alignment) { + static const auto findRandomCarpet = [](const CarpetNode &node) -> uint16_t { int32_t chance = random(1, node.total_chance); - for(const CarpetType& carpetType : node.items) { - if(chance <= carpetType.chance) { + for (const CarpetType &carpetType : node.items) { + if (chance <= carpetType.chance) { return carpetType.id; } chance -= carpetType.chance; @@ -289,24 +281,24 @@ uint16_t CarpetBrush::getRandomCarpet(BorderType alignment) }; CarpetNode node = carpet_items[alignment]; - if(node.total_chance > 0) { + if (node.total_chance > 0) { return findRandomCarpet(node); } node = carpet_items[CARPET_CENTER]; - if(alignment != CARPET_CENTER && node.total_chance > 0) { + if (alignment != CARPET_CENTER && node.total_chance > 0) { uint16_t id = findRandomCarpet(node); - if(id != 0) { + if (id != 0) { return id; } } // Find an item to place on the tile, first center, then the rest. - for(int32_t i = 0; i < 12; ++i) { + for (int32_t i = 0; i < 12; ++i) { node = carpet_items[i]; - if(node.total_chance > 0) { + if (node.total_chance > 0) { uint16_t id = findRandomCarpet(node); - if(id != 0) { + if (id != 0) { return id; } } diff --git a/source/carpet_brush.h b/source/carpet_brush.h index 33b7116e..aa0c6cab 100644 --- a/source/carpet_brush.h +++ b/source/carpet_brush.h @@ -24,54 +24,67 @@ // Carpetbrush, for tables, and some things that behave like tables // and with tables I really mean counters. -class CarpetBrush : public Brush -{ - public: - static void init(); - - CarpetBrush(); - virtual ~CarpetBrush(); - - bool isCarpet() const { return true; } - CarpetBrush* asCarpet() { return static_cast(this); } - - virtual bool load(pugi::xml_node node, wxArrayString& warnings); - - virtual bool canDraw(BaseMap* map, const Position& position) const; - virtual void draw(BaseMap* map, Tile* tile, void* parameter); - virtual void undraw(BaseMap* map, Tile* tile); - - static void doCarpets(BaseMap* map, Tile* tile); - - virtual bool canDrag() const { return true; } - virtual bool needBorders() const { return true; } - - virtual int getLookID() const { return look_id; } - - virtual std::string getName() const { return name; } - virtual void setName(const std::string& newName) { name = newName; } - - protected: - uint16_t getRandomCarpet(BorderType alignment); - - struct CarpetType { - int32_t chance; - uint16_t id; - }; - - struct CarpetNode { - std::vector items; - int32_t total_chance; - - CarpetNode() : - items(), total_chance(0) {} - }; - - CarpetNode carpet_items[14]; - std::string name; - uint16_t look_id; - - static uint32_t carpet_types[256]; +class CarpetBrush : public Brush { +public: + static void init(); + + CarpetBrush(); + virtual ~CarpetBrush(); + + bool isCarpet() const { + return true; + } + CarpetBrush* asCarpet() { + return static_cast(this); + } + + virtual bool load(pugi::xml_node node, wxArrayString &warnings); + + virtual bool canDraw(BaseMap* map, const Position &position) const; + virtual void draw(BaseMap* map, Tile* tile, void* parameter); + virtual void undraw(BaseMap* map, Tile* tile); + + static void doCarpets(BaseMap* map, Tile* tile); + + virtual bool canDrag() const { + return true; + } + virtual bool needBorders() const { + return true; + } + + virtual int getLookID() const { + return look_id; + } + + virtual std::string getName() const { + return name; + } + virtual void setName(const std::string &newName) { + name = newName; + } + +protected: + uint16_t getRandomCarpet(BorderType alignment); + + struct CarpetType { + int32_t chance; + uint16_t id; + }; + + struct CarpetNode { + std::vector items; + int32_t total_chance; + + CarpetNode() : + items(), total_chance(0) { } + }; + + CarpetNode carpet_items[14]; + std::string name; + uint16_t look_id; + + static uint32_t carpet_types[256]; }; #endif diff --git a/source/client_version.cpp b/source/client_version.cpp index 8925852b..f8a67c21 100644 --- a/source/client_version.cpp +++ b/source/client_version.cpp @@ -33,8 +33,7 @@ ClientVersion::VersionMap ClientVersion::client_versions; ClientVersion* ClientVersion::latest_version = nullptr; ClientVersion::OtbMap ClientVersion::otb_versions; -void ClientVersion::loadVersions() -{ +void ClientVersion::loadVersions() { // Clean up old stuff ClientVersion::unloadVersions(); @@ -54,61 +53,55 @@ void ClientVersion::loadVersions() work_dir_client_xml.SetFullName("clients.xml"); file_to_load = exec_dir_client_xml; - if(!file_to_load.FileExists()) { + if (!file_to_load.FileExists()) { file_to_load = data_dir_client_xml; - if(!file_to_load.FileExists()) { + if (!file_to_load.FileExists()) { file_to_load = work_dir_client_xml; - if(!file_to_load.FileExists()) { + if (!file_to_load.FileExists()) { file_to_load.Clear(); } } } - if(!file_to_load.FileExists()) { - wxLogError(wxString() + - "Could not load clients.xml, editor will NOT be able to load any client data files.\n" + - "Checked paths:\n" + - exec_dir_client_xml.GetFullPath() + "\n" + - data_dir_client_xml.GetFullPath() + "\n" + - work_dir_client_xml.GetFullPath() - ); + if (!file_to_load.FileExists()) { + wxLogError(wxString() + "Could not load clients.xml, editor will NOT be able to load any client data files.\n" + "Checked paths:\n" + exec_dir_client_xml.GetFullPath() + "\n" + data_dir_client_xml.GetFullPath() + "\n" + work_dir_client_xml.GetFullPath()); return; } // Parse the file pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(file_to_load.GetFullPath().mb_str()); - if(result) { + if (result) { pugi::xml_node node = doc.child("client_config"); - if(!node) { + if (!node) { wxLogError("Could not load clients.xml (syntax error), editor will NOT be able to load any client data files."); return; } - for(pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { - const std::string& childName = as_lower_str(childNode.name()); - if(childName == "otbs") { - for(pugi::xml_node otbNode = childNode.first_child(); otbNode; otbNode = otbNode.next_sibling()) { - if(as_lower_str(otbNode.name()) == "otb") { + for (pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { + const std::string &childName = as_lower_str(childNode.name()); + if (childName == "otbs") { + for (pugi::xml_node otbNode = childNode.first_child(); otbNode; otbNode = otbNode.next_sibling()) { + if (as_lower_str(otbNode.name()) == "otb") { loadOTBInfo(otbNode); } } - } else if(childName == "clients") { - for(pugi::xml_node versionNode = childNode.first_child(); versionNode; versionNode = versionNode.next_sibling()) { - if(as_lower_str(versionNode.name()) == "client") { + } else if (childName == "clients") { + for (pugi::xml_node versionNode = childNode.first_child(); versionNode; versionNode = versionNode.next_sibling()) { + if (as_lower_str(versionNode.name()) == "client") { loadVersion(versionNode); } } } } - for(pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { - if(as_lower_str(childNode.name()) != "clients") { + for (pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { + if (as_lower_str(childNode.name()) != "clients") { continue; } - for(pugi::xml_node versionNode = childNode.first_child(); versionNode; versionNode = versionNode.next_sibling()) { - if(as_lower_str(versionNode.name()) == "client") { + for (pugi::xml_node versionNode = childNode.first_child(); versionNode; versionNode = versionNode.next_sibling()) { + if (as_lower_str(versionNode.name()) == "client") { loadVersionExtensions(versionNode); } } @@ -116,66 +109,62 @@ void ClientVersion::loadVersions() } // Assign a default if there isn't one. - if(!latest_version && !client_versions.empty()) { + if (!latest_version && !client_versions.empty()) { latest_version = client_versions.begin()->second; } // Load the data directory info - try - { + try { json read_obj = json::parse(g_settings.getString(Config::ASSETS_DATA_DIRS)); auto vers_obj = read_obj.get>(); - for (const auto& ver_iter : vers_obj) { - const auto& ver_obj = ver_iter.get(); + for (const auto &ver_iter : vers_obj) { + const auto &ver_obj = ver_iter.get(); auto version = get(ver_obj.at("id").get()); - if (version == nullptr) + if (version == nullptr) { continue; + } version->setClientPath(wxstr(ver_obj.at("path").get())); } - } - catch ([[maybe_unused]]const json::exception& e) - { + } catch ([[maybe_unused]] const json::exception &e) { // pass } } -void ClientVersion::unloadVersions() -{ - for(VersionMap::iterator it = client_versions.begin(); it != client_versions.end(); ++it) +void ClientVersion::unloadVersions() { + for (VersionMap::iterator it = client_versions.begin(); it != client_versions.end(); ++it) { delete it->second; + } client_versions.clear(); latest_version = nullptr; otb_versions.clear(); - } -void ClientVersion::loadOTBInfo(pugi::xml_node otbNode) -{ - if(as_lower_str(otbNode.name()) != "otb") { +void ClientVersion::loadOTBInfo(pugi::xml_node otbNode) { + if (as_lower_str(otbNode.name()) != "otb") { return; } pugi::xml_attribute attribute; - if(!(attribute = otbNode.attribute("client"))) { + if (!(attribute = otbNode.attribute("client"))) { wxLogError("Node 'otb' must contain 'client' tag."); return; } - OtbVersion otb = {"", OTB_VERSION_3, CLIENT_VERSION_NONE}; + OtbVersion otb = { "", OTB_VERSION_3, CLIENT_VERSION_NONE }; otb.name = attribute.as_string(); - if(!(attribute = otbNode.attribute("id"))) { + if (!(attribute = otbNode.attribute("id"))) { wxLogError("Node 'otb' must contain 'id' tag."); return; } otb.id = static_cast(attribute.as_int()); - if(!(attribute = otbNode.attribute("version"))) { + if (!(attribute = otbNode.attribute("version"))) { wxLogError("Node 'otb' must contain 'version' tag."); return; } OtbFormatVersion versionId = static_cast(attribute.as_uint()); - if(versionId < OTB_VERSION_1 || versionId > OTB_VERSION_3) { + if (versionId < OTB_VERSION_1 || versionId > OTB_VERSION_3) { wxLogError("Node 'otb' unrecognized format version (version 1..3 supported)."); return; } @@ -184,28 +173,27 @@ void ClientVersion::loadOTBInfo(pugi::xml_node otbNode) otb_versions[otb.name] = otb; } -void ClientVersion::loadVersion(pugi::xml_node versionNode) -{ +void ClientVersion::loadVersion(pugi::xml_node versionNode) { pugi::xml_attribute attribute; - if(!(attribute = versionNode.attribute("name"))) { + if (!(attribute = versionNode.attribute("name"))) { wxLogError("Node 'client' must contain 'name', 'data_directory' and 'otb' tags."); return; } - const std::string& versionName = attribute.as_string(); - if(!(attribute = versionNode.attribute("data_directory"))) { + const std::string &versionName = attribute.as_string(); + if (!(attribute = versionNode.attribute("data_directory"))) { wxLogError("Node 'client' must contain 'name', 'data_directory' and 'otb' tags."); return; } - const std::string& dataPath = attribute.as_string(); - if(!(attribute = versionNode.attribute("otb"))) { + const std::string &dataPath = attribute.as_string(); + if (!(attribute = versionNode.attribute("otb"))) { wxLogError("Node 'client' must contain 'name', 'data_directory' and 'otb' tags."); return; } - const std::string& otbVersionName = attribute.as_string(); - if(otb_versions.find(otbVersionName) == otb_versions.end()) { + const std::string &otbVersionName = attribute.as_string(); + if (otb_versions.find(otbVersionName) == otb_versions.end()) { wxLogError("Node 'client' 'otb' tag is invalid (couldn't find this otb version)."); return; } @@ -215,48 +203,48 @@ void ClientVersion::loadVersion(pugi::xml_node versionNode) bool should_be_default = versionNode.attribute("default").as_bool(); version->visible = versionNode.attribute("visible").as_bool(); - for(pugi::xml_node childNode = versionNode.first_child(); childNode; childNode = childNode.next_sibling()) { - const std::string& childName = as_lower_str(childNode.name()); - if(childName == "otbm") { - if(!(attribute = childNode.attribute("version"))) { + for (pugi::xml_node childNode = versionNode.first_child(); childNode; childNode = childNode.next_sibling()) { + const std::string &childName = as_lower_str(childNode.name()); + if (childName == "otbm") { + if (!(attribute = childNode.attribute("version"))) { wxLogError("Node 'otbm' missing version."); continue; } int32_t otbmVersion = attribute.as_int() - 1; - if(otbmVersion < MAP_OTBM_1 || otbmVersion > MAP_OTBM_4) { + if (otbmVersion < MAP_OTBM_1 || otbmVersion > MAP_OTBM_4) { wxLogError("Node 'otbm' unsupported version."); continue; } - if(childNode.attribute("preffered").as_bool() || version->preferred_map_version == MAP_OTBM_UNKNOWN) { + if (childNode.attribute("preffered").as_bool() || version->preferred_map_version == MAP_OTBM_UNKNOWN) { version->preferred_map_version = static_cast(otbmVersion); } version->map_versions_supported.push_back(version->preferred_map_version); - } else if(childName == "fucked_up_charges") { + } else if (childName == "fucked_up_charges") { version->usesFuckedUpCharges = true; - } else if(childName == "data") { + } else if (childName == "data") { - if(!(attribute = childNode.attribute("format"))) { + if (!(attribute = childNode.attribute("format"))) { wxLogError("Node 'data' does not have 'format' tag."); continue; } - const std::string& format = attribute.as_string(); + const std::string &format = attribute.as_string(); ClientData client_data = { DAT_FORMAT_11, 0, 0 }; - if(format == "11") { + if (format == "11") { client_data.datFormat = DAT_FORMAT_11; } else { wxLogError("Node 'data' 'format' is invalid (only 11.00 are supported)"); continue; } - if(!(attribute = childNode.attribute("dat")) || !wxString(attribute.as_string(), wxConvUTF8).ToULong((unsigned long*)&client_data.datSignature, 16)) { + if (!(attribute = childNode.attribute("dat")) || !wxString(attribute.as_string(), wxConvUTF8).ToULong((unsigned long*)&client_data.datSignature, 16)) { wxLogError("Node 'data' 'dat' tag is not hex-formatted."); continue; } - if(!(attribute = childNode.attribute("spr")) || !wxString(attribute.as_string(), wxConvUTF8).ToULong((unsigned long*)&client_data.sprSignature, 16)) { + if (!(attribute = childNode.attribute("spr")) || !wxString(attribute.as_string(), wxConvUTF8).ToULong((unsigned long*)&client_data.sprSignature, 16)) { wxLogError("Node 'data' 'spr' tag is not hex-formatted."); continue; } @@ -265,59 +253,58 @@ void ClientVersion::loadVersion(pugi::xml_node versionNode) } } - if(client_versions[version->getID()]) { + if (client_versions[version->getID()]) { wxLogError("Duplicate version id %i, discarding version '%s'.", version->getID(), version->name); delete version; return; } client_versions[version->getID()] = version; - if(should_be_default) { + if (should_be_default) { latest_version = version; } } -void ClientVersion::loadVersionExtensions(pugi::xml_node versionNode) -{ +void ClientVersion::loadVersionExtensions(pugi::xml_node versionNode) { pugi::xml_attribute attribute; - if(!(attribute = versionNode.attribute("name"))) { + if (!(attribute = versionNode.attribute("name"))) { // Error has already been displayed earlier, no need to show another error about the same thing return; } ClientVersion* version = get(attribute.as_string()); - if(!version) { + if (!version) { // Same rationale as above return; } - for(pugi::xml_node childNode = versionNode.first_child(); childNode; childNode = childNode.next_sibling()) { - if(as_lower_str(childNode.name()) != "extensions") { + for (pugi::xml_node childNode = versionNode.first_child(); childNode; childNode = childNode.next_sibling()) { + if (as_lower_str(childNode.name()) != "extensions") { continue; } - const std::string& from = childNode.attribute("from").as_string(); - const std::string& to = childNode.attribute("to").as_string(); + const std::string &from = childNode.attribute("from").as_string(); + const std::string &to = childNode.attribute("to").as_string(); ClientVersion* fromVersion = get(from); ClientVersion* toVersion = get(to); - if(!fromVersion && !toVersion) { + if (!fromVersion && !toVersion) { wxLogError("Unknown client extension data."); continue; } - if(!fromVersion) { + if (!fromVersion) { fromVersion = client_versions.begin()->second; } - if(!toVersion) { + if (!toVersion) { toVersion = client_versions.rbegin()->second; } - for(const auto& versionEntry : client_versions) { + for (const auto &versionEntry : client_versions) { ClientVersion* version = versionEntry.second; - if(version->getID() >= fromVersion->getID() && version->getID() <= toVersion->getID()) { + if (version->getID() >= fromVersion->getID() && version->getID() <= toVersion->getID()) { version->extension_versions.push_back(version); } } @@ -326,12 +313,11 @@ void ClientVersion::loadVersionExtensions(pugi::xml_node versionNode) } } -void ClientVersion::saveVersions() -{ +void ClientVersion::saveVersions() { try { json vers_obj; - for(auto& [id, version] : client_versions) { + for (auto &[id, version] : client_versions) { json ver_obj; ver_obj["id"] = version->getName(); ver_obj["path"] = version->getClientPath().GetFullPath().ToStdString(); @@ -341,8 +327,7 @@ void ClientVersion::saveVersions() std::ostringstream out; out << vers_obj; g_settings.setString(Config::ASSETS_DATA_DIRS, out.str()); - } - catch ([[maybe_unused]]const json::exception& e) { + } catch ([[maybe_unused]] const json::exception &e) { // pass } } @@ -354,81 +339,79 @@ ClientVersion::ClientVersion(OtbVersion otb, std::string versionName, wxString p name(versionName), visible(false), preferred_map_version(MAP_OTBM_UNKNOWN), - data_path(path) -{ + data_path(path) { //// } -ClientVersion* ClientVersion::get(ClientVersionID id) -{ +ClientVersion* ClientVersion::get(ClientVersionID id) { VersionMap::iterator i = client_versions.find(id); - if(i == client_versions.end()) + if (i == client_versions.end()) { return nullptr; + } return i->second; } -ClientVersion* ClientVersion::get(std::string id) -{ - for(VersionMap::iterator i = client_versions.begin(); i != client_versions.end(); ++i) - if(i->second->getName() == id) +ClientVersion* ClientVersion::get(std::string id) { + for (VersionMap::iterator i = client_versions.begin(); i != client_versions.end(); ++i) { + if (i->second->getName() == id) { return i->second; + } + } return nullptr; } -ClientVersionList ClientVersion::getAll() -{ +ClientVersionList ClientVersion::getAll() { ClientVersionList l; - for(VersionMap::iterator i = client_versions.begin(); i != client_versions.end(); ++i) + for (VersionMap::iterator i = client_versions.begin(); i != client_versions.end(); ++i) { l.push_back(i->second); + } return l; } -ClientVersionList ClientVersion::getAllVisible() -{ +ClientVersionList ClientVersion::getAllVisible() { ClientVersionList l; - for(VersionMap::iterator i = client_versions.begin(); i != client_versions.end(); ++i) - if(i->second->isVisible()) + for (VersionMap::iterator i = client_versions.begin(); i != client_versions.end(); ++i) { + if (i->second->isVisible()) { l.push_back(i->second); + } + } return l; } -ClientVersionList ClientVersion::getAllForOTBMVersion(MapVersionID id) -{ +ClientVersionList ClientVersion::getAllForOTBMVersion(MapVersionID id) { ClientVersionList list; - for(VersionMap::iterator i = client_versions.begin(); i != client_versions.end(); ++i) { - if(i->second->isVisible()) { - for(std::vector::iterator v = i->second->map_versions_supported.begin(); v != i->second->map_versions_supported.end(); ++v) { - if(*v == id) + for (VersionMap::iterator i = client_versions.begin(); i != client_versions.end(); ++i) { + if (i->second->isVisible()) { + for (std::vector::iterator v = i->second->map_versions_supported.begin(); v != i->second->map_versions_supported.end(); ++v) { + if (*v == id) { list.push_back(i->second); + } } } } return list; } -ClientVersion* ClientVersion::getLatestVersion() -{ +ClientVersion* ClientVersion::getLatestVersion() { return latest_version; } -FileName ClientVersion::getDataPath() const -{ +FileName ClientVersion::getDataPath() const { wxString basePath = g_gui.GetDataDirectory(); - if(!wxFileName(basePath).DirExists()) + if (!wxFileName(basePath).DirExists()) { basePath = g_gui.getFoundDataDirectory(); + } return basePath + data_path + FileName::GetPathSeparator(); } -FileName ClientVersion::getLocalDataPath() const -{ +FileName ClientVersion::getLocalDataPath() const { FileName f = g_gui.GetLocalDataDirectory() + data_path + FileName::GetPathSeparator(); f.Mkdir(0755, wxPATH_MKDIR_FULL); return f; } -bool ClientVersion::hasValidPaths() -{ - if(!client_path.DirExists()) { +bool ClientVersion::hasValidPaths() { + if (!client_path.DirExists()) { return false; } @@ -437,10 +420,10 @@ bool ClientVersion::hasValidPaths() metadata_path = wxFileName(client_path.GetFullPath(), wxString(ASSETS_NAME) + ".dat"); sprites_path = wxFileName(client_path.GetFullPath(), wxString(ASSETS_NAME) + ".spr"); - if(dir.GetFirst(&otfi_file, "*.otfi", wxDIR_FILES)) { + if (dir.GetFirst(&otfi_file, "*.otfi", wxDIR_FILES)) { wxFileName otfi(client_path.GetFullPath(), otfi_file); OTMLDocumentPtr doc = OTMLDocument::parse(otfi.GetFullPath().ToStdString()); - if(doc->size() != 0 && doc->hasChildAt("DatSpr")) { + if (doc->size() != 0 && doc->hasChildAt("DatSpr")) { OTMLNodePtr node = doc->get("DatSpr"); std::string metadata = node->valueAt("metadata-file", std::string(ASSETS_NAME) + ".dat"); std::string sprites = node->valueAt("sprites-file", std::string(ASSETS_NAME) + ".spr"); @@ -449,17 +432,17 @@ bool ClientVersion::hasValidPaths() } } - if(!metadata_path.FileExists() || !sprites_path.FileExists()) { + if (!metadata_path.FileExists() || !sprites_path.FileExists()) { return false; } - if(!g_settings.getInteger(Config::CHECK_SIGNATURES)) { + if (!g_settings.getInteger(Config::CHECK_SIGNATURES)) { return true; } // Peek the version of the files FileReadHandle dat_file(static_cast(metadata_path.GetFullPath().mb_str())); - if(!dat_file.isOk()) { + if (!dat_file.isOk()) { wxLogError("Could not open metadata file."); return false; } @@ -469,7 +452,7 @@ bool ClientVersion::hasValidPaths() dat_file.close(); FileReadHandle spr_file(static_cast(sprites_path.GetFullPath().mb_str())); - if(!spr_file.isOk()) { + if (!spr_file.isOk()) { wxLogError("Could not open sprites file."); return false; } @@ -478,8 +461,8 @@ bool ClientVersion::hasValidPaths() spr_file.getU32(sprSignature); spr_file.close(); - for(const auto& clientData : data_versions) { - if(clientData.sprSignature == sprSignature && clientData.datSignature == datSignature) { + for (const auto &clientData : data_versions) { + if (clientData.sprSignature == sprSignature && clientData.datSignature == datSignature) { return true; } } @@ -491,9 +474,8 @@ bool ClientVersion::hasValidPaths() return false; } -bool ClientVersion::loadValidPaths() -{ - while(!hasValidPaths()) { +bool ClientVersion::loadValidPaths() { + while (!hasValidPaths()) { wxString message = "Could not locate metadata and/or sprite files, please navigate to your client assets %s installation folder.\n"; message << "Attempted metadata file: %s\n"; message << "Attempted sprites file: %s\n"; @@ -503,8 +485,9 @@ bool ClientVersion::loadValidPaths() wxString dirHelpText("Select assets directory."); wxDirDialog file_dlg(nullptr, dirHelpText, "", wxDD_DIR_MUST_EXIST); int ok = file_dlg.ShowModal(); - if(ok == wxID_CANCEL) + if (ok == wxID_CANCEL) { return false; + } client_path.Assign(file_dlg.GetPath() + FileName::GetPathSeparator()); } @@ -514,58 +497,50 @@ bool ClientVersion::loadValidPaths() return true; } -DatFormat ClientVersion::getDatFormatForSignature(uint32_t signature) const -{ - for(std::vector::const_iterator iter = data_versions.begin(); iter != data_versions.end(); ++iter) { - if(iter->datSignature == signature) +DatFormat ClientVersion::getDatFormatForSignature(uint32_t signature) const { + for (std::vector::const_iterator iter = data_versions.begin(); iter != data_versions.end(); ++iter) { + if (iter->datSignature == signature) { return iter->datFormat; + } } return DAT_FORMAT_UNKNOWN; } -std::string ClientVersion::getName() const -{ +std::string ClientVersion::getName() const { return name; } -ClientVersionID ClientVersion::getID() const -{ +ClientVersionID ClientVersion::getID() const { return otb.id; } -bool ClientVersion::isVisible() const -{ +bool ClientVersion::isVisible() const { return visible; } -void ClientVersion::setClientPath(const FileName& dir) -{ +void ClientVersion::setClientPath(const FileName &dir) { client_path.Assign(dir); } -MapVersionID ClientVersion::getPrefferedMapVersionID() const -{ +MapVersionID ClientVersion::getPrefferedMapVersionID() const { return preferred_map_version; } -OtbVersion ClientVersion::getOTBVersion() const -{ +OtbVersion ClientVersion::getOTBVersion() const { return otb; } -ClientVersionList ClientVersion::getExtensionsSupported() const -{ +ClientVersionList ClientVersion::getExtensionsSupported() const { return extension_versions; } -ClientVersionList ClientVersion::getAllVersionsSupportedForClientVersion(ClientVersion* clientVersion) -{ +ClientVersionList ClientVersion::getAllVersionsSupportedForClientVersion(ClientVersion* clientVersion) { ClientVersionList versionList; - for(const auto& versionEntry : client_versions) { + for (const auto &versionEntry : client_versions) { ClientVersion* version = versionEntry.second; - for(ClientVersion* checkVersion : version->getExtensionsSupported()) { - if(clientVersion == checkVersion) { + for (ClientVersion* checkVersion : version->getExtensionsSupported()) { + if (clientVersion == checkVersion) { versionList.push_back(version); } } diff --git a/source/client_version.h b/source/client_version.h index a775d33c..8cac4bc8 100644 --- a/source/client_version.h +++ b/source/client_version.h @@ -83,8 +83,7 @@ enum ClientVersions { }; // OTBM versions -enum MapVersionID -{ +enum MapVersionID { MAP_OTBM_UNKNOWN = -1, MAP_OTBM_1 = 0, MAP_OTBM_2 = 1, @@ -93,24 +92,23 @@ enum MapVersionID }; // The composed version of a otbm file (otbm version, client version) -struct MapVersion -{ - MapVersion() : otbm(MAP_OTBM_1), client(CLIENT_VERSION_NONE) {} - MapVersion(MapVersionID m, ClientVersionID c) : otbm(m), client(c) {} +struct MapVersion { + MapVersion() : + otbm(MAP_OTBM_1), client(CLIENT_VERSION_NONE) { } + MapVersion(MapVersionID m, ClientVersionID c) : + otbm(m), client(c) { } MapVersionID otbm; ClientVersionID client; }; -enum OtbFormatVersion : uint32_t -{ +enum OtbFormatVersion : uint32_t { OTB_VERSION_1 = 1, OTB_VERSION_2 = 2, OTB_VERSION_3 = 3, }; // Represents an OTB version -struct OtbVersion -{ +struct OtbVersion { // '8.60', '7.40' etc. std::string name; // What file format the OTB is in (version 1..3) @@ -120,14 +118,12 @@ struct OtbVersion }; // Formats for the metadata file -enum DatFormat -{ +enum DatFormat { DAT_FORMAT_UNKNOWN, DAT_FORMAT_11 }; -enum DatFlags : uint8_t -{ +enum DatFlags : uint8_t { DatFlagGround = 0, DatFlagGroundBorder = 1, DatFlagOnBottom = 2, @@ -174,8 +170,7 @@ enum DatFlags : uint8_t }; // Represents a client file version -struct ClientData -{ +struct ClientData { DatFormat datFormat; uint32_t datSignature; uint32_t sprSignature; @@ -185,8 +180,7 @@ struct ClientData class ClientVersion; typedef std::vector ClientVersionList; -class ClientVersion -{ +class ClientVersion { public: ClientVersion(OtbVersion otb, std::string versionName, wxString path); ~ClientVersion() = default; @@ -208,11 +202,13 @@ class ClientVersion static ClientVersionList getAllVersionsSupportedForClientVersion(ClientVersion* v); static ClientVersion* getLatestVersion(); - bool operator==(const ClientVersion& o) const {return otb.id == o.otb.id;} + bool operator==(const ClientVersion &o) const { + return otb.id == o.otb.id; + } bool hasValidPaths(); bool loadValidPaths(); - void setClientPath(const FileName& dir); + void setClientPath(const FileName &dir); bool isVisible() const; std::string getName() const; @@ -225,9 +221,15 @@ class ClientVersion FileName getDataPath() const; FileName getLocalDataPath() const; - FileName getClientPath() const { return client_path; } - wxFileName getMetadataPath() const { return metadata_path; } - wxFileName getSpritesPath() const { return sprites_path; } + FileName getClientPath() const { + return client_path; + } + wxFileName getMetadataPath() const { + return metadata_path; + } + wxFileName getSpritesPath() const { + return sprites_path; + } private: OtbVersion otb; @@ -261,9 +263,8 @@ class ClientVersion static OtbMap otb_versions; }; -inline int VersionComparisonPredicate(ClientVersion* a, ClientVersion* b) -{ - if(a->getID() < b->getID()) { +inline int VersionComparisonPredicate(ClientVersion* a, ClientVersion* b) { + if (a->getID() < b->getID()) { return 1; } return 0; diff --git a/source/common.cpp b/source/common.cpp index 024999b6..fe88f6f7 100644 --- a/source/common.cpp +++ b/source/common.cpp @@ -21,162 +21,141 @@ #include "math.h" // random generator -std::mt19937& getRandomGenerator() -{ +std::mt19937 &getRandomGenerator() { static std::random_device rd; static std::mt19937 generator(rd()); return generator; } -int32_t uniform_random(int32_t minNumber, int32_t maxNumber) -{ +int32_t uniform_random(int32_t minNumber, int32_t maxNumber) { static std::uniform_int_distribution uniformRand; - if(minNumber == maxNumber) { + if (minNumber == maxNumber) { return minNumber; - } else if(minNumber > maxNumber) { + } else if (minNumber > maxNumber) { std::swap(minNumber, maxNumber); } return uniformRand(getRandomGenerator(), std::uniform_int_distribution::param_type(minNumber, maxNumber)); } -int32_t uniform_random(int32_t maxNumber) -{ +int32_t uniform_random(int32_t maxNumber) { return uniform_random(0, maxNumber); } // -std::string i2s(const int _i) -{ +std::string i2s(const int _i) { static std::stringstream ss; ss.str(""); ss << _i; return ss.str(); } -std::string f2s(const double _d) -{ +std::string f2s(const double _d) { static std::stringstream ss; ss.str(""); ss << _d; return ss.str(); } -int s2i(const std::string s) -{ +int s2i(const std::string s) { return atoi(s.c_str()); } -double s2f(const std::string s) -{ +double s2f(const std::string s) { return atof(s.c_str()); } -wxString i2ws(const int _i) -{ +wxString i2ws(const int _i) { wxString str; str << _i; return str; } -wxString f2ws(const double _d) -{ +wxString f2ws(const double _d) { wxString str; str << _d; return str; } -int ws2i(const wxString s) -{ +int ws2i(const wxString s) { long _i; - if(s.ToLong(&_i)) + if (s.ToLong(&_i)) { return int(_i); + } return 0; } -double ws2f(const wxString s) -{ +double ws2f(const wxString s) { double _d; - if(s.ToDouble(&_d)) + if (s.ToDouble(&_d)) { return _d; + } return 0.0; } -void replaceString(std::string& str, const std::string sought, const std::string replacement) -{ +void replaceString(std::string &str, const std::string sought, const std::string replacement) { size_t pos = 0; size_t start = 0; size_t soughtLen = sought.length(); size_t replaceLen = replacement.length(); - while((pos = str.find(sought, start)) != std::string::npos) { + while ((pos = str.find(sought, start)) != std::string::npos) { str = str.substr(0, pos) + replacement + str.substr(pos + soughtLen); start = pos + replaceLen; } } -void trim_right(std::string& source, const std::string& t) -{ - source.erase(source.find_last_not_of(t)+1); +void trim_right(std::string &source, const std::string &t) { + source.erase(source.find_last_not_of(t) + 1); } -void trim_left(std::string& source, const std::string& t) -{ +void trim_left(std::string &source, const std::string &t) { source.erase(0, source.find_first_not_of(t)); } -void trim(std::string& str) { +void trim(std::string &str) { // Trim from start - str.erase(str.begin(), std::find_if(str.begin(), str.end(), - [](int ch) { return !std::isspace(ch); })); + str.erase(str.begin(), std::find_if(str.begin(), str.end(), [](int ch) { return !std::isspace(ch); })); // Trim from end - str.erase(std::find_if(str.rbegin(), str.rend(), - [](int ch) { return !std::isspace(ch); }).base(), str.end()); + str.erase(std::find_if(str.rbegin(), str.rend(), [](int ch) { return !std::isspace(ch); }).base(), str.end()); } -void to_lower_str(std::string& source) -{ +void to_lower_str(std::string &source) { std::transform(source.begin(), source.end(), source.begin(), tolower); } -void to_upper_str(std::string& source) -{ +void to_upper_str(std::string &source) { std::transform(source.begin(), source.end(), source.begin(), toupper); } -std::string as_lower_str(const std::string& other) -{ +std::string as_lower_str(const std::string &other) { std::string ret = other; to_lower_str(ret); return ret; } -std::string as_upper_str(const std::string& other) -{ +std::string as_upper_str(const std::string &other) { std::string ret = other; to_upper_str(ret); return ret; } -bool isFalseString(std::string& str) -{ - if(str == "false" || str == "0" || str == "" || str == "no" || str == "not") { +bool isFalseString(std::string &str) { + if (str == "false" || str == "0" || str == "" || str == "no" || str == "not") { return true; } return false; } -bool isTrueString(std::string& str) -{ +bool isTrueString(std::string &str) { return !isFalseString(str); } -int random(int low, int high) -{ - if(low == high) { +int random(int low, int high) { + if (low == high) { return low; } - if(low > high) { + if (low > high) { return low; } @@ -186,54 +165,51 @@ int random(int low, int high) return low + std::min(range, int((1 + range) * dist)); } -int random(int high) -{ - return random(0,high); +int random(int high) { + return random(0, high); } -std::wstring string2wstring(const std::string& utf8string) -{ +std::wstring string2wstring(const std::string &utf8string) { wxString s(utf8string.c_str(), wxConvUTF8); return std::wstring((const wchar_t*)s.c_str()); } -std::string wstring2string(const std::wstring& widestring) -{ +std::string wstring2string(const std::wstring &widestring) { wxString s(widestring.c_str()); return std::string((const char*)s.mb_str(wxConvUTF8)); } -bool posFromClipboard(int& x, int& y, int& z) -{ +bool posFromClipboard(int &x, int &y, int &z) { bool done = false; - if(wxTheClipboard->Open()) { - if(wxTheClipboard->IsSupported(wxDF_TEXT)) { + if (wxTheClipboard->Open()) { + if (wxTheClipboard->IsSupported(wxDF_TEXT)) { std::vector values; wxTextDataObject data; wxTheClipboard->GetData(data); wxString text = data.GetText(); - if(text.size() < 50) { + if (text.size() < 50) { bool r = false; wxString sv; - for(size_t s = 0; s < text.size(); ++s) { - if(text[s] >= '0' && text[s] <= '9') { + for (size_t s = 0; s < text.size(); ++s) { + if (text[s] >= '0' && text[s] <= '9') { sv << text[s]; r = true; - } else if(r) { + } else if (r) { values.push_back(ws2i(sv)); sv.Clear(); r = false; - if(values.size() >= 3) + if (values.size() >= 3) { break; + } } } } - if(values.size() == 3) { + if (values.size() == 3) { x = values[0]; y = values[1]; z = values[2]; @@ -245,10 +221,10 @@ bool posFromClipboard(int& x, int& y, int& z) return done; } -bool posToClipboard(int x, int y, int z, int format) -{ - if (!wxTheClipboard->Open()) +bool posToClipboard(int x, int y, int z, int format) { + if (!wxTheClipboard->Open()) { return false; + } wxTextDataObject* data = new wxTextDataObject(); @@ -278,10 +254,10 @@ bool posToClipboard(int x, int y, int z, int format) return true; } -bool posToClipboard(int fromx, int fromy, int fromz, int tox, int toy, int toz) -{ - if (!wxTheClipboard->Open()) +bool posToClipboard(int fromx, int fromy, int fromz, int tox, int toy, int toz) { + if (!wxTheClipboard->Open()) { return false; + } std::ostringstream clip; clip << "{"; @@ -292,9 +268,9 @@ bool posToClipboard(int fromx, int fromy, int fromz, int tox, int toy, int toz) if (fromz != toz) { clip << "fromz = " << fromz << ", "; clip << "toz = " << toz; - } - else + } else { clip << "z = " << fromz; + } clip << "}"; wxTheClipboard->SetData(new wxTextDataObject(clip.str())); @@ -302,15 +278,14 @@ bool posToClipboard(int fromx, int fromy, int fromz, int tox, int toy, int toz) return true; } -wxString b2yn(bool value) -{ +wxString b2yn(bool value) { return value ? "Yes" : "No"; } -wxColor colorFromEightBit(int color) -{ - if(color <= 0 || color >= 216) +wxColor colorFromEightBit(int color) { + if (color <= 0 || color >= 216) { return wxColor(0, 0, 0); + } const uint8_t red = (uint8_t)(int(color / 36) % 6 * 51); const uint8_t green = (uint8_t)(int(color / 6) % 6 * 51); const uint8_t blue = (uint8_t)(color % 6 * 51); diff --git a/source/common.h b/source/common.h index c4e1d3c0..b0a1bbf4 100644 --- a/source/common.h +++ b/source/common.h @@ -41,32 +41,32 @@ int ws2i(wxString s); double ws2f(wxString s); // replaces all instances of sought in str with replacement -void replaceString(std::string& str, const std::string sought, const std::string replacement); +void replaceString(std::string &str, const std::string sought, const std::string replacement); // Removes all characters in t from source (from either start or beginning of the string) -void trim_right(std::string& source, const std::string& t); -void trim_left(std::string& source, const std::string& t); -void trim(std::string& str); +void trim_right(std::string &source, const std::string &t); +void trim_left(std::string &source, const std::string &t); +void trim(std::string &str); // Converts the argument to lower/uppercase -void to_lower_str(std::string& source); -void to_upper_str(std::string& source); -std::string as_lower_str(const std::string& other); -std::string as_upper_str(const std::string& other); +void to_lower_str(std::string &source); +void to_upper_str(std::string &source); +std::string as_lower_str(const std::string &other); +std::string as_upper_str(const std::string &other); // isFalseString returns true if the string is either "0", "false", "no", "not" or blank // isTrueString returns the opposite value of isFalseString -bool isFalseString(std::string& str); -bool isTrueString(std::string& str); +bool isFalseString(std::string &str); +bool isTrueString(std::string &str); // Generates a random number between low and high using the mersenne twister int random(int high); int random(int low, int high); // Unicode conversions -std::wstring string2wstring(const std::string& utf8string); -std::string wstring2string(const std::wstring& widestring); +std::wstring string2wstring(const std::string &utf8string); +std::string wstring2string(const std::wstring &widestring); // Gets position values from ClipBoard -bool posFromClipboard(int& x, int& y, int& z); +bool posFromClipboard(int &x, int &y, int &z); bool posToClipboard(int x, int y, int z, int format); bool posToClipboard(int fromx, int fromy, int fromz, int tox, int toy, int toz); diff --git a/source/common_windows.cpp b/source/common_windows.cpp index 333700e8..2f205f5d 100644 --- a/source/common_windows.cpp +++ b/source/common_windows.cpp @@ -36,25 +36,24 @@ #include "iominimap.h" #ifdef _MSC_VER - #pragma warning(disable:4018) // signed/unsigned mismatch + #pragma warning(disable : 4018) // signed/unsigned mismatch #endif // ============================================================================ // Map Properties Window BEGIN_EVENT_TABLE(MapPropertiesWindow, wxDialog) - EVT_CHOICE(MAP_PROPERTIES_VERSION, MapPropertiesWindow::OnChangeVersion) - EVT_BUTTON(wxID_OK, MapPropertiesWindow::OnClickOK) - EVT_BUTTON(wxID_CANCEL, MapPropertiesWindow::OnClickCancel) +EVT_CHOICE(MAP_PROPERTIES_VERSION, MapPropertiesWindow::OnChangeVersion) +EVT_BUTTON(wxID_OK, MapPropertiesWindow::OnClickOK) +EVT_BUTTON(wxID_CANCEL, MapPropertiesWindow::OnClickCancel) END_EVENT_TABLE() -MapPropertiesWindow::MapPropertiesWindow(wxWindow* parent, MapTab* view, Editor& editor) : +MapPropertiesWindow::MapPropertiesWindow(wxWindow* parent, MapTab* view, Editor &editor) : wxDialog(parent, wxID_ANY, "Map Properties", wxDefaultPosition, wxSize(300, 200), wxRESIZE_BORDER | wxCAPTION), view(view), - editor(editor) -{ + editor(editor) { // Setup data variabels - const Map& map = editor.getMap(); + const Map &map = editor.getMap(); wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); @@ -74,7 +73,7 @@ MapPropertiesWindow::MapPropertiesWindow(wxWindow* parent, MapTab* view, Editor& version_choice->Append("OTServ 0.6.1"); version_choice->Append("OTServ 0.7.0 (revscriptsys)"); - switch(map.getVersion().otbm) { + switch (map.getVersion().otbm) { case MAP_OTBM_1: version_choice->SetSelection(0); break; @@ -106,45 +105,38 @@ MapPropertiesWindow::MapPropertiesWindow(wxWindow* parent, MapTab* view, Editor& { wxSizer* subsizer = newd wxBoxSizer(wxHORIZONTAL); subsizer->Add( - width_spin = - newd wxSpinCtrl(this, wxID_ANY, wxstr(i2s(map.getWidth())), - wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, rme::MapMinWidth, rme::MapMaxWidth), wxSizerFlags(1).Expand() - ); + width_spin = newd wxSpinCtrl(this, wxID_ANY, wxstr(i2s(map.getWidth())), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, rme::MapMinWidth, rme::MapMaxWidth), wxSizerFlags(1).Expand() + ); subsizer->Add( - height_spin = - newd wxSpinCtrl(this, wxID_ANY, wxstr(i2s(map.getHeight())), - wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, rme::MapMinHeight, rme::MapMaxHeight), wxSizerFlags(1).Expand() - ); + height_spin = newd wxSpinCtrl(this, wxID_ANY, wxstr(i2s(map.getHeight())), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, rme::MapMinHeight, rme::MapMaxHeight), wxSizerFlags(1).Expand() + ); grid_sizer->Add(subsizer, 1, wxEXPAND); } // External files grid_sizer->Add( newd wxStaticText(this, wxID_ANY, "External house file") - ); + ); grid_sizer->Add( - house_filename_ctrl = - newd wxTextCtrl(this, wxID_ANY, wxstr(map.getHouseFilename())), 1, wxEXPAND - ); + house_filename_ctrl = newd wxTextCtrl(this, wxID_ANY, wxstr(map.getHouseFilename())), 1, wxEXPAND + ); grid_sizer->Add( newd wxStaticText(this, wxID_ANY, "External monster file") - ); + ); grid_sizer->Add( - spawn_filename_ctrl = - newd wxTextCtrl(this, wxID_ANY, wxstr(map.getSpawnFilename())), 1, wxEXPAND - ); + spawn_filename_ctrl = newd wxTextCtrl(this, wxID_ANY, wxstr(map.getSpawnFilename())), 1, wxEXPAND + ); grid_sizer->Add( newd wxStaticText(this, wxID_ANY, "External npc file") - ); + ); grid_sizer->Add( - spawn_npc_filename_ctrl = - newd wxTextCtrl(this, wxID_ANY, wxstr(map.getSpawnNpcFilename())), 1, wxEXPAND - ); + spawn_npc_filename_ctrl = newd wxTextCtrl(this, wxID_ANY, wxstr(map.getSpawnNpcFilename())), 1, wxEXPAND + ); topsizer->Add(grid_sizer, wxSizerFlags(1).Expand().Border(wxALL, 20)); @@ -161,63 +153,59 @@ MapPropertiesWindow::MapPropertiesWindow(wxWindow* parent, MapTab* view, Editor& protocol_choice->SetStringSelection(wxstr(current_version->getName())); } -void MapPropertiesWindow::UpdateProtocolList() -{ +void MapPropertiesWindow::UpdateProtocolList() { wxString ver = version_choice->GetStringSelection(); wxString client = protocol_choice->GetStringSelection(); protocol_choice->Clear(); ClientVersionList versions; - if(g_settings.getInteger(Config::USE_OTBM_4_FOR_ALL_MAPS)) { + if (g_settings.getInteger(Config::USE_OTBM_4_FOR_ALL_MAPS)) { versions = ClientVersion::getAllVisible(); } else { MapVersionID map_version = MAP_OTBM_1; - if(ver.Contains("0.5.0")) + if (ver.Contains("0.5.0")) { map_version = MAP_OTBM_1; - else if(ver.Contains("0.6.0")) + } else if (ver.Contains("0.6.0")) { map_version = MAP_OTBM_2; - else if(ver.Contains("0.6.1")) + } else if (ver.Contains("0.6.1")) { map_version = MAP_OTBM_3; - else if(ver.Contains("0.7.0")) + } else if (ver.Contains("0.7.0")) { map_version = MAP_OTBM_4; + } ClientVersionList protocols = ClientVersion::getAllForOTBMVersion(map_version); - for(ClientVersionList::const_iterator p = protocols.begin(); p != protocols.end(); ++p) + for (ClientVersionList::const_iterator p = protocols.begin(); p != protocols.end(); ++p) { protocol_choice->Append(wxstr((*p)->getName())); + } } protocol_choice->SetSelection(0); protocol_choice->SetStringSelection(client); } -void MapPropertiesWindow::OnChangeVersion(wxCommandEvent&) -{ +void MapPropertiesWindow::OnChangeVersion(wxCommandEvent &) { UpdateProtocolList(); } -struct MapConversionContext -{ - struct MonsterInfo - { +struct MapConversionContext { + struct MonsterInfo { std::string name; Outfit outfit; }; typedef std::map MonsterMap; MonsterMap monsterType; - struct NpcInfo - { + struct NpcInfo { std::string name; Outfit outfit; }; typedef std::map NpcMap; NpcMap npcType; - void operator()(Map& map, Tile* tile, long long done) - { - if(tile->monster) { + void operator()(Map &map, Tile* tile, long long done) { + if (tile->monster) { MonsterMap::iterator f = monsterType.find(tile->monster->getName()); - if(f == monsterType.end()) { + if (f == monsterType.end()) { MonsterInfo info = { tile->monster->getName(), tile->monster->getLookType() @@ -225,9 +213,9 @@ struct MapConversionContext monsterType[tile->monster->getName()] = info; } } - if(tile->npc) { + if (tile->npc) { NpcMap::iterator f = npcType.find(tile->npc->getName()); - if(f == npcType.end()) { + if (f == npcType.end()) { NpcInfo info = { tile->npc->getName(), tile->npc->getLookType() @@ -238,29 +226,27 @@ struct MapConversionContext } }; -void MapPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) -{ - Map& map = editor.getMap(); +void MapPropertiesWindow::OnClickOK(wxCommandEvent &WXUNUSED(event)) { + Map &map = editor.getMap(); MapVersion old_ver = map.getVersion(); MapVersion new_ver; wxString ver = version_choice->GetStringSelection(); new_ver.client = ClientVersion::get(nstr(protocol_choice->GetStringSelection()))->getID(); - if(ver.Contains("0.5.0")) { + if (ver.Contains("0.5.0")) { new_ver.otbm = MAP_OTBM_1; - } else if(ver.Contains("0.6.0")) { + } else if (ver.Contains("0.6.0")) { new_ver.otbm = MAP_OTBM_2; - } else if(ver.Contains("0.6.1")) { + } else if (ver.Contains("0.6.1")) { new_ver.otbm = MAP_OTBM_3; - } else if(ver.Contains("0.7.0")) { + } else if (ver.Contains("0.7.0")) { new_ver.otbm = MAP_OTBM_4; } - if(new_ver.client != old_ver.client) { - if(g_gui.GetOpenMapCount() > 1) { - g_gui.PopupDialog(this, "Error", - "You can not change editor version with multiple maps open", wxOK); + if (new_ver.client != old_ver.client) { + if (g_gui.GetOpenMapCount() > 1) { + g_gui.PopupDialog(this, "Error", "You can not change editor version with multiple maps open", wxOK); return; } wxString error; @@ -270,10 +256,9 @@ void MapPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) g_gui.GetCurrentEditor()->getSelection().clear(); g_gui.GetCurrentEditor()->clearActions(); - if(new_ver.client < old_ver.client) { - int ret = g_gui.PopupDialog(this, "Notice", - "Converting to a previous version may have serious side-effects, are you sure you want to do this?", wxYES | wxNO); - if(ret != wxID_YES) { + if (new_ver.client < old_ver.client) { + int ret = g_gui.PopupDialog(this, "Notice", "Converting to a previous version may have serious side-effects, are you sure you want to do this?", wxYES | wxNO); + if (ret != wxID_YES) { return; } UnnamedRenderingLock(); @@ -286,7 +271,7 @@ void MapPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) map.convert(new_ver, true); // Load the new version - if(!g_gui.LoadVersion(new_ver.client, error, warnings)) { + if (!g_gui.LoadVersion(new_ver.client, error, warnings)) { g_gui.ListDialog(this, "Warnings", warnings); g_gui.PopupDialog(this, "Map Loader Error", error, wxOK); g_gui.PopupDialog(this, "Conversion Error", "Could not convert map. The map will now be closed.", wxOK); @@ -297,17 +282,18 @@ void MapPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) // Monsters // Remove all monsters that were present are present in the new version - for(MapConversionContext::MonsterMap::iterator cs = conversion_context.monsterType.begin(); cs != conversion_context.monsterType.end();) { - if(g_monsters[cs->first]) + for (MapConversionContext::MonsterMap::iterator cs = conversion_context.monsterType.begin(); cs != conversion_context.monsterType.end();) { + if (g_monsters[cs->first]) { cs = conversion_context.monsterType.erase(cs); - else + } else { ++cs; + } } - if(conversion_context.monsterType.size() > 0) { + if (conversion_context.monsterType.size() > 0) { int add = g_gui.PopupDialog(this, "Unrecognized monsters", "There were monsters on the old version that are not present in this and were on the map, do you want to add them to this version as well?", wxYES | wxNO); - if(add == wxID_YES) { - for(MapConversionContext::MonsterMap::iterator cs = conversion_context.monsterType.begin(); cs != conversion_context.monsterType.end(); ++cs) { + if (add == wxID_YES) { + for (MapConversionContext::MonsterMap::iterator cs = conversion_context.monsterType.begin(); cs != conversion_context.monsterType.end(); ++cs) { MapConversionContext::MonsterInfo info = cs->second; g_monsters.addMonsterType(info.name, info.outfit); } @@ -316,17 +302,18 @@ void MapPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) // Npcs // Remove all npcs that were present are present in the new version - for(MapConversionContext::NpcMap::iterator cs = conversion_context.npcType.begin(); cs != conversion_context.npcType.end();) { - if(g_npcs[cs->first]) + for (MapConversionContext::NpcMap::iterator cs = conversion_context.npcType.begin(); cs != conversion_context.npcType.end();) { + if (g_npcs[cs->first]) { cs = conversion_context.npcType.erase(cs); - else + } else { ++cs; + } } - if(conversion_context.npcType.size() > 0) { + if (conversion_context.npcType.size() > 0) { int add = g_gui.PopupDialog(this, "Unrecognized npcs", "There were npcs on the old version that are not present in this and were on the map, do you want to add them to this version as well?", wxYES | wxNO); - if(add == wxID_YES) { - for(MapConversionContext::NpcMap::iterator cs = conversion_context.npcType.begin(); cs != conversion_context.npcType.end(); ++cs) { + if (add == wxID_YES) { + for (MapConversionContext::NpcMap::iterator cs = conversion_context.npcType.begin(); cs != conversion_context.npcType.end(); ++cs) { MapConversionContext::NpcInfo info = cs->second; g_npcs.addNpcType(info.name, info.outfit); } @@ -334,9 +321,9 @@ void MapPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) } map.cleanInvalidTiles(true); - } else { + } else { UnnamedRenderingLock(); - if(!g_gui.LoadVersion(new_ver.client, error, warnings)) { + if (!g_gui.LoadVersion(new_ver.client, error, warnings)) { g_gui.ListDialog(this, "Warnings", warnings); g_gui.PopupDialog(this, "Map Loader Error", error, wxOK); g_gui.PopupDialog(this, "Conversion Error", "Could not convert map. The map will now be closed.", wxOK); @@ -358,7 +345,7 @@ void MapPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) // Only resize if we have to int new_map_width = width_spin->GetValue(); int new_map_height = height_spin->GetValue(); - if(new_map_width != map.getWidth() || new_map_height != map.getHeight()) { + if (new_map_width != map.getWidth() || new_map_height != map.getHeight()) { map.setWidth(new_map_width); map.setHeight(new_map_height); g_gui.FitViewToMap(view); @@ -368,8 +355,7 @@ void MapPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) EndModal(1); } -void MapPropertiesWindow::OnClickCancel(wxCommandEvent& WXUNUSED(event)) -{ +void MapPropertiesWindow::OnClickCancel(wxCommandEvent &WXUNUSED(event)) { // Just close this window EndModal(1); } @@ -380,15 +366,14 @@ MapPropertiesWindow::~MapPropertiesWindow() = default; // Map Import Window BEGIN_EVENT_TABLE(ImportMapWindow, wxDialog) - EVT_BUTTON(MAP_WINDOW_FILE_BUTTON, ImportMapWindow::OnClickBrowse) - EVT_BUTTON(wxID_OK, ImportMapWindow::OnClickOK) - EVT_BUTTON(wxID_CANCEL, ImportMapWindow::OnClickCancel) +EVT_BUTTON(MAP_WINDOW_FILE_BUTTON, ImportMapWindow::OnClickBrowse) +EVT_BUTTON(wxID_OK, ImportMapWindow::OnClickOK) +EVT_BUTTON(wxID_CANCEL, ImportMapWindow::OnClickCancel) END_EVENT_TABLE() -ImportMapWindow::ImportMapWindow(wxWindow* parent, Editor& editor) : +ImportMapWindow::ImportMapWindow(wxWindow* parent, Editor &editor) : wxDialog(parent, wxID_ANY, "Import Map", wxDefaultPosition, wxSize(420, 350)), - editor(editor) -{ + editor(editor) { wxBoxSizer* sizer = newd wxBoxSizer(wxVERTICAL); wxStaticBoxSizer* tmpsizer; @@ -459,20 +444,19 @@ ImportMapWindow::ImportMapWindow(wxWindow* parent, Editor& editor) : ImportMapWindow::~ImportMapWindow() = default; -void ImportMapWindow::OnClickBrowse(wxCommandEvent& WXUNUSED(event)) -{ +void ImportMapWindow::OnClickBrowse(wxCommandEvent &WXUNUSED(event)) { wxFileDialog dialog(this, "Import...", "", "", "*.otbm", wxFD_OPEN | wxFD_FILE_MUST_EXIST); int ok = dialog.ShowModal(); - if (ok == wxID_OK) + if (ok == wxID_OK) { file_text_field->ChangeValue(dialog.GetPath()); + } } -void ImportMapWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) -{ - if(Validate() && TransferDataFromWindow()) { +void ImportMapWindow::OnClickOK(wxCommandEvent &WXUNUSED(event)) { + if (Validate() && TransferDataFromWindow()) { wxFileName fn = file_text_field->GetValue(); - if(!fn.FileExists()) { + if (!fn.FileExists()) { g_gui.PopupDialog(this, "Error", "The specified map file doesn't exist", wxOK); return; } @@ -481,21 +465,37 @@ void ImportMapWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) ImportType spawn_npc_import_type = IMPORT_DONT; ImportType house_import_type = IMPORT_DONT; - switch(spawn_monster_options->GetSelection()) { - case 0: spawn_import_type = IMPORT_MERGE; break; - case 1: spawn_import_type = IMPORT_DONT; break; + switch (spawn_monster_options->GetSelection()) { + case 0: + spawn_import_type = IMPORT_MERGE; + break; + case 1: + spawn_import_type = IMPORT_DONT; + break; } - switch(spawn_npc_options->GetSelection()) { - case 0: spawn_npc_import_type = IMPORT_MERGE; break; - case 1: spawn_npc_import_type = IMPORT_DONT; break; + switch (spawn_npc_options->GetSelection()) { + case 0: + spawn_npc_import_type = IMPORT_MERGE; + break; + case 1: + spawn_npc_import_type = IMPORT_DONT; + break; } - switch(house_options->GetSelection()) { - case 0: house_import_type = IMPORT_SMART_MERGE; break; - case 1: house_import_type = IMPORT_MERGE; break; - case 2: house_import_type = IMPORT_INSERT; break; - case 3: house_import_type = IMPORT_DONT; break; + switch (house_options->GetSelection()) { + case 0: + house_import_type = IMPORT_SMART_MERGE; + break; + case 1: + house_import_type = IMPORT_MERGE; + break; + case 2: + house_import_type = IMPORT_INSERT; + break; + case 3: + house_import_type = IMPORT_DONT; + break; } EndModal(1); @@ -504,27 +504,24 @@ void ImportMapWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) } } -void ImportMapWindow::OnClickCancel(wxCommandEvent& WXUNUSED(event)) -{ +void ImportMapWindow::OnClickCancel(wxCommandEvent &WXUNUSED(event)) { // Just close this window EndModal(0); } - // ============================================================================ // Export Minimap window BEGIN_EVENT_TABLE(ExportMiniMapWindow, wxDialog) - EVT_BUTTON(MAP_WINDOW_FILE_BUTTON, ExportMiniMapWindow::OnClickBrowse) - EVT_BUTTON(wxID_OK, ExportMiniMapWindow::OnClickOK) - EVT_BUTTON(wxID_CANCEL, ExportMiniMapWindow::OnClickCancel) - EVT_CHOICE(wxID_ANY, ExportMiniMapWindow::OnExportTypeChange) +EVT_BUTTON(MAP_WINDOW_FILE_BUTTON, ExportMiniMapWindow::OnClickBrowse) +EVT_BUTTON(wxID_OK, ExportMiniMapWindow::OnClickOK) +EVT_BUTTON(wxID_CANCEL, ExportMiniMapWindow::OnClickCancel) +EVT_CHOICE(wxID_ANY, ExportMiniMapWindow::OnExportTypeChange) END_EVENT_TABLE() -ExportMiniMapWindow::ExportMiniMapWindow(wxWindow* parent, Editor& editor) : +ExportMiniMapWindow::ExportMiniMapWindow(wxWindow* parent, Editor &editor) : wxDialog(parent, wxID_ANY, "Export Minimap", wxDefaultPosition, wxSize(400, 300)), - editor(editor) -{ + editor(editor) { wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); wxSizer* tmpsizer; @@ -567,8 +564,9 @@ ExportMiniMapWindow::ExportMiniMapWindow(wxWindow* parent, Editor& editor) : choices.Add("Ground Floor"); choices.Add("Specific Floor"); - if (editor.hasSelection()) + if (editor.hasSelection()) { choices.Add("Selected Area"); + } // Area options tmpsizer = newd wxStaticBoxSizer(wxHORIZONTAL, this, "Area Options"); @@ -594,35 +592,30 @@ ExportMiniMapWindow::ExportMiniMapWindow(wxWindow* parent, Editor& editor) : ExportMiniMapWindow::~ExportMiniMapWindow() = default; -void ExportMiniMapWindow::OnExportTypeChange(wxCommandEvent& event) -{ +void ExportMiniMapWindow::OnExportTypeChange(wxCommandEvent &event) { floor_number->Enable(event.GetSelection() == 2); } -void ExportMiniMapWindow::OnClickBrowse(wxCommandEvent& WXUNUSED(event)) -{ +void ExportMiniMapWindow::OnClickBrowse(wxCommandEvent &WXUNUSED(event)) { wxDirDialog dialog(NULL, "Select the output folder", "", wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST); - if(dialog.ShowModal() == wxID_OK) { - const wxString& directory = dialog.GetPath(); + if (dialog.ShowModal() == wxID_OK) { + const wxString &directory = dialog.GetPath(); directory_text_field->ChangeValue(directory); } CheckValues(); } -void ExportMiniMapWindow::OnDirectoryChanged(wxKeyEvent& event) -{ +void ExportMiniMapWindow::OnDirectoryChanged(wxKeyEvent &event) { CheckValues(); event.Skip(); } -void ExportMiniMapWindow::OnFileNameChanged(wxKeyEvent& event) -{ +void ExportMiniMapWindow::OnFileNameChanged(wxKeyEvent &event) { CheckValues(); event.Skip(); } -void ExportMiniMapWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) -{ +void ExportMiniMapWindow::OnClickOK(wxCommandEvent &WXUNUSED(event)) { g_gui.CreateLoadBar("Exporting minimap..."); auto format = static_cast(format_options->GetSelection()); @@ -642,15 +635,13 @@ void ExportMiniMapWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) EndModal(wxID_OK); } -void ExportMiniMapWindow::OnClickCancel(wxCommandEvent& WXUNUSED(event)) -{ +void ExportMiniMapWindow::OnClickCancel(wxCommandEvent &WXUNUSED(event)) { // Just close this window EndModal(wxID_CANCEL); } -void ExportMiniMapWindow::CheckValues() -{ - if(directory_text_field->IsEmpty()) { +void ExportMiniMapWindow::CheckValues() { + if (directory_text_field->IsEmpty()) { error_field->SetLabel("Type or select an output folder."); ok_button->Enable(false); return; @@ -684,13 +675,11 @@ void ExportMiniMapWindow::CheckValues() // Numkey forwarding text control BEGIN_EVENT_TABLE(KeyForwardingTextCtrl, wxTextCtrl) - EVT_KEY_DOWN(KeyForwardingTextCtrl::OnKeyDown) +EVT_KEY_DOWN(KeyForwardingTextCtrl::OnKeyDown) END_EVENT_TABLE() -void KeyForwardingTextCtrl::OnKeyDown(wxKeyEvent& event) -{ - if(event.GetKeyCode() == WXK_UP || event.GetKeyCode() == WXK_DOWN || - event.GetKeyCode() == WXK_PAGEDOWN || event.GetKeyCode() == WXK_PAGEUP) { +void KeyForwardingTextCtrl::OnKeyDown(wxKeyEvent &event) { + if (event.GetKeyCode() == WXK_UP || event.GetKeyCode() == WXK_DOWN || event.GetKeyCode() == WXK_PAGEDOWN || event.GetKeyCode() == WXK_PAGEUP) { GetParent()->GetEventHandler()->AddPendingEvent(event); } else { event.Skip(); @@ -701,21 +690,20 @@ void KeyForwardingTextCtrl::OnKeyDown(wxKeyEvent& event) // Find Item Dialog (Jump to item) BEGIN_EVENT_TABLE(FindDialog, wxDialog) - EVT_TIMER(wxID_ANY, FindDialog::OnTextIdle) - EVT_TEXT(JUMP_DIALOG_TEXT, FindDialog::OnTextChange) - EVT_KEY_DOWN(FindDialog::OnKeyDown) - EVT_TEXT_ENTER(JUMP_DIALOG_TEXT, FindDialog::OnClickOK) - EVT_LISTBOX_DCLICK(JUMP_DIALOG_LIST, FindDialog::OnClickList) - EVT_BUTTON(wxID_OK, FindDialog::OnClickOK) - EVT_BUTTON(wxID_CANCEL, FindDialog::OnClickCancel) +EVT_TIMER(wxID_ANY, FindDialog::OnTextIdle) +EVT_TEXT(JUMP_DIALOG_TEXT, FindDialog::OnTextChange) +EVT_KEY_DOWN(FindDialog::OnKeyDown) +EVT_TEXT_ENTER(JUMP_DIALOG_TEXT, FindDialog::OnClickOK) +EVT_LISTBOX_DCLICK(JUMP_DIALOG_LIST, FindDialog::OnClickList) +EVT_BUTTON(wxID_OK, FindDialog::OnClickOK) +EVT_BUTTON(wxID_CANCEL, FindDialog::OnClickCancel) END_EVENT_TABLE() FindDialog::FindDialog(wxWindow* parent, wxString title) : wxDialog(g_gui.root, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX), idle_input_timer(this), result_brush(nullptr), - result_id(0) -{ + result_id(0) { wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); search_field = newd KeyForwardingTextCtrl(this, JUMP_DIALOG_TEXT, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); @@ -739,25 +727,25 @@ FindDialog::FindDialog(wxWindow* parent, wxString title) : FindDialog::~FindDialog() = default; -void FindDialog::OnKeyDown(wxKeyEvent& event) -{ +void FindDialog::OnKeyDown(wxKeyEvent &event) { int w, h; item_list->GetSize(&w, &h); size_t amount = 1; - switch(event.GetKeyCode()) { + switch (event.GetKeyCode()) { case WXK_PAGEUP: amount = h / 32 + 1; [[fallthrough]]; case WXK_UP: { - if(item_list->GetItemCount() > 0) { + if (item_list->GetItemCount() > 0) { ssize_t n = item_list->GetSelection(); - if(n == wxNOT_FOUND) + if (n == wxNOT_FOUND) { n = 0; - else if(n != amount && n - amount < n) // latter is needed for unsigned overflow + } else if (n != amount && n - amount < n) { // latter is needed for unsigned overflow n -= amount; - else + } else { n = 0; + } item_list->SetSelection(n); } break; @@ -767,15 +755,16 @@ void FindDialog::OnKeyDown(wxKeyEvent& event) amount = h / 32 + 1; [[fallthrough]]; case WXK_DOWN: { - if(item_list->GetItemCount() > 0) { + if (item_list->GetItemCount() > 0) { ssize_t n = item_list->GetSelection(); size_t itemcount = item_list->GetItemCount(); - if(n == wxNOT_FOUND) + if (n == wxNOT_FOUND) { n = 0; - else if(static_cast(n) < itemcount - amount && itemcount - amount < itemcount) + } else if (static_cast(n) < itemcount - amount && itemcount - amount < itemcount) { n += amount; - else + } else { n = item_list->GetItemCount() - 1; + } item_list->SetSelection(n); } @@ -787,34 +776,28 @@ void FindDialog::OnKeyDown(wxKeyEvent& event) } } -void FindDialog::OnTextIdle(wxTimerEvent& WXUNUSED(event)) -{ +void FindDialog::OnTextIdle(wxTimerEvent &WXUNUSED(event)) { RefreshContents(); } -void FindDialog::OnTextChange(wxCommandEvent& WXUNUSED(event)) -{ +void FindDialog::OnTextChange(wxCommandEvent &WXUNUSED(event)) { idle_input_timer.Start(800, true); } -void FindDialog::OnClickList(wxCommandEvent& event) -{ +void FindDialog::OnClickList(wxCommandEvent &event) { OnClickListInternal(event); } -void FindDialog::OnClickOK(wxCommandEvent& WXUNUSED(event)) -{ +void FindDialog::OnClickOK(wxCommandEvent &WXUNUSED(event)) { // This is to get virtual callback OnClickOKInternal(); } -void FindDialog::OnClickCancel(wxCommandEvent& WXUNUSED(event)) -{ +void FindDialog::OnClickCancel(wxCommandEvent &WXUNUSED(event)) { EndModal(0); } -void FindDialog::RefreshContents() -{ +void FindDialog::RefreshContents() { // This is to get virtual callback RefreshContentsInternal(); } @@ -822,46 +805,46 @@ void FindDialog::RefreshContents() // ============================================================================ // Find Brush Dialog (Jump to brush) -FindBrushDialog::FindBrushDialog(wxWindow* parent, wxString title) : FindDialog(parent, title) -{ +FindBrushDialog::FindBrushDialog(wxWindow* parent, wxString title) : + FindDialog(parent, title) { RefreshContents(); } FindBrushDialog::~FindBrushDialog() = default; -void FindBrushDialog::OnClickListInternal(wxCommandEvent& event) -{ +void FindBrushDialog::OnClickListInternal(wxCommandEvent &event) { Brush* brush = item_list->GetSelectedBrush(); - if(brush) { + if (brush) { result_brush = brush; EndModal(1); } } -void FindBrushDialog::OnClickOKInternal() -{ +void FindBrushDialog::OnClickOKInternal() { // This is kind of stupid as it would fail unless the "Please enter a search string" wasn't there - if(item_list->GetItemCount() > 0) { - if(item_list->GetSelection() == wxNOT_FOUND) { + if (item_list->GetItemCount() > 0) { + if (item_list->GetSelection() == wxNOT_FOUND) { item_list->SetSelection(0); } Brush* brush = item_list->GetSelectedBrush(); - if(!brush) { + if (!brush) { // It's either "Please enter a search string" or "No matches" // Perhaps we can refresh now? std::string search_string = as_lower_str(nstr(search_field->GetValue())); bool do_search = (search_string.size() >= 2); - if(do_search) { - const BrushMap& map = g_brushes.getMap(); - for(BrushMap::const_iterator iter = map.begin(); iter != map.end(); ++iter) { + if (do_search) { + const BrushMap &map = g_brushes.getMap(); + for (BrushMap::const_iterator iter = map.begin(); iter != map.end(); ++iter) { const Brush* brush = iter->second; - if(as_lower_str(brush->getName()).find(search_string) == std::string::npos) + if (as_lower_str(brush->getName()).find(search_string) == std::string::npos) { continue; + } // Don't match RAWs now. - if(brush->isRaw()) + if (brush->isRaw()) { continue; + } // Found one! result_brush = brush; @@ -869,19 +852,22 @@ void FindBrushDialog::OnClickOKInternal() } // Did we not find a matching brush? - if(!result_brush) { + if (!result_brush) { // Then let's search the RAWs - for(int id = 0; id <= g_items.getMaxID(); ++id) { - const ItemType& type = g_items.getItemType(id); - if(type.id == 0) + for (int id = 0; id <= g_items.getMaxID(); ++id) { + const ItemType &type = g_items.getItemType(id); + if (type.id == 0) { continue; + } RAWBrush* raw_brush = type.raw_brush; - if(!raw_brush) + if (!raw_brush) { continue; + } - if(as_lower_str(raw_brush->getName()).find(search_string) == std::string::npos) + if (as_lower_str(raw_brush->getName()).find(search_string) == std::string::npos) { continue; + } // Found one! result_brush = raw_brush; @@ -897,62 +883,65 @@ void FindBrushDialog::OnClickOKInternal() EndModal(1); } -void FindBrushDialog::RefreshContentsInternal() -{ +void FindBrushDialog::RefreshContentsInternal() { item_list->Clear(); std::string search_string = as_lower_str(nstr(search_field->GetValue())); bool do_search = (search_string.size() >= 2); - if(do_search) { + if (do_search) { bool found_search_results = false; - const BrushMap& brushes_map = g_brushes.getMap(); + const BrushMap &brushes_map = g_brushes.getMap(); // We store the raws so they display last of all results std::deque raws; - for(BrushMap::const_iterator iter = brushes_map.begin(); iter != brushes_map.end(); ++iter) { + for (BrushMap::const_iterator iter = brushes_map.begin(); iter != brushes_map.end(); ++iter) { const Brush* brush = iter->second; - if(as_lower_str(brush->getName()).find(search_string) == std::string::npos) + if (as_lower_str(brush->getName()).find(search_string) == std::string::npos) { continue; + } - if(brush->isRaw()) + if (brush->isRaw()) { continue; + } found_search_results = true; item_list->AddBrush(const_cast(brush)); } - for(int id = 0; id <= g_items.getMaxID(); ++id) { - const ItemType& type = g_items.getItemType(id); - if(type.id == 0) + for (int id = 0; id <= g_items.getMaxID(); ++id) { + const ItemType &type = g_items.getItemType(id); + if (type.id == 0) { continue; + } RAWBrush* raw_brush = type.raw_brush; - if(!raw_brush) + if (!raw_brush) { continue; + } - if(as_lower_str(raw_brush->getName()).find(search_string) == std::string::npos) + if (as_lower_str(raw_brush->getName()).find(search_string) == std::string::npos) { continue; + } found_search_results = true; item_list->AddBrush(raw_brush); } - while(raws.size() > 0) { + while (raws.size() > 0) { item_list->AddBrush(const_cast(raws.front())); raws.pop_front(); } - if(found_search_results) { + if (found_search_results) { item_list->SetSelection(0); } else { item_list->SetNoMatches(); } - } item_list->Refresh(); } @@ -963,36 +952,32 @@ void FindBrushDialog::RefreshContentsInternal() FindDialogListBox::FindDialogListBox(wxWindow* parent, wxWindowID id) : wxVListBox(parent, id, wxDefaultPosition, wxDefaultSize, wxLB_SINGLE), cleared(false), - no_matches(false) -{ + no_matches(false) { Clear(); } -FindDialogListBox::~FindDialogListBox() -{ +FindDialogListBox::~FindDialogListBox() { //// } -void FindDialogListBox::Clear() -{ +void FindDialogListBox::Clear() { cleared = true; no_matches = false; brushlist.clear(); SetItemCount(1); } -void FindDialogListBox::SetNoMatches() -{ +void FindDialogListBox::SetNoMatches() { cleared = false; no_matches = true; brushlist.clear(); SetItemCount(1); } -void FindDialogListBox::AddBrush(Brush* brush) -{ - if(cleared || no_matches) +void FindDialogListBox::AddBrush(Brush* brush) { + if (cleared || no_matches) { SetItemCount(0); + } cleared = false; no_matches = false; @@ -1001,32 +986,32 @@ void FindDialogListBox::AddBrush(Brush* brush) brushlist.push_back(brush); } -Brush* FindDialogListBox::GetSelectedBrush() -{ +Brush* FindDialogListBox::GetSelectedBrush() { ssize_t n = GetSelection(); - if(n == wxNOT_FOUND || no_matches || cleared) + if (n == wxNOT_FOUND || no_matches || cleared) { return nullptr; + } return brushlist[n]; } -void FindDialogListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const -{ - if(no_matches) { +void FindDialogListBox::OnDrawItem(wxDC &dc, const wxRect &rect, size_t n) const { + if (no_matches) { dc.DrawText("No matches for your search.", rect.GetX() + 40, rect.GetY() + 6); - } else if(cleared) { + } else if (cleared) { dc.DrawText("Please enter your search string.", rect.GetX() + 40, rect.GetY() + 6); } else { ASSERT(n < brushlist.size()); Sprite* spr = g_gui.gfx.getSprite(brushlist[n]->getLookID()); - if(spr) { + if (spr) { spr->DrawTo(&dc, SPRITE_SIZE_32x32, rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight()); } - if(IsSelected(n)) { - if(HasFocus()) + if (IsSelected(n)) { + if (HasFocus()) { dc.SetTextForeground(wxColor(0xFF, 0xFF, 0xFF)); - else + } else { dc.SetTextForeground(wxColor(0x00, 0x00, 0xFF)); + } } else { dc.SetTextForeground(wxColor(0x00, 0x00, 0x00)); } @@ -1035,24 +1020,23 @@ void FindDialogListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const } } -wxCoord FindDialogListBox::OnMeasureItem(size_t n) const -{ +wxCoord FindDialogListBox::OnMeasureItem(size_t n) const { return 32; } // ============================================================================ // wxListBox that can be sorted -SortableListBox::SortableListBox(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size) -: wxListBox(parent, id, pos, size, 0, nullptr, wxLB_SINGLE | wxLB_NEEDED_SB) -{} +SortableListBox::SortableListBox(wxWindow* parent, wxWindowID id, const wxPoint &pos, const wxSize &size) : + wxListBox(parent, id, pos, size, 0, nullptr, wxLB_SINGLE | wxLB_NEEDED_SB) { } -SortableListBox::~SortableListBox() {} +SortableListBox::~SortableListBox() { } void SortableListBox::Sort() { - if (GetCount() == 0) + if (GetCount() == 0) { return; + } wxASSERT_MSG(GetClientDataType() != wxClientData_Object, "Sorting a list with data of type wxClientData_Object is currently not implemented"); @@ -1069,11 +1053,12 @@ void SortableListBox::DoSort() { for (size_t i = 0; i < count; ++i) { stringList.Add(GetString(i)); - if (dataType == wxClientData_Void) + if (dataType == wxClientData_Void) { dataList.Add(GetClientData(i)); + } } - //Insertion sort + // Insertion sort for (size_t i = 0; i < count; ++i) { size_t j = i; while (j > 0 && stringList[j].CmpNoCase(stringList[j - 1]) < 0) { @@ -1088,9 +1073,9 @@ void SortableListBox::DoSort() { dataList[j - 1] = tmpData; } - if (selection == j - 1) + if (selection == j - 1) { selection++; - else if (selection == j) { + } else if (selection == j) { selection--; } @@ -1101,10 +1086,11 @@ void SortableListBox::DoSort() { Freeze(); Clear(); for (size_t i = 0; i < count; ++i) { - if (dataType == wxClientData_Void) + if (dataType == wxClientData_Void) { Append(stringList[i], dataList[i]); - else + } else { Append(stringList[i]); + } } Thaw(); @@ -1115,77 +1101,66 @@ void SortableListBox::DoSort() { // Object properties base ObjectPropertiesWindowBase::ObjectPropertiesWindowBase(wxWindow* parent, wxString title, const Map* map, const Tile* tile, Item* item, wxPoint position /* = wxDefaultPosition */) : -wxDialog(parent, wxID_ANY, title, - position, wxSize(600, 400), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER), + wxDialog(parent, wxID_ANY, title, position, wxSize(600, 400), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER), edit_map(map), edit_tile(tile), edit_item(item), edit_monster(nullptr), edit_spawn_monster(nullptr), edit_npc(nullptr), - edit_spawn_npc(nullptr) -{ + edit_spawn_npc(nullptr) { //// } ObjectPropertiesWindowBase::ObjectPropertiesWindowBase(wxWindow* parent, wxString title, const Map* map, const Tile* tile, Monster* monster, wxPoint position /* = wxDefaultPosition */) : -wxDialog(parent, wxID_ANY, title, - position, wxSize(600, 400), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER), + wxDialog(parent, wxID_ANY, title, position, wxSize(600, 400), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER), edit_map(map), edit_tile(tile), edit_item(nullptr), edit_monster(monster), edit_spawn_monster(nullptr), edit_npc(nullptr), - edit_spawn_npc(nullptr) -{ + edit_spawn_npc(nullptr) { //// } ObjectPropertiesWindowBase::ObjectPropertiesWindowBase(wxWindow* parent, wxString title, const Map* map, const Tile* tile, SpawnMonster* spawnMonster, wxPoint position /* = wxDefaultPosition */) : -wxDialog(parent, wxID_ANY, title, - position, wxSize(600, 400), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER), + wxDialog(parent, wxID_ANY, title, position, wxSize(600, 400), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER), edit_map(map), edit_tile(tile), edit_item(nullptr), edit_monster(nullptr), edit_spawn_monster(spawnMonster), edit_npc(nullptr), - edit_spawn_npc(nullptr) -{ + edit_spawn_npc(nullptr) { //// } ObjectPropertiesWindowBase::ObjectPropertiesWindowBase(wxWindow* parent, wxString title, const Map* map, const Tile* tile, Npc* npc, wxPoint position /* = wxDefaultPosition */) : -wxDialog(parent, wxID_ANY, title, - position, wxSize(600, 400), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER), + wxDialog(parent, wxID_ANY, title, position, wxSize(600, 400), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER), edit_map(map), edit_tile(tile), edit_item(nullptr), edit_monster(nullptr), edit_spawn_monster(nullptr), edit_npc(npc), - edit_spawn_npc(nullptr) -{ + edit_spawn_npc(nullptr) { //// } ObjectPropertiesWindowBase::ObjectPropertiesWindowBase(wxWindow* parent, wxString title, const Map* map, const Tile* tile, SpawnNpc* spawnNpc, wxPoint position /* = wxDefaultPosition */) : -wxDialog(parent, wxID_ANY, title, - position, wxSize(600, 400), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER), + wxDialog(parent, wxID_ANY, title, position, wxSize(600, 400), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER), edit_map(map), edit_tile(tile), edit_item(nullptr), edit_monster(nullptr), edit_spawn_monster(nullptr), edit_npc(nullptr), - edit_spawn_npc(spawnNpc) -{ + edit_spawn_npc(spawnNpc) { //// } -Item* ObjectPropertiesWindowBase::getItemBeingEdited() -{ +Item* ObjectPropertiesWindowBase::getItemBeingEdited() { return edit_item; } @@ -1193,29 +1168,28 @@ Item* ObjectPropertiesWindowBase::getItemBeingEdited() // Edit Towns Dialog BEGIN_EVENT_TABLE(EditTownsDialog, wxDialog) - EVT_LISTBOX(EDIT_TOWNS_LISTBOX, EditTownsDialog::OnListBoxChange) +EVT_LISTBOX(EDIT_TOWNS_LISTBOX, EditTownsDialog::OnListBoxChange) - EVT_BUTTON(EDIT_TOWNS_SELECT_TEMPLE, EditTownsDialog::OnClickSelectTemplePosition) - EVT_BUTTON(EDIT_TOWNS_ADD, EditTownsDialog::OnClickAdd) - EVT_BUTTON(EDIT_TOWNS_REMOVE, EditTownsDialog::OnClickRemove) - EVT_BUTTON(wxID_OK, EditTownsDialog::OnClickOK) - EVT_BUTTON(wxID_CANCEL, EditTownsDialog::OnClickCancel) +EVT_BUTTON(EDIT_TOWNS_SELECT_TEMPLE, EditTownsDialog::OnClickSelectTemplePosition) +EVT_BUTTON(EDIT_TOWNS_ADD, EditTownsDialog::OnClickAdd) +EVT_BUTTON(EDIT_TOWNS_REMOVE, EditTownsDialog::OnClickRemove) +EVT_BUTTON(wxID_OK, EditTownsDialog::OnClickOK) +EVT_BUTTON(wxID_CANCEL, EditTownsDialog::OnClickCancel) END_EVENT_TABLE() -EditTownsDialog::EditTownsDialog(wxWindow* parent, Editor& editor) : - wxDialog(parent, wxID_ANY, "Towns", wxDefaultPosition, wxSize(280,330)), - editor(editor) -{ - const Map& map = editor.getMap(); +EditTownsDialog::EditTownsDialog(wxWindow* parent, Editor &editor) : + wxDialog(parent, wxID_ANY, "Towns", wxDefaultPosition, wxSize(280, 330)), + editor(editor) { + const Map &map = editor.getMap(); // Create topsizer wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); wxSizer* tmpsizer; - for(TownMap::const_iterator town_iter = map.towns.begin(); town_iter != map.towns.end(); ++town_iter) { + for (TownMap::const_iterator town_iter = map.towns.begin(); town_iter != map.towns.end(); ++town_iter) { Town* town = town_iter->second; town_list.push_back(newd Town(*town)); - if(max_town_id < town->getID()) { + if (max_town_id < town->getID()) { max_town_id = town->getID(); } } @@ -1231,10 +1205,10 @@ EditTownsDialog::EditTownsDialog(wxWindow* parent, Editor& editor) : // House options tmpsizer = newd wxStaticBoxSizer(wxHORIZONTAL, this, "Name / ID"); - name_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(190,20), 0, wxTextValidator(wxFILTER_ASCII, &town_name)); + name_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(190, 20), 0, wxTextValidator(wxFILTER_ASCII, &town_name)); tmpsizer->Add(name_field, 2, wxEXPAND | wxLEFT | wxBOTTOM, 5); - id_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(40,20), 0, wxTextValidator(wxFILTER_NUMERIC, &town_id)); + id_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(40, 20), 0, wxTextValidator(wxFILTER_NUMERIC, &town_id)); id_field->Enable(false); tmpsizer->Add(id_field, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); sizer->Add(tmpsizer, 0, wxEXPAND | wxALL, 10); @@ -1256,35 +1230,33 @@ EditTownsDialog::EditTownsDialog(wxWindow* parent, Editor& editor) : BuildListBox(true); } -EditTownsDialog::~EditTownsDialog() -{ - for(std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { +EditTownsDialog::~EditTownsDialog() { + for (std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { delete *town_iter; } } -void EditTownsDialog::BuildListBox(bool doselect) -{ +void EditTownsDialog::BuildListBox(bool doselect) { long tmplong = 0; max_town_id = 0; wxArrayString town_name_list; uint32_t selection_before = 0; - if(doselect && id_field->GetValue().ToLong(&tmplong)) { + if (doselect && id_field->GetValue().ToLong(&tmplong)) { uint32_t old_town_id = tmplong; - for(std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { - if(old_town_id == (*town_iter)->getID()) { + for (std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { + if (old_town_id == (*town_iter)->getID()) { selection_before = (*town_iter)->getID(); break; } } } - for(std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { + for (std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { Town* town = *town_iter; town_name_list.Add(wxstr(town->getName())); - if(max_town_id < town->getID()) { + if (max_town_id < town->getID()) { max_town_id = town->getID(); } } @@ -1293,11 +1265,11 @@ void EditTownsDialog::BuildListBox(bool doselect) remove_button->Enable(town_listbox->GetCount() != 0); select_position_button->Enable(false); - if(doselect) { - if(selection_before) { + if (doselect) { + if (selection_before) { int i = 0; - for(std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { - if(selection_before == (*town_iter)->getID()) { + for (std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { + if (selection_before == (*town_iter)->getID()) { town_listbox->SetSelection(i); return; } @@ -1308,36 +1280,35 @@ void EditTownsDialog::BuildListBox(bool doselect) } } -void EditTownsDialog::UpdateSelection(int new_selection) -{ +void EditTownsDialog::UpdateSelection(int new_selection) { long tmplong; // Save old values - if(town_list.size() > 0) { - if(id_field->GetValue().ToLong(&tmplong)) { + if (town_list.size() > 0) { + if (id_field->GetValue().ToLong(&tmplong)) { uint32_t old_town_id = tmplong; Town* old_town = nullptr; - for(std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { - if(old_town_id == (*town_iter)->getID()) { + for (std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { + if (old_town_id == (*town_iter)->getID()) { old_town = *town_iter; break; } } - if(old_town) { + if (old_town) { Position templepos = temple_position->GetPosition(); - //printf("Changed town %d:%s\n", old_town_id, old_town->getName().c_str()); - //printf("New values %d:%s:%d:%d:%d\n", town_id, town_name.c_str(), templepos.x, templepos.y, templepos.z); + // printf("Changed town %d:%s\n", old_town_id, old_town->getName().c_str()); + // printf("New values %d:%s:%d:%d:%d\n", town_id, town_name.c_str(), templepos.x, templepos.y, templepos.z); old_town->setTemplePosition(templepos); wxString new_name = name_field->GetValue(); wxString old_name = wxstr(old_town->getName()); old_town->setName(nstr(new_name)); - if(new_name != old_name) { + if (new_name != old_name) { // Name has changed, update list BuildListBox(false); } @@ -1349,7 +1320,7 @@ void EditTownsDialog::UpdateSelection(int new_selection) town_name.Clear(); town_id.Clear(); - if(town_list.size() > size_t(new_selection)) { + if (town_list.size() > size_t(new_selection)) { name_field->Enable(true); temple_position->Enable(true); select_position_button->Enable(true); @@ -1358,7 +1329,7 @@ void EditTownsDialog::UpdateSelection(int new_selection) Town* town = town_list[new_selection]; ASSERT(town); - //printf("Selected %d:%s\n", new_selection, town->getName().c_str()); + // printf("Selected %d:%s\n", new_selection, town->getName().c_str()); town_name << wxstr(town->getName()); name_field->SetValue(town_name); town_id << long(town->getID()); @@ -1373,33 +1344,29 @@ void EditTownsDialog::UpdateSelection(int new_selection) Refresh(); } -void EditTownsDialog::OnListBoxChange(wxCommandEvent& event) -{ +void EditTownsDialog::OnListBoxChange(wxCommandEvent &event) { UpdateSelection(event.GetSelection()); } -void EditTownsDialog::OnClickSelectTemplePosition(wxCommandEvent& WXUNUSED(event)) -{ +void EditTownsDialog::OnClickSelectTemplePosition(wxCommandEvent &WXUNUSED(event)) { Position templepos = temple_position->GetPosition(); g_gui.SetScreenCenterPosition(templepos); } -void EditTownsDialog::OnClickAdd(wxCommandEvent& WXUNUSED(event)) -{ +void EditTownsDialog::OnClickAdd(wxCommandEvent &WXUNUSED(event)) { Town* new_town = newd Town(++max_town_id); new_town->setName("Unnamed Town"); - new_town->setTemplePosition(Position(0,0,0)); + new_town->setTemplePosition(Position(0, 0, 0)); town_list.push_back(new_town); BuildListBox(false); - UpdateSelection(town_list.size()-1); - town_listbox->SetSelection(town_list.size()-1); + UpdateSelection(town_list.size() - 1); + town_listbox->SetSelection(town_list.size() - 1); } -void EditTownsDialog::OnClickRemove(wxCommandEvent& WXUNUSED(event)) -{ +void EditTownsDialog::OnClickRemove(wxCommandEvent &WXUNUSED(event)) { long tmplong; - if(id_field->GetValue().ToLong(&tmplong)) { + if (id_field->GetValue().ToLong(&tmplong)) { uint32_t old_town_id = tmplong; Town* town = nullptr; @@ -1407,19 +1374,21 @@ void EditTownsDialog::OnClickRemove(wxCommandEvent& WXUNUSED(event)) std::vector::iterator town_iter = town_list.begin(); int selection_index = 0; - while(town_iter != town_list.end()) { - if(old_town_id == (*town_iter)->getID()) { + while (town_iter != town_list.end()) { + if (old_town_id == (*town_iter)->getID()) { town = *town_iter; break; } ++selection_index; ++town_iter; } - if(!town) return; + if (!town) { + return; + } - const Map& map = editor.getMap(); - for(const auto& pair : map.houses) { - if(pair.second->townid == town->getID()) { + const Map &map = editor.getMap(); + for (const auto &pair : map.houses) { + if (pair.second->townid == town->getID()) { g_gui.PopupDialog(this, "Error", "You cannot delete a town which still has houses associated with it.", wxOK); return; } @@ -1428,58 +1397,55 @@ void EditTownsDialog::OnClickRemove(wxCommandEvent& WXUNUSED(event)) delete town; town_list.erase(town_iter); BuildListBox(false); - UpdateSelection(selection_index-1); + UpdateSelection(selection_index - 1); } } -void EditTownsDialog::OnClickOK(wxCommandEvent& WXUNUSED(event)) -{ +void EditTownsDialog::OnClickOK(wxCommandEvent &WXUNUSED(event)) { long tmplong = 0; - if(Validate() && TransferDataFromWindow()) { + if (Validate() && TransferDataFromWindow()) { // Save old values - if(town_list.size() > 0 && id_field->GetValue().ToLong(&tmplong)) { + if (town_list.size() > 0 && id_field->GetValue().ToLong(&tmplong)) { uint32_t old_town_id = tmplong; Town* old_town = nullptr; - for(std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { - if(old_town_id == (*town_iter)->getID()) { + for (std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { + if (old_town_id == (*town_iter)->getID()) { old_town = *town_iter; break; } } - if(old_town) { + if (old_town) { Position templepos = temple_position->GetPosition(); - //printf("Changed town %d:%s\n", old_town_id, old_town->getName().c_str()); - //printf("New values %d:%s:%d:%d:%d\n", town_id, town_name.c_str(), templepos.x, templepos.y, templepos.z); + // printf("Changed town %d:%s\n", old_town_id, old_town->getName().c_str()); + // printf("New values %d:%s:%d:%d:%d\n", town_id, town_name.c_str(), templepos.x, templepos.y, templepos.z); old_town->setTemplePosition(templepos); wxString new_name = name_field->GetValue(); wxString old_name = wxstr(old_town->getName()); old_town->setName(nstr(new_name)); - if(new_name != old_name) { + if (new_name != old_name) { // Name has changed, update list BuildListBox(true); } } } - Towns& towns = editor.getMap().towns; + Towns &towns = editor.getMap().towns; // Verify the newd information - for(std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { + for (std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { Town* town = *town_iter; - if(town->getName() == "") { + if (town->getName() == "") { g_gui.PopupDialog(this, "Error", "You can't have a town with an empty name.", wxOK); return; } - if(!town->getTemplePosition().isValid() || - town->getTemplePosition().x > editor.getMap().getWidth() || - town->getTemplePosition().y > editor.getMap().getHeight()) { + if (!town->getTemplePosition().isValid() || town->getTemplePosition().x > editor.getMap().getWidth() || town->getTemplePosition().y > editor.getMap().getHeight()) { wxString msg; msg << "The town " << wxstr(town->getName()) << " has an invalid temple position."; g_gui.PopupDialog(this, "Error", msg, wxOK); @@ -1491,7 +1457,7 @@ void EditTownsDialog::OnClickOK(wxCommandEvent& WXUNUSED(event)) towns.clear(); // Build the newd town map - for(std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { + for (std::vector::iterator town_iter = town_list.begin(); town_iter != town_list.end(); ++town_iter) { towns.addTown(*town_iter); } town_list.clear(); @@ -1502,8 +1468,7 @@ void EditTownsDialog::OnClickOK(wxCommandEvent& WXUNUSED(event)) } } -void EditTownsDialog::OnClickCancel(wxCommandEvent& WXUNUSED(event)) -{ +void EditTownsDialog::OnClickCancel(wxCommandEvent &WXUNUSED(event)) { // Just close this window EndModal(0); } @@ -1513,15 +1478,14 @@ void EditTownsDialog::OnClickCancel(wxCommandEvent& WXUNUSED(event)) // Jump to a position on the map by entering XYZ coordinates BEGIN_EVENT_TABLE(GotoPositionDialog, wxDialog) - EVT_BUTTON(wxID_OK, GotoPositionDialog::OnClickOK) - EVT_BUTTON(wxID_CANCEL, GotoPositionDialog::OnClickCancel) +EVT_BUTTON(wxID_OK, GotoPositionDialog::OnClickOK) +EVT_BUTTON(wxID_CANCEL, GotoPositionDialog::OnClickCancel) END_EVENT_TABLE() -GotoPositionDialog::GotoPositionDialog(wxWindow* parent, Editor& editor) : +GotoPositionDialog::GotoPositionDialog(wxWindow* parent, Editor &editor) : wxDialog(parent, wxID_ANY, "Go To Position", wxDefaultPosition, wxDefaultSize), - editor(editor) -{ - const Map& map = editor.getMap(); + editor(editor) { + const Map &map = editor.getMap(); // create topsizer wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); @@ -1539,13 +1503,11 @@ GotoPositionDialog::GotoPositionDialog(wxWindow* parent, Editor& editor) : Centre(wxBOTH); } -void GotoPositionDialog::OnClickCancel(wxCommandEvent &) -{ +void GotoPositionDialog::OnClickCancel(wxCommandEvent &) { EndModal(0); } -void GotoPositionDialog::OnClickOK(wxCommandEvent &) -{ +void GotoPositionDialog::OnClickOK(wxCommandEvent &) { g_gui.SetScreenCenterPosition(posctrl->GetPosition()); EndModal(1); } diff --git a/source/common_windows.h b/source/common_windows.h index 2cd0fff2..47ad61cd 100644 --- a/source/common_windows.h +++ b/source/common_windows.h @@ -29,45 +29,42 @@ class MapTab; /** * A toggle button with an item on it. */ -class ItemToggleButton : public DCButton -{ +class ItemToggleButton : public DCButton { public: ItemToggleButton(wxWindow* parent, RenderSize size, int lookid, wxWindowID id = wxID_ANY) : - DCButton(parent, id, wxDefaultPosition, DC_BTN_TOGGLE, size, lookid) {} - virtual ~ItemToggleButton() {} + DCButton(parent, id, wxDefaultPosition, DC_BTN_TOGGLE, size, lookid) { } + virtual ~ItemToggleButton() { } }; /** * A button with an item on it. */ -class ItemButton : public DCButton -{ +class ItemButton : public DCButton { public: ItemButton(wxWindow* parent, RenderSize size, uint16_t lookid, wxWindowID id = wxID_ANY) : - DCButton(parent, id, wxDefaultPosition, DC_BTN_NORMAL, size, lookid) {} - virtual ~ItemButton() {} + DCButton(parent, id, wxDefaultPosition, DC_BTN_NORMAL, size, lookid) { } + virtual ~ItemButton() { } }; /** * The map properties window * Change map size, protocol etc. */ -class MapPropertiesWindow : public wxDialog -{ +class MapPropertiesWindow : public wxDialog { public: - MapPropertiesWindow(wxWindow* parent, MapTab* tab, Editor& editor); + MapPropertiesWindow(wxWindow* parent, MapTab* tab, Editor &editor); virtual ~MapPropertiesWindow(); - void OnChangeVersion(wxCommandEvent&); + void OnChangeVersion(wxCommandEvent &); - void OnClickOK(wxCommandEvent&); - void OnClickCancel(wxCommandEvent&); + void OnClickOK(wxCommandEvent &); + void OnClickCancel(wxCommandEvent &); protected: void UpdateProtocolList(); MapTab* view; - Editor& editor; + Editor &editor; wxSpinCtrl* height_spin; wxSpinCtrl* width_spin; wxChoice* version_choice; @@ -84,17 +81,17 @@ class MapPropertiesWindow : public wxDialog * The import map dialog * Allows selection of file path, offset and some weird options. */ -class ImportMapWindow : public wxDialog -{ +class ImportMapWindow : public wxDialog { public: - ImportMapWindow(wxWindow* parent, Editor& editor); + ImportMapWindow(wxWindow* parent, Editor &editor); virtual ~ImportMapWindow(); - void OnClickBrowse(wxCommandEvent&); - void OnClickOK(wxCommandEvent&); - void OnClickCancel(wxCommandEvent&); + void OnClickBrowse(wxCommandEvent &); + void OnClickOK(wxCommandEvent &); + void OnClickCancel(wxCommandEvent &); + protected: - Editor& editor; + Editor &editor; wxTextCtrl* file_text_field; wxSpinCtrl* x_offset_ctrl; @@ -111,23 +108,22 @@ class ImportMapWindow : public wxDialog /** * The export minimap dialog, select output path and what floors to export. */ -class ExportMiniMapWindow : public wxDialog -{ +class ExportMiniMapWindow : public wxDialog { public: - ExportMiniMapWindow(wxWindow* parent, Editor& editor); + ExportMiniMapWindow(wxWindow* parent, Editor &editor); virtual ~ExportMiniMapWindow(); - void OnClickBrowse(wxCommandEvent&); - void OnDirectoryChanged(wxKeyEvent&); - void OnFileNameChanged(wxKeyEvent&); - void OnClickOK(wxCommandEvent&); - void OnClickCancel(wxCommandEvent&); - void OnExportTypeChange(wxCommandEvent&); + void OnClickBrowse(wxCommandEvent &); + void OnDirectoryChanged(wxKeyEvent &); + void OnFileNameChanged(wxKeyEvent &); + void OnClickOK(wxCommandEvent &); + void OnClickCancel(wxCommandEvent &); + void OnExportTypeChange(wxCommandEvent &); protected: void CheckValues(); - Editor& editor; + Editor &editor; wxChoice* format_options; wxStaticText* error_field; @@ -143,14 +139,13 @@ class ExportMiniMapWindow : public wxDialog /** * Text control that will forward up/down pgup / pgdown keys to parent window */ -class KeyForwardingTextCtrl : public wxTextCtrl -{ +class KeyForwardingTextCtrl : public wxTextCtrl { public: - KeyForwardingTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value = "", const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr) - : wxTextCtrl(parent, id, value, pos, size, style, validator, name) {} - ~KeyForwardingTextCtrl() {} + KeyForwardingTextCtrl(wxWindow* parent, wxWindowID id, const wxString &value = "", const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = 0, const wxValidator &validator = wxDefaultValidator, const wxString &name = wxTextCtrlNameStr) : + wxTextCtrl(parent, id, value, pos, size, style, validator, name) { } + ~KeyForwardingTextCtrl() { } - void OnKeyDown(wxKeyEvent&); + void OnKeyDown(wxKeyEvent &); DECLARE_EVENT_TABLE() }; @@ -159,8 +154,7 @@ class KeyForwardingTextCtrl : public wxTextCtrl * The list inside a find dialog * Presents a list of brushes */ -class FindDialogListBox : public wxVListBox -{ +class FindDialogListBox : public wxVListBox { public: FindDialogListBox(wxWindow* parent, wxWindowID id); ~FindDialogListBox(); @@ -170,8 +164,9 @@ class FindDialogListBox : public wxVListBox void AddBrush(Brush*); Brush* GetSelectedBrush(); - void OnDrawItem(wxDC& dc, const wxRect& rect, size_t index) const; + void OnDrawItem(wxDC &dc, const wxRect &rect, size_t index) const; wxCoord OnMeasureItem(size_t index) const; + protected: bool cleared; bool no_matches; @@ -179,15 +174,15 @@ class FindDialogListBox : public wxVListBox }; /** -* A wxListBox that can be sorted without using style wxLB_SORT. -* wxLB_SORT does not work properly on Windows and causes errors on macOS. -*/ -class SortableListBox : public wxListBox -{ + * A wxListBox that can be sorted without using style wxLB_SORT. + * wxLB_SORT does not work properly on Windows and causes errors on macOS. + */ +class SortableListBox : public wxListBox { public: SortableListBox(wxWindow* parent, wxWindowID id, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize); ~SortableListBox(); void Sort(); + private: void DoSort(); }; @@ -197,25 +192,29 @@ class SortableListBox : public wxListBox * ShowModal will return 0 or the item id for item dialogs * 0 or 1 for brush dialogs */ -class FindDialog : public wxDialog -{ +class FindDialog : public wxDialog { public: FindDialog(wxWindow* parent, wxString title); virtual ~FindDialog(); - void OnKeyDown(wxKeyEvent&); - void OnTextChange(wxCommandEvent&); - void OnTextIdle(wxTimerEvent&); - void OnClickList(wxCommandEvent&); - void OnClickOK(wxCommandEvent&); - void OnClickCancel(wxCommandEvent&); + void OnKeyDown(wxKeyEvent &); + void OnTextChange(wxCommandEvent &); + void OnTextIdle(wxTimerEvent &); + void OnClickList(wxCommandEvent &); + void OnClickOK(wxCommandEvent &); + void OnClickCancel(wxCommandEvent &); void RefreshContents(); - virtual const Brush* getResult() const {return result_brush;} - virtual int getResultID() const {return result_id;} + virtual const Brush* getResult() const { + return result_brush; + } + virtual int getResultID() const { + return result_id; + } + protected: virtual void RefreshContentsInternal() = 0; - virtual void OnClickListInternal(wxCommandEvent&) = 0; + virtual void OnClickListInternal(wxCommandEvent &) = 0; virtual void OnClickOKInternal() = 0; FindDialogListBox* item_list; @@ -231,14 +230,13 @@ class FindDialog : public wxDialog * Find a brush dialog * Find out what brush was returned through GetResult */ -class FindBrushDialog : public FindDialog -{ +class FindBrushDialog : public FindDialog { public: FindBrushDialog(wxWindow* parent, wxString title = "Jump to Brush"); virtual ~FindBrushDialog(); virtual void RefreshContentsInternal(); - virtual void OnClickListInternal(wxCommandEvent&); + virtual void OnClickListInternal(wxCommandEvent &); virtual void OnClickOKInternal(); }; @@ -246,17 +244,16 @@ class FindBrushDialog : public FindDialog * Go to position dialog * Allows entry of 3 coordinates and goes there instantly */ -class GotoPositionDialog : public wxDialog -{ +class GotoPositionDialog : public wxDialog { public: - GotoPositionDialog(wxWindow* parent, Editor& editor); - ~GotoPositionDialog() {} + GotoPositionDialog(wxWindow* parent, Editor &editor); + ~GotoPositionDialog() { } - void OnClickOK(wxCommandEvent&); - void OnClickCancel(wxCommandEvent&); + void OnClickOK(wxCommandEvent &); + void OnClickCancel(wxCommandEvent &); protected: - Editor& editor; + Editor &editor; PositionCtrl* posctrl; DECLARE_EVENT_TABLE(); @@ -267,29 +264,33 @@ class GotoPositionDialog : public wxDialog * There are two versions, one for otbmv4 maps and one for the old maps. * They are declared in old_properties_window / properties_window */ -class ObjectPropertiesWindowBase : public wxDialog -{ +class ObjectPropertiesWindowBase : public wxDialog { public: ObjectPropertiesWindowBase( wxWindow* parent, wxString title, const Map* map, const Tile* tile, Item* item, - wxPoint position = wxDefaultPosition); + wxPoint position = wxDefaultPosition + ); ObjectPropertiesWindowBase( wxWindow* parent, wxString title, const Map* map, const Tile* tile, SpawnMonster* spawnMonster, - wxPoint position = wxDefaultPosition); + wxPoint position = wxDefaultPosition + ); ObjectPropertiesWindowBase( wxWindow* parent, wxString title, const Map* map, const Tile* tile, SpawnNpc* spawnNpc, - wxPoint position = wxDefaultPosition); + wxPoint position = wxDefaultPosition + ); ObjectPropertiesWindowBase( wxWindow* parent, wxString title, const Map* map, const Tile* tile, Npc* npc, - wxPoint position = wxDefaultPosition); + wxPoint position = wxDefaultPosition + ); ObjectPropertiesWindowBase( wxWindow* parent, wxString title, const Map* map, const Tile* tile, Monster* monster, - wxPoint position = wxDefaultPosition); + wxPoint position = wxDefaultPosition + ); Item* getItemBeingEdited(); Monster* getMonsterBeingEdited(); @@ -310,24 +311,23 @@ class ObjectPropertiesWindowBase : public wxDialog /** * The edit towns dialog, ugly as sin. */ -class EditTownsDialog : public wxDialog -{ +class EditTownsDialog : public wxDialog { public: - EditTownsDialog(wxWindow* parent, Editor& editor); + EditTownsDialog(wxWindow* parent, Editor &editor); virtual ~EditTownsDialog(); - void OnListBoxChange(wxCommandEvent&); - void OnClickSelectTemplePosition(wxCommandEvent&); - void OnClickAdd(wxCommandEvent&); - void OnClickRemove(wxCommandEvent&); - void OnClickOK(wxCommandEvent&); - void OnClickCancel(wxCommandEvent&); -protected: + void OnListBoxChange(wxCommandEvent &); + void OnClickSelectTemplePosition(wxCommandEvent &); + void OnClickAdd(wxCommandEvent &); + void OnClickRemove(wxCommandEvent &); + void OnClickOK(wxCommandEvent &); + void OnClickCancel(wxCommandEvent &); +protected: void BuildListBox(bool doselect); void UpdateSelection(int new_selection); - Editor& editor; + Editor &editor; std::vector town_list; uint32_t max_town_id; diff --git a/source/complexitem.cpp b/source/complexitem.cpp index c9c2b47f..c4450911 100644 --- a/source/complexitem.cpp +++ b/source/complexitem.cpp @@ -22,81 +22,75 @@ #include "iomap.h" // Container -Container::Container(const uint16_t type) : Item(type, 0) -{ +Container::Container(const uint16_t type) : + Item(type, 0) { //// } -Container::~Container() -{ - for(Item* item : contents) { +Container::~Container() { + for (Item* item : contents) { delete item; } contents.clear(); } -Item* Container::deepCopy() const -{ +Item* Container::deepCopy() const { Item* copy = Item::deepCopy(); - if(Container* container = copy->getContainer()) { - for(const Item* item : contents) { + if (Container* container = copy->getContainer()) { + for (const Item* item : contents) { container->contents.push_back(item->deepCopy()); } } return copy; } -Item* Container::getItem(size_t index) const -{ - if(index >= 0 && index < contents.size()) { +Item* Container::getItem(size_t index) const { + if (index >= 0 && index < contents.size()) { return contents.at(index); } return nullptr; } // Teleport -Teleport::Teleport(const uint16_t type) : Item(type, 0), - destination(0, 0, 0) -{ +Teleport::Teleport(const uint16_t type) : + Item(type, 0), + destination(0, 0, 0) { //// } -Item* Teleport::deepCopy() const -{ +Item* Teleport::deepCopy() const { Item* copy = Item::deepCopy(); - if(Teleport* teleport = copy->getTeleport()) { + if (Teleport* teleport = copy->getTeleport()) { teleport->setDestination(destination); } return copy; } // Door -Door::Door(const uint16_t type) : Item(type, 0), - doorId(0) -{ +Door::Door(const uint16_t type) : + Item(type, 0), + doorId(0) { //// } -Item* Door::deepCopy() const -{ +Item* Door::deepCopy() const { Item* copy = Item::deepCopy(); - if(Door* door = copy->getDoor()) { + if (Door* door = copy->getDoor()) { door->doorId = doorId; } return copy; } // Depot -Depot::Depot(const uint16_t type) : Item(type, 0), - depotId(0) -{ +Depot::Depot(const uint16_t type) : + Item(type, 0), + depotId(0) { //// } -Item* Depot::deepCopy() const -{ +Item* Depot::deepCopy() const { Item* copy = Item::deepCopy(); - if(Depot* depot = copy->getDepot()) { + if (Depot* depot = copy->getDepot()) { depot->depotId = depotId; } return copy; diff --git a/source/complexitem.h b/source/complexitem.h index 9f0d3e1d..7e32dc06 100644 --- a/source/complexitem.h +++ b/source/complexitem.h @@ -23,8 +23,7 @@ #pragma pack(1) -struct OTBM_TeleportDestination -{ +struct OTBM_TeleportDestination { uint16_t x; uint16_t y; uint8_t z; @@ -32,90 +31,122 @@ struct OTBM_TeleportDestination #pragma pack() -class Container : public Item -{ +class Container : public Item { public: Container(const uint16_t type); ~Container(); Item* deepCopy() const override; - Container* getContainer() override { return this; } + Container* getContainer() override { + return this; + } Item* getItem(size_t index) const; - ItemVector& getVector() noexcept { return contents; } - size_t getItemCount() const noexcept { return contents.size(); } - size_t getVolume() const noexcept { return getItemType().volume; } - double getWeight() noexcept { return getItemType().weight; } - - virtual bool unserializeItemNode_OTBM(const IOMap& maphandle, BinaryNode* node); - virtual bool serializeItemNode_OTBM(const IOMap& maphandle, NodeFileWriteHandle& f) const; - //virtual bool unserializeItemNode_OTMM(const IOMap& maphandle, BinaryNode* node); - //virtual bool serializeItemNode_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f) const; + ItemVector &getVector() noexcept { + return contents; + } + size_t getItemCount() const noexcept { + return contents.size(); + } + size_t getVolume() const noexcept { + return getItemType().volume; + } + double getWeight() noexcept { + return getItemType().weight; + } + + virtual bool unserializeItemNode_OTBM(const IOMap &maphandle, BinaryNode* node); + virtual bool serializeItemNode_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const; + // virtual bool unserializeItemNode_OTMM(const IOMap& maphandle, BinaryNode* node); + // virtual bool serializeItemNode_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f) const; protected: ItemVector contents; }; -class Teleport : public Item -{ +class Teleport : public Item { public: Teleport(const uint16_t type); Item* deepCopy() const override; - Teleport* getTeleport() override { return this; } - - virtual void serializeItemAttributes_OTBM(const IOMap& maphandle, NodeFileWriteHandle& f) const; - virtual bool readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute attr, BinaryNode* node); - //virtual void serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f) const; - //virtual bool readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute attr, BinaryNode* node); - - const Position& getDestination() const noexcept { return destination; } - int getX() const noexcept { return destination.x; } - int getY() const noexcept { return destination.y; } - int getZ() const noexcept { return destination.z; } - void setDestination(const Position& position) noexcept { destination = position; } - bool hasDestination() const noexcept { return destination.isValid(); } + Teleport* getTeleport() override { + return this; + } + + virtual void serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const; + virtual bool readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attr, BinaryNode* node); + // virtual void serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f) const; + // virtual bool readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute attr, BinaryNode* node); + + const Position &getDestination() const noexcept { + return destination; + } + int getX() const noexcept { + return destination.x; + } + int getY() const noexcept { + return destination.y; + } + int getZ() const noexcept { + return destination.z; + } + void setDestination(const Position &position) noexcept { + destination = position; + } + bool hasDestination() const noexcept { + return destination.isValid(); + } protected: Position destination; }; -class Door : public Item -{ +class Door : public Item { public: Door(const uint16_t type); Item* deepCopy() const override; - Door* getDoor() override { return this; } - - uint8_t getDoorID() const { return doorId; } - void setDoorID(uint8_t id) { doorId = id; } - - virtual void serializeItemAttributes_OTBM(const IOMap& maphandle, NodeFileWriteHandle& f) const; - virtual bool readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute attr, BinaryNode* node); - //virtual void serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f) const; - //virtual bool readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute attr, BinaryNode* node); + Door* getDoor() override { + return this; + } + + uint8_t getDoorID() const { + return doorId; + } + void setDoorID(uint8_t id) { + doorId = id; + } + + virtual void serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const; + virtual bool readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attr, BinaryNode* node); + // virtual void serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f) const; + // virtual bool readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute attr, BinaryNode* node); protected: uint8_t doorId; }; -class Depot : public Item -{ +class Depot : public Item { public: Depot(const uint16_t _type); Item* deepCopy() const override; - Depot* getDepot() override { return this; } - - uint8_t getDepotID() const { return depotId; } - void setDepotID(uint8_t id) { depotId = id; } - - virtual void serializeItemAttributes_OTBM(const IOMap& maphandle, NodeFileWriteHandle& f) const; - virtual bool readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute attr, BinaryNode* node); - //virtual void serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f) const; - //virtual bool readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute attr, BinaryNode* node); + Depot* getDepot() override { + return this; + } + + uint8_t getDepotID() const { + return depotId; + } + void setDepotID(uint8_t id) { + depotId = id; + } + + virtual void serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const; + virtual bool readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attr, BinaryNode* node); + // virtual void serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f) const; + // virtual bool readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute attr, BinaryNode* node); protected: uint8_t depotId; diff --git a/source/con_vector.h b/source/con_vector.h index fd9fb63c..d7d627ce 100644 --- a/source/con_vector.h +++ b/source/con_vector.h @@ -22,7 +22,9 @@ template // This only really works with pointers.. hrhr "T" might be abit misleading.. :o class contigous_vector { - T __pointer_check(T t) {return *t;} // If this fails, you have tried using this class with a non-pointer type, DONT + T __pointer_check(T t) { + return *t; + } // If this fails, you have tried using this class with a non-pointer type, DONT public: contigous_vector(size_t start_size = 7) { start = reinterpret_cast(malloc(sizeof(T) * start_size)); @@ -43,16 +45,16 @@ class contigous_vector { return sz; } - T& locate(size_t index) { + T &locate(size_t index) { // Masterly inefficient! - while(index >= sz) { - resize(sz+REALLOC_INCREASE); + while (index >= sz) { + resize(sz + REALLOC_INCREASE); } return start[index]; } T at(size_t index) const { - if(index >= sz) { + if (index >= sz) { return nullptr; } return start[index]; @@ -62,8 +64,13 @@ class contigous_vector { locate(index) = value; } - T operator[](size_t index) {return at(index);} - const T operator[](size_t index) const {return at(index);} + T operator[](size_t index) { + return at(index); + } + const T operator[](size_t index) const { + return at(index); + } + private: T* start; size_t sz; diff --git a/source/const.h b/source/const.h index b1a7ea00..9acd57dd 100644 --- a/source/const.h +++ b/source/const.h @@ -20,40 +20,40 @@ namespace rme { -constexpr double PI = 3.14159265; + constexpr double PI = 3.14159265; -// The height of the map (there should be more checks for this...) -constexpr int MapLayers = 16; + // The height of the map (there should be more checks for this...) + constexpr int MapLayers = 16; -constexpr int MapMinWidth = 256; -constexpr int MapMaxWidth = 65000; -constexpr int MapMinHeight = 256; -constexpr int MapMaxHeight = 65000; -constexpr int MapMinLayer = 0; -constexpr int MapMaxLayer = 15; + constexpr int MapMinWidth = 256; + constexpr int MapMaxWidth = 65000; + constexpr int MapMinHeight = 256; + constexpr int MapMaxHeight = 65000; + constexpr int MapMinLayer = 0; + constexpr int MapMaxLayer = 15; -// The sea layer -constexpr int MapGroundLayer = 7; + // The sea layer + constexpr int MapGroundLayer = 7; -constexpr int ClientMapWidth = 18; -constexpr int ClientMapHeight = 14; + constexpr int ClientMapWidth = 18; + constexpr int ClientMapHeight = 14; -// The size of the tile in pixels -constexpr int TileSize = 32; + // The size of the tile in pixels + constexpr int TileSize = 32; -// The default size of sprites -constexpr int SpritePixels = 32; -constexpr int SpritePixelsSize = SpritePixels * SpritePixels; + // The default size of sprites + constexpr int SpritePixels = 32; + constexpr int SpritePixelsSize = SpritePixels * SpritePixels; -constexpr int MaxLightIntensity = 8; + constexpr int MaxLightIntensity = 8; -constexpr int PixelFormatRGB = 3; -constexpr int PixelFormatRGBA = 4; + constexpr int PixelFormatRGB = 3; + constexpr int PixelFormatRGBA = 4; -constexpr int MinUniqueId = 1000; -constexpr int MaxUniqueId = 65535; -constexpr int MinActionId = 100; -constexpr int MaxActionId = 65535; + constexpr int MinUniqueId = 1000; + constexpr int MaxUniqueId = 65535; + constexpr int MinActionId = 100; + constexpr int MaxActionId = 65535; } // namespace rme diff --git a/source/container_properties_window.cpp b/source/container_properties_window.cpp index 2a532002..d2266eb9 100644 --- a/source/container_properties_window.cpp +++ b/source/container_properties_window.cpp @@ -35,46 +35,42 @@ std::unique_ptr ContainerItemButton::popup_menu; BEGIN_EVENT_TABLE(ContainerItemButton, ItemButton) - EVT_LEFT_DOWN(ContainerItemButton::OnMouseDoubleLeftClick) - EVT_RIGHT_UP(ContainerItemButton::OnMouseRightRelease) +EVT_LEFT_DOWN(ContainerItemButton::OnMouseDoubleLeftClick) +EVT_RIGHT_UP(ContainerItemButton::OnMouseRightRelease) - EVT_MENU(CONTAINER_POPUP_MENU_ADD, ContainerItemButton::OnAddItem) - EVT_MENU(CONTAINER_POPUP_MENU_EDIT, ContainerItemButton::OnEditItem) - EVT_MENU(CONTAINER_POPUP_MENU_REMOVE, ContainerItemButton::OnRemoveItem) +EVT_MENU(CONTAINER_POPUP_MENU_ADD, ContainerItemButton::OnAddItem) +EVT_MENU(CONTAINER_POPUP_MENU_EDIT, ContainerItemButton::OnEditItem) +EVT_MENU(CONTAINER_POPUP_MENU_REMOVE, ContainerItemButton::OnRemoveItem) END_EVENT_TABLE() ContainerItemButton::ContainerItemButton(wxWindow* parent, bool large, int _index, const Map* map, Item* item) : - ItemButton(parent, (large? RENDER_SIZE_32x32 : RENDER_SIZE_16x16), (item? item->getClientID() : 0)), + ItemButton(parent, (large ? RENDER_SIZE_32x32 : RENDER_SIZE_16x16), (item ? item->getClientID() : 0)), edit_map(map), edit_item(item), - index(_index) -{ + index(_index) { //// } -ContainerItemButton::~ContainerItemButton() -{ +ContainerItemButton::~ContainerItemButton() { //// } -void ContainerItemButton::OnMouseDoubleLeftClick(wxMouseEvent& WXUNUSED(event)) -{ +void ContainerItemButton::OnMouseDoubleLeftClick(wxMouseEvent &WXUNUSED(event)) { wxCommandEvent dummy; - if(edit_item) { + if (edit_item) { OnEditItem(dummy); return; } Container* container = getParentContainer(); - if(container->getVolume() > container->getItemCount()) { + if (container->getVolume() > container->getItemCount()) { OnAddItem(dummy); } } -void ContainerItemButton::OnMouseRightRelease(wxMouseEvent& WXUNUSED(event)) -{ - if(!popup_menu) { +void ContainerItemButton::OnMouseRightRelease(wxMouseEvent &WXUNUSED(event)) { + if (!popup_menu) { popup_menu.reset(newd ContainerItemPopupMenu); } @@ -82,35 +78,35 @@ void ContainerItemButton::OnMouseRightRelease(wxMouseEvent& WXUNUSED(event)) PopupMenu(popup_menu.get()); } -void ContainerItemButton::OnAddItem(wxCommandEvent& WXUNUSED(event)) -{ +void ContainerItemButton::OnAddItem(wxCommandEvent &WXUNUSED(event)) { FindItemDialog dialog(GetParent(), "Choose Item to add", true); - if(dialog.ShowModal() == wxID_OK) { + if (dialog.ShowModal() == wxID_OK) { Container* container = getParentContainer(); - ItemVector& itemVector = container->getVector(); + ItemVector &itemVector = container->getVector(); Item* item = Item::Create(dialog.getResultID()); - if(index < itemVector.size()) + if (index < itemVector.size()) { itemVector.insert(itemVector.begin() + index, item); - else + } else { itemVector.push_back(item); + } ObjectPropertiesWindowBase* propertyWindow = getParentContainerWindow(); - if(propertyWindow) + if (propertyWindow) { propertyWindow->Update(); + } } dialog.Destroy(); } -void ContainerItemButton::OnEditItem(wxCommandEvent& WXUNUSED(event)) -{ +void ContainerItemButton::OnEditItem(wxCommandEvent &WXUNUSED(event)) { ASSERT(edit_item); wxPoint newDialogAt; wxWindow* w = this; - while((w = w->GetParent())) { - if(ObjectPropertiesWindowBase* o = dynamic_cast(w)) { + while ((w = w->GetParent())) { + if (ObjectPropertiesWindowBase* o = dynamic_cast(w)) { newDialogAt = o->GetPosition(); break; } @@ -120,34 +116,30 @@ void ContainerItemButton::OnEditItem(wxCommandEvent& WXUNUSED(event)) wxDialog* d; - if(edit_map->getVersion().otbm >= MAP_OTBM_4) + if (edit_map->getVersion().otbm >= MAP_OTBM_4) { d = newd PropertiesWindow(this, edit_map, nullptr, edit_item, newDialogAt); - else + } else { d = newd OldPropertiesWindow(this, edit_map, nullptr, edit_item, newDialogAt); + } d->ShowModal(); d->Destroy(); } -void ContainerItemButton::OnRemoveItem(wxCommandEvent& WXUNUSED(event)) -{ +void ContainerItemButton::OnRemoveItem(wxCommandEvent &WXUNUSED(event)) { ASSERT(edit_item); - int32_t ret = g_gui.PopupDialog(GetParent(), - "Remove Item", - "Are you sure you want to remove this item from the container?", - wxYES | wxNO - ); + int32_t ret = g_gui.PopupDialog(GetParent(), "Remove Item", "Are you sure you want to remove this item from the container?", wxYES | wxNO); - if(ret != wxID_YES) { + if (ret != wxID_YES) { return; } Container* container = getParentContainer(); - ItemVector& itemVector = container->getVector(); + ItemVector &itemVector = container->getVector(); auto it = itemVector.begin(); - for(; it != itemVector.end(); ++it) { - if(*it == edit_item) { + for (; it != itemVector.end(); ++it) { + if (*it == edit_item) { break; } } @@ -158,71 +150,67 @@ void ContainerItemButton::OnRemoveItem(wxCommandEvent& WXUNUSED(event)) delete edit_item; ObjectPropertiesWindowBase* propertyWindow = getParentContainerWindow(); - if(propertyWindow) { + if (propertyWindow) { propertyWindow->Update(); } } -void ContainerItemButton::setItem(Item* item) -{ +void ContainerItemButton::setItem(Item* item) { edit_item = item; - if(edit_item) { + if (edit_item) { SetSprite(edit_item->getClientID()); } else { SetSprite(0); } } -ObjectPropertiesWindowBase* ContainerItemButton::getParentContainerWindow() -{ - for(wxWindow* window = GetParent(); window != nullptr; window = window->GetParent()) { +ObjectPropertiesWindowBase* ContainerItemButton::getParentContainerWindow() { + for (wxWindow* window = GetParent(); window != nullptr; window = window->GetParent()) { ObjectPropertiesWindowBase* propertyWindow = dynamic_cast(window); - if(propertyWindow) { + if (propertyWindow) { return propertyWindow; } } return nullptr; } -Container* ContainerItemButton::getParentContainer() -{ +Container* ContainerItemButton::getParentContainer() { ObjectPropertiesWindowBase* propertyWindow = getParentContainerWindow(); - if(propertyWindow) { + if (propertyWindow) { return dynamic_cast(propertyWindow->getItemBeingEdited()); } return nullptr; } // ContainerItemPopupMenu -ContainerItemPopupMenu::ContainerItemPopupMenu() : wxMenu("") -{ +ContainerItemPopupMenu::ContainerItemPopupMenu() : + wxMenu("") { //// } -ContainerItemPopupMenu::~ContainerItemPopupMenu() -{ +ContainerItemPopupMenu::~ContainerItemPopupMenu() { //// } -void ContainerItemPopupMenu::Update(ContainerItemButton* btn) -{ +void ContainerItemPopupMenu::Update(ContainerItemButton* btn) { // Clear the menu of all items - while(GetMenuItemCount() != 0) { + while (GetMenuItemCount() != 0) { wxMenuItem* m_item = FindItemByPosition(0); // If you add a submenu, this won't delete it. Delete(m_item); } wxMenuItem* addItem = nullptr; - if(btn->edit_item) { - Append( CONTAINER_POPUP_MENU_EDIT, "&Edit Item", "Open the properties menu for this item"); - addItem = Append( CONTAINER_POPUP_MENU_ADD, "&Add Item", "Add a newd item to the container"); - Append( CONTAINER_POPUP_MENU_REMOVE, "&Remove Item", "Remove this item from the container"); + if (btn->edit_item) { + Append(CONTAINER_POPUP_MENU_EDIT, "&Edit Item", "Open the properties menu for this item"); + addItem = Append(CONTAINER_POPUP_MENU_ADD, "&Add Item", "Add a newd item to the container"); + Append(CONTAINER_POPUP_MENU_REMOVE, "&Remove Item", "Remove this item from the container"); } else { - addItem = Append( CONTAINER_POPUP_MENU_ADD, "&Add Item", "Add a newd item to the container"); + addItem = Append(CONTAINER_POPUP_MENU_ADD, "&Add Item", "Add a newd item to the container"); } Container* parentContainer = btn->getParentContainer(); - if(parentContainer->getVolume() <= (int)parentContainer->getVector().size()) + if (parentContainer->getVolume() <= (int)parentContainer->getVector().size()) { addItem->Enable(false); + } } diff --git a/source/container_properties_window.h b/source/container_properties_window.h index ab2f1595..8de37141 100644 --- a/source/container_properties_window.h +++ b/source/container_properties_window.h @@ -33,34 +33,33 @@ class ContainerItemPopupMenu : public wxMenu { }; // Container Item Button -class ContainerItemButton : public ItemButton -{ +class ContainerItemButton : public ItemButton { DECLARE_EVENT_TABLE() - public: - ContainerItemButton(wxWindow* parent, bool large, int index, const Map* map, Item* item); - ~ContainerItemButton(); +public: + ContainerItemButton(wxWindow* parent, bool large, int index, const Map* map, Item* item); + ~ContainerItemButton(); - void OnMouseDoubleLeftClick(wxMouseEvent& event); - void OnMouseRightRelease(wxMouseEvent& event); + void OnMouseDoubleLeftClick(wxMouseEvent &event); + void OnMouseRightRelease(wxMouseEvent &event); - void OnAddItem(wxCommandEvent& event); - void OnEditItem(wxCommandEvent& event); - void OnRemoveItem(wxCommandEvent& event); + void OnAddItem(wxCommandEvent &event); + void OnEditItem(wxCommandEvent &event); + void OnRemoveItem(wxCommandEvent &event); - ObjectPropertiesWindowBase* getParentContainerWindow(); - Container* getParentContainer(); + ObjectPropertiesWindowBase* getParentContainerWindow(); + Container* getParentContainer(); - void setItem(Item* item); + void setItem(Item* item); - private: - static std::unique_ptr popup_menu; +private: + static std::unique_ptr popup_menu; - const Map* edit_map; - Item* edit_item; + const Map* edit_map; + Item* edit_item; - size_t index; + size_t index; - friend class ContainerItemPopupMenu; + friend class ContainerItemPopupMenu; }; #endif diff --git a/source/copybuffer.cpp b/source/copybuffer.cpp index 00e8c2d0..e93da710 100644 --- a/source/copybuffer.cpp +++ b/source/copybuffer.cpp @@ -24,42 +24,35 @@ #include "npc.h" CopyBuffer::CopyBuffer() : - tiles(newd BaseMap()) -{ + tiles(newd BaseMap()) { ; } -size_t CopyBuffer::GetTileCount() -{ +size_t CopyBuffer::GetTileCount() { return tiles ? (size_t)tiles->size() : 0; } -BaseMap& CopyBuffer::getBufferMap() -{ +BaseMap &CopyBuffer::getBufferMap() { ASSERT(tiles); return *tiles; } -CopyBuffer::~CopyBuffer() -{ +CopyBuffer::~CopyBuffer() { clear(); } -Position CopyBuffer::getPosition() const -{ +Position CopyBuffer::getPosition() const { ASSERT(tiles); return copyPos; } -void CopyBuffer::clear() -{ +void CopyBuffer::clear() { delete tiles; tiles = nullptr; } -void CopyBuffer::copy(Editor& editor, int floor) -{ - if(!editor.hasSelection()) { +void CopyBuffer::copy(Editor &editor, int floor) { + if (!editor.hasSelection()) { g_gui.SetStatusText("No tiles to copy."); return; } @@ -71,56 +64,57 @@ void CopyBuffer::copy(Editor& editor, int floor) int item_count = 0; copyPos = Position(0xFFFF, 0xFFFF, floor); - for(Tile* tile : editor.getSelection()) { + for (Tile* tile : editor.getSelection()) { ++tile_count; TileLocation* newlocation = tiles->createTileL(tile->getPosition()); Tile* copied_tile = tiles->allocator(newlocation); - if(tile->ground && tile->ground->isSelected()) { + if (tile->ground && tile->ground->isSelected()) { copied_tile->house_id = tile->house_id; copied_tile->setMapFlags(tile->getMapFlags()); } ItemVector tile_selection = tile->getSelectedItems(); - for(ItemVector::iterator iit = tile_selection.begin(); iit != tile_selection.end(); ++iit) { + for (ItemVector::iterator iit = tile_selection.begin(); iit != tile_selection.end(); ++iit) { ++item_count; // Copy items to copybuffer copied_tile->addItem((*iit)->deepCopy()); } // Monster - if(tile->monster && tile->monster->isSelected()) { + if (tile->monster && tile->monster->isSelected()) { copied_tile->monster = tile->monster->deepCopy(); } - if(tile->spawnMonster && tile->spawnMonster->isSelected()) { + if (tile->spawnMonster && tile->spawnMonster->isSelected()) { copied_tile->spawnMonster = tile->spawnMonster->deepCopy(); } // Npc - if(tile->npc && tile->npc->isSelected()) { + if (tile->npc && tile->npc->isSelected()) { copied_tile->npc = tile->npc->deepCopy(); } - if(tile->spawnNpc && tile->spawnNpc->isSelected()) { + if (tile->spawnNpc && tile->spawnNpc->isSelected()) { copied_tile->spawnNpc = tile->spawnNpc->deepCopy(); } tiles->setTile(copied_tile); - if(copied_tile->getX() < copyPos.x) + if (copied_tile->getX() < copyPos.x) { copyPos.x = copied_tile->getX(); + } - if(copied_tile->getY() < copyPos.y) + if (copied_tile->getY() < copyPos.y) { copyPos.y = copied_tile->getY(); + } } std::ostringstream ss; - ss << "Copied " << tile_count << " tile" << (tile_count > 1 ? "s" : "") << " (" << item_count << " item" << (item_count > 1? "s" : "") << ")"; + ss << "Copied " << tile_count << " tile" << (tile_count > 1 ? "s" : "") << " (" << item_count << " item" << (item_count > 1 ? "s" : "") << ")"; g_gui.SetStatusText(wxstr(ss.str())); } -void CopyBuffer::cut(Editor& editor, int floor) -{ - if(!editor.hasSelection()) { +void CopyBuffer::cut(Editor &editor, int floor) { + if (!editor.hasSelection()) { g_gui.SetStatusText("No tiles to cut."); return; } @@ -128,7 +122,7 @@ void CopyBuffer::cut(Editor& editor, int floor) clear(); tiles = newd BaseMap(); - Map& map = editor.getMap(); + Map &map = editor.getMap(); int tile_count = 0; int item_count = 0; copyPos = Position(0xFFFF, 0xFFFF, floor); @@ -138,13 +132,13 @@ void CopyBuffer::cut(Editor& editor, int floor) PositionList tilestoborder; - for(Tile* tile : editor.getSelection()) { + for (Tile* tile : editor.getSelection()) { tile_count++; Tile* newtile = tile->deepCopy(map); Tile* copied_tile = tiles->allocator(tile->getLocation()); - if(tile->ground && tile->ground->isSelected()) { + if (tile->ground && tile->ground->isSelected()) { copied_tile->house_id = newtile->house_id; newtile->house_id = 0; copied_tile->setMapFlags(tile->getMapFlags()); @@ -152,48 +146,50 @@ void CopyBuffer::cut(Editor& editor, int floor) } ItemVector tile_selection = newtile->popSelectedItems(); - for(ItemVector::iterator iit = tile_selection.begin(); iit != tile_selection.end(); ++iit) { + for (ItemVector::iterator iit = tile_selection.begin(); iit != tile_selection.end(); ++iit) { item_count++; // Add items to copybuffer copied_tile->addItem(*iit); } // Monster - if(newtile->monster && newtile->monster->isSelected()) { + if (newtile->monster && newtile->monster->isSelected()) { copied_tile->monster = newtile->monster; newtile->monster = nullptr; } - if(newtile->spawnMonster && newtile->spawnMonster->isSelected()) { + if (newtile->spawnMonster && newtile->spawnMonster->isSelected()) { copied_tile->spawnMonster = newtile->spawnMonster; newtile->spawnMonster = nullptr; } // Npc - if(newtile->npc && newtile->npc->isSelected()) { + if (newtile->npc && newtile->npc->isSelected()) { copied_tile->npc = newtile->npc; newtile->npc = nullptr; } - if(newtile->spawnNpc && newtile->spawnNpc->isSelected()) { + if (newtile->spawnNpc && newtile->spawnNpc->isSelected()) { copied_tile->spawnNpc = newtile->spawnNpc; newtile->spawnNpc = nullptr; } tiles->setTile(copied_tile->getPosition(), copied_tile); - if(copied_tile->getX() < copyPos.x) { + if (copied_tile->getX() < copyPos.x) { copyPos.x = copied_tile->getX(); } - if(copied_tile->getY() < copyPos.y) { + if (copied_tile->getY() < copyPos.y) { copyPos.y = copied_tile->getY(); } - if(g_settings.getInteger(Config::USE_AUTOMAGIC)) { - for(int y = -1; y <= 1; y++) - for(int x = -1; x <= 1; x++) + if (g_settings.getInteger(Config::USE_AUTOMAGIC)) { + for (int y = -1; y <= 1; y++) { + for (int x = -1; x <= 1; x++) { tilestoborder.push_back(Position(tile->getX() + x, tile->getY() + y, tile->getZ())); + } + } } action->addChange(newd Change(newtile)); } @@ -204,11 +200,11 @@ void CopyBuffer::cut(Editor& editor, int floor) tilestoborder.sort(); tilestoborder.unique(); - if(g_settings.getInteger(Config::USE_AUTOMAGIC)) { + if (g_settings.getInteger(Config::USE_AUTOMAGIC)) { action = editor.createAction(batch); - for(PositionList::iterator it = tilestoborder.begin(); it != tilestoborder.end(); ++it) { + for (PositionList::iterator it = tilestoborder.begin(); it != tilestoborder.end(); ++it) { TileLocation* location = map.createTileL(*it); - if(location->get()) { + if (location->get()) { Tile* new_tile = location->get()->deepCopy(map); new_tile->borderize(&map); new_tile->wallize(&map); @@ -216,7 +212,7 @@ void CopyBuffer::cut(Editor& editor, int floor) } else { Tile* new_tile = map.allocator(location); new_tile->borderize(&map); - if(new_tile->size()) { + if (new_tile->size()) { action->addChange(newd Change(new_tile)); } else { delete new_tile; @@ -231,26 +227,26 @@ void CopyBuffer::cut(Editor& editor, int floor) editor.updateActions(); std::stringstream ss; - ss << "Cut out " << tile_count << " tile" << (tile_count > 1 ? "s" : "") << " (" << item_count << " item" << (item_count > 1? "s" : "") << ")"; + ss << "Cut out " << tile_count << " tile" << (tile_count > 1 ? "s" : "") << " (" << item_count << " item" << (item_count > 1 ? "s" : "") << ")"; g_gui.SetStatusText(wxstr(ss.str())); } -void CopyBuffer::paste(Editor& editor, const Position& toPosition) -{ - if(!tiles) { +void CopyBuffer::paste(Editor &editor, const Position &toPosition) { + if (!tiles) { return; } - Map& map = editor.getMap(); + Map &map = editor.getMap(); BatchAction* batchAction = editor.createBatch(ACTION_PASTE_TILES); Action* action = editor.createAction(batchAction); - for(MapIterator it = tiles->begin(); it != tiles->end(); ++it) { + for (MapIterator it = tiles->begin(); it != tiles->end(); ++it) { Tile* buffer_tile = (*it)->get(); Position pos = buffer_tile->getPosition() - copyPos + toPosition; - if(!pos.isValid()) + if (!pos.isValid()) { continue; + } TileLocation* location = map.createTileL(pos); Tile* copy_tile = buffer_tile->deepCopy(map); @@ -258,11 +254,12 @@ void CopyBuffer::paste(Editor& editor, const Position& toPosition) Tile* new_dest_tile = nullptr; copy_tile->setLocation(location); - if(g_settings.getInteger(Config::MERGE_PASTE) || !copy_tile->ground) { - if(old_dest_tile) + if (g_settings.getInteger(Config::MERGE_PASTE) || !copy_tile->ground) { + if (old_dest_tile) { new_dest_tile = old_dest_tile->deepCopy(map); - else + } else { new_dest_tile = map.allocator(location); + } new_dest_tile->merge(copy_tile); delete copy_tile; } else { @@ -271,52 +268,86 @@ void CopyBuffer::paste(Editor& editor, const Position& toPosition) } // Add all surrounding tiles to the map, so they get borders - map.createTile(pos.x-1, pos.y-1, pos.z); - map.createTile(pos.x , pos.y-1, pos.z); - map.createTile(pos.x+1, pos.y-1, pos.z); - map.createTile(pos.x-1, pos.y , pos.z); - map.createTile(pos.x+1, pos.y , pos.z); - map.createTile(pos.x-1, pos.y+1, pos.z); - map.createTile(pos.x , pos.y+1, pos.z); - map.createTile(pos.x+1, pos.y+1, pos.z); + map.createTile(pos.x - 1, pos.y - 1, pos.z); + map.createTile(pos.x, pos.y - 1, pos.z); + map.createTile(pos.x + 1, pos.y - 1, pos.z); + map.createTile(pos.x - 1, pos.y, pos.z); + map.createTile(pos.x + 1, pos.y, pos.z); + map.createTile(pos.x - 1, pos.y + 1, pos.z); + map.createTile(pos.x, pos.y + 1, pos.z); + map.createTile(pos.x + 1, pos.y + 1, pos.z); action->addChange(newd Change(new_dest_tile)); } batchAction->addAndCommitAction(action); - if(g_settings.getInteger(Config::USE_AUTOMAGIC) && g_settings.getInteger(Config::BORDERIZE_PASTE)) { + if (g_settings.getInteger(Config::USE_AUTOMAGIC) && g_settings.getInteger(Config::BORDERIZE_PASTE)) { action = editor.createAction(batchAction); TileList borderize_tiles; // Go through all modified (selected) tiles (might be slow) - for(MapIterator it = tiles->begin(); it != tiles->end(); ++it) { + for (MapIterator it = tiles->begin(); it != tiles->end(); ++it) { bool add_me = false; // If this tile is touched Position pos = (*it)->getPosition() - copyPos + toPosition; - if(pos.z < rme::MapMinLayer || pos.z > rme::MapMaxLayer) { + if (pos.z < rme::MapMinLayer || pos.z > rme::MapMaxLayer) { continue; } // Go through all neighbours Tile* t; - t = map.getTile(pos.x-1, pos.y-1, pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t); add_me = true;} - t = map.getTile(pos.x , pos.y-1, pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t); add_me = true;} - t = map.getTile(pos.x+1, pos.y-1, pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t); add_me = true;} - t = map.getTile(pos.x-1, pos.y , pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t); add_me = true;} - t = map.getTile(pos.x+1, pos.y , pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t); add_me = true;} - t = map.getTile(pos.x-1, pos.y+1, pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t); add_me = true;} - t = map.getTile(pos.x , pos.y+1, pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t); add_me = true;} - t = map.getTile(pos.x+1, pos.y+1, pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t); add_me = true;} - if(add_me) borderize_tiles.push_back(map.getTile(pos)); + t = map.getTile(pos.x - 1, pos.y - 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x, pos.y - 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x + 1, pos.y - 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x - 1, pos.y, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x + 1, pos.y, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x - 1, pos.y + 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x, pos.y + 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x + 1, pos.y + 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + if (add_me) { + borderize_tiles.push_back(map.getTile(pos)); + } } // Remove duplicates borderize_tiles.sort(); borderize_tiles.unique(); - for(Tile* tile : borderize_tiles) { - if(tile) { + for (Tile* tile : borderize_tiles) { + if (tile) { Tile* newTile = tile->deepCopy(map); newTile->borderize(&map); - if(tile->ground && tile->ground->isSelected()) { + if (tile->ground && tile->ground->isSelected()) { newTile->selectGround(); } @@ -333,8 +364,6 @@ void CopyBuffer::paste(Editor& editor, const Position& toPosition) editor.updateActions(); } -bool CopyBuffer::canPaste() const -{ +bool CopyBuffer::canPaste() const { return tiles && tiles->size() != 0; } - diff --git a/source/copybuffer.h b/source/copybuffer.h index 6e4233c1..5132d6c0 100644 --- a/source/copybuffer.h +++ b/source/copybuffer.h @@ -23,16 +23,15 @@ class Editor; -class CopyBuffer -{ +class CopyBuffer { public: CopyBuffer(); virtual ~CopyBuffer(); // In-editor implantation - void copy(Editor& editor, int floor); - void cut(Editor& editor, int floor); - void paste(Editor& editor, const Position& toPosition); + void copy(Editor &editor, int floor); + void cut(Editor &editor, int floor); + void paste(Editor &editor, const Position &toPosition); bool canPaste() const; // Returns the upper-left corner of the copybuffer Position getPosition() const; @@ -42,7 +41,7 @@ class CopyBuffer size_t GetTileCount(); - BaseMap& getBufferMap(); + BaseMap &getBufferMap(); private: Position copyPos; diff --git a/source/dat_debug_view.cpp b/source/dat_debug_view.cpp index 69b533f5..af3cd8db 100644 --- a/source/dat_debug_view.cpp +++ b/source/dat_debug_view.cpp @@ -25,13 +25,12 @@ // ============================================================================ // -class DatDebugViewListBox : public wxVListBox -{ +class DatDebugViewListBox : public wxVListBox { public: DatDebugViewListBox(wxWindow* parent, wxWindowID id); ~DatDebugViewListBox(); - void OnDrawItem(wxDC& dc, const wxRect& rect, size_t index) const; + void OnDrawItem(wxDC &dc, const wxRect &rect, size_t index) const; wxCoord OnMeasureItem(size_t index) const; protected: @@ -40,12 +39,11 @@ class DatDebugViewListBox : public wxVListBox }; DatDebugViewListBox::DatDebugViewListBox(wxWindow* parent, wxWindowID id) : - wxVListBox(parent, id, wxDefaultPosition, wxDefaultSize, wxLB_SINGLE) -{ + wxVListBox(parent, id, wxDefaultPosition, wxDefaultSize, wxLB_SINGLE) { int n = 0; - for(int id = 0; id < g_gui.gfx.getItemSpriteMaxID(); ++id) { + for (int id = 0; id < g_gui.gfx.getItemSpriteMaxID(); ++id) { Sprite* spr = g_gui.gfx.getSprite(id); - if(spr) { + if (spr) { sprites[n] = spr; ++n; } @@ -53,22 +51,22 @@ DatDebugViewListBox::DatDebugViewListBox(wxWindow* parent, wxWindowID id) : SetItemCount(n); } -DatDebugViewListBox::~DatDebugViewListBox() -{ +DatDebugViewListBox::~DatDebugViewListBox() { //// } -void DatDebugViewListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const -{ +void DatDebugViewListBox::OnDrawItem(wxDC &dc, const wxRect &rect, size_t n) const { SpriteMap::const_iterator spr_iter = sprites.find(int(n)); - if(spr_iter != sprites.end()) + if (spr_iter != sprites.end()) { spr_iter->second->DrawTo(&dc, SPRITE_SIZE_32x32, rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight()); + } - if(IsSelected(n)) { - if(HasFocus()) + if (IsSelected(n)) { + if (HasFocus()) { dc.SetTextForeground(wxColor(0xFF, 0xFF, 0xFF)); - else + } else { dc.SetTextForeground(wxColor(0x00, 0x00, 0xFF)); + } } else { dc.SetTextForeground(wxColor(0x00, 0x00, 0x00)); } @@ -76,8 +74,7 @@ void DatDebugViewListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) con dc.DrawText(wxString() << n, rect.GetX() + 40, rect.GetY() + 6); } -wxCoord DatDebugViewListBox::OnMeasureItem(size_t n) const -{ +wxCoord DatDebugViewListBox::OnMeasureItem(size_t n) const { return 32; } @@ -85,12 +82,12 @@ wxCoord DatDebugViewListBox::OnMeasureItem(size_t n) const // BEGIN_EVENT_TABLE(DatDebugView, wxPanel) - EVT_TEXT(wxID_ANY, DatDebugView::OnTextChange) - EVT_LISTBOX_DCLICK(wxID_ANY, DatDebugView::OnClickList) +EVT_TEXT(wxID_ANY, DatDebugView::OnTextChange) +EVT_LISTBOX_DCLICK(wxID_ANY, DatDebugView::OnClickList) END_EVENT_TABLE() -DatDebugView::DatDebugView(wxWindow* parent) : wxPanel(parent) -{ +DatDebugView::DatDebugView(wxWindow* parent) : + wxPanel(parent) { wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); search_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize); @@ -105,18 +102,14 @@ DatDebugView::DatDebugView(wxWindow* parent) : wxPanel(parent) Centre(wxBOTH); } -DatDebugView::~DatDebugView() -{ +DatDebugView::~DatDebugView() { //// } -void DatDebugView::OnTextChange(wxCommandEvent& evt) -{ +void DatDebugView::OnTextChange(wxCommandEvent &evt) { //// } -void DatDebugView::OnClickList(wxCommandEvent& evt) -{ +void DatDebugView::OnClickList(wxCommandEvent &evt) { //// } - diff --git a/source/dat_debug_view.h b/source/dat_debug_view.h index 8e45610d..d560c50c 100644 --- a/source/dat_debug_view.h +++ b/source/dat_debug_view.h @@ -20,17 +20,15 @@ class DatDebugViewListBox; -class DatDebugView : public wxPanel -{ +class DatDebugView : public wxPanel { public: DatDebugView(wxWindow* parent); ~DatDebugView(); - void OnTextChange(wxCommandEvent&); - void OnClickList(wxCommandEvent&); + void OnTextChange(wxCommandEvent &); + void OnClickList(wxCommandEvent &); protected: - DatDebugViewListBox* item_list; wxTextCtrl* search_field; diff --git a/source/dcbutton.cpp b/source/dcbutton.cpp index b9ab2e67..b0a34c8b 100644 --- a/source/dcbutton.cpp +++ b/source/dcbutton.cpp @@ -24,8 +24,8 @@ #include "gui.h" BEGIN_EVENT_TABLE(DCButton, wxPanel) - EVT_PAINT(DCButton::OnPaint) - EVT_LEFT_DOWN(DCButton::OnClick) +EVT_PAINT(DCButton::OnPaint) +EVT_LEFT_DOWN(DCButton::OnClick) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(DCButton, wxPanel) @@ -36,30 +36,27 @@ DCButton::DCButton() : state(false), size(RENDER_SIZE_16x16), sprite(nullptr), - overlay(nullptr) -{ + overlay(nullptr) { SetSprite(0); } DCButton::DCButton(wxWindow* parent, wxWindowID id, wxPoint pos, int type, RenderSize sz, int sprite_id) : - wxPanel(parent, id, pos, (sz == RENDER_SIZE_64x64? wxSize(68, 68) : sz == RENDER_SIZE_32x32? wxSize(36, 36) : wxSize(20, 20))), + wxPanel(parent, id, pos, (sz == RENDER_SIZE_64x64 ? wxSize(68, 68) : sz == RENDER_SIZE_32x32 ? wxSize(36, 36) + : wxSize(20, 20))), type(type), state(false), size(sz), sprite(nullptr), - overlay(nullptr) -{ + overlay(nullptr) { SetSprite(sprite_id); } -DCButton::~DCButton() -{ +DCButton::~DCButton() { //// } -void DCButton::SetSprite(int _sprid) -{ - if(_sprid != 0) { +void DCButton::SetSprite(int _sprid) { + if (_sprid != 0) { sprite = g_gui.gfx.getSprite(_sprid); } else { sprite = nullptr; @@ -67,20 +64,18 @@ void DCButton::SetSprite(int _sprid) Refresh(); } -void DCButton::SetOverlay(Sprite* espr) -{ +void DCButton::SetOverlay(Sprite* espr) { overlay = espr; Refresh(); } -void DCButton::SetValue(bool val) -{ +void DCButton::SetValue(bool val) { ASSERT(type == DC_BTN_TOGGLE); bool oldval = val; state = val; - if(state == oldval) { + if (state == oldval) { // Cheap to change value to the old one (which is done ALOT) - if(GetValue() && g_settings.getInteger(Config::USE_GUI_SELECTION_SHADOW)) { + if (GetValue() && g_settings.getInteger(Config::USE_GUI_SELECTION_SHADOW)) { SetOverlay(g_gui.gfx.getSprite(EDITOR_SPRITE_SELECTION_MARKER)); } else { SetOverlay(nullptr); @@ -89,17 +84,15 @@ void DCButton::SetValue(bool val) } } -bool DCButton::GetValue() const -{ +bool DCButton::GetValue() const { ASSERT(type == DC_BTN_TOGGLE); return state; } -void DCButton::OnPaint(wxPaintEvent& event) -{ +void DCButton::OnPaint(wxPaintEvent &event) { wxBufferedPaintDC pdc(this); - if(g_gui.gfx.isUnloaded()) { + if (g_gui.gfx.isUnloaded()) { return; } @@ -108,87 +101,88 @@ void DCButton::OnPaint(wxPaintEvent& event) static std::unique_ptr light_shadow_pen; static std::unique_ptr shadow_pen; - if(highlight_pen.get() == nullptr) - highlight_pen.reset(new wxPen(wxColor(0xFF,0xFF,0xFF), 1, wxPENSTYLE_SOLID)); - if(dark_highlight_pen.get() == nullptr) - dark_highlight_pen.reset(new wxPen(wxColor(0xD4,0xD0,0xC8), 1, wxPENSTYLE_SOLID)); - if(light_shadow_pen.get() == nullptr) - light_shadow_pen.reset(new wxPen(wxColor(0x80,0x80,0x80), 1, wxPENSTYLE_SOLID)); - if(shadow_pen.get() == nullptr) - shadow_pen.reset(new wxPen(wxColor(0x40,0x40,0x40), 1, wxPENSTYLE_SOLID)); - + if (highlight_pen.get() == nullptr) { + highlight_pen.reset(new wxPen(wxColor(0xFF, 0xFF, 0xFF), 1, wxPENSTYLE_SOLID)); + } + if (dark_highlight_pen.get() == nullptr) { + dark_highlight_pen.reset(new wxPen(wxColor(0xD4, 0xD0, 0xC8), 1, wxPENSTYLE_SOLID)); + } + if (light_shadow_pen.get() == nullptr) { + light_shadow_pen.reset(new wxPen(wxColor(0x80, 0x80, 0x80), 1, wxPENSTYLE_SOLID)); + } + if (shadow_pen.get() == nullptr) { + shadow_pen.reset(new wxPen(wxColor(0x40, 0x40, 0x40), 1, wxPENSTYLE_SOLID)); + } - int size_x = 20, size_y = 20; + int size_x = 20, size_y = 20; - if(size == RENDER_SIZE_16x16) { + if (size == RENDER_SIZE_16x16) { size_x = 20; size_y = 20; - } else if(size == RENDER_SIZE_32x32) { + } else if (size == RENDER_SIZE_32x32) { size_x = 36; size_y = 36; } pdc.SetBrush(*wxBLACK); - pdc.DrawRectangle(0,0,size_x,size_y); - if(type == DC_BTN_TOGGLE && GetValue()) { + pdc.DrawRectangle(0, 0, size_x, size_y); + if (type == DC_BTN_TOGGLE && GetValue()) { pdc.SetPen(*shadow_pen); - pdc.DrawLine(0 ,0 ,size_x-1,0 ); - pdc.DrawLine(0 ,1 ,0 ,size_y-1); + pdc.DrawLine(0, 0, size_x - 1, 0); + pdc.DrawLine(0, 1, 0, size_y - 1); pdc.SetPen(*light_shadow_pen); - pdc.DrawLine(1 ,1 ,size_x-2,1 ); - pdc.DrawLine(1 ,2 ,1 ,size_y-2); + pdc.DrawLine(1, 1, size_x - 2, 1); + pdc.DrawLine(1, 2, 1, size_y - 2); pdc.SetPen(*dark_highlight_pen); - pdc.DrawLine(size_x-2,1 ,size_x-2,size_y-2); - pdc.DrawLine(1 ,size_y-2,size_x-1,size_y-2); + pdc.DrawLine(size_x - 2, 1, size_x - 2, size_y - 2); + pdc.DrawLine(1, size_y - 2, size_x - 1, size_y - 2); pdc.SetPen(*highlight_pen); - pdc.DrawLine(size_x-1,0 ,size_x-1,size_y-1); - pdc.DrawLine(0 ,size_y-1,size_y,size_y-1); + pdc.DrawLine(size_x - 1, 0, size_x - 1, size_y - 1); + pdc.DrawLine(0, size_y - 1, size_y, size_y - 1); } else { pdc.SetPen(*highlight_pen); - pdc.DrawLine(0 ,0 ,size_x-1,0 ); - pdc.DrawLine(0 ,1 ,0 ,size_y-1); + pdc.DrawLine(0, 0, size_x - 1, 0); + pdc.DrawLine(0, 1, 0, size_y - 1); pdc.SetPen(*dark_highlight_pen); - pdc.DrawLine(1 ,1 ,size_x-2,1 ); - pdc.DrawLine(1 ,2 ,1 ,size_y-2); + pdc.DrawLine(1, 1, size_x - 2, 1); + pdc.DrawLine(1, 2, 1, size_y - 2); pdc.SetPen(*light_shadow_pen); - pdc.DrawLine(size_x-2,1 ,size_x-2,size_y-2); - pdc.DrawLine(1 ,size_y-2,size_x-1,size_y-2); + pdc.DrawLine(size_x - 2, 1, size_x - 2, size_y - 2); + pdc.DrawLine(1, size_y - 2, size_x - 1, size_y - 2); pdc.SetPen(*shadow_pen); - pdc.DrawLine(size_x-1,0 ,size_x-1,size_y-1); - pdc.DrawLine(0 ,size_y-1,size_y,size_y-1); + pdc.DrawLine(size_x - 1, 0, size_x - 1, size_y - 1); + pdc.DrawLine(0, size_y - 1, size_y, size_y - 1); } - if(sprite) { - if(size == RENDER_SIZE_16x16) { + if (sprite) { + if (size == RENDER_SIZE_16x16) { // Draw the picture! sprite->DrawTo(&pdc, SPRITE_SIZE_16x16, 2, 2); - if(overlay && type == DC_BTN_TOGGLE && GetValue()) { + if (overlay && type == DC_BTN_TOGGLE && GetValue()) { overlay->DrawTo(&pdc, SPRITE_SIZE_16x16, 2, 2); } - } else if(size == RENDER_SIZE_32x32) { + } else if (size == RENDER_SIZE_32x32) { // Draw the picture! sprite->DrawTo(&pdc, SPRITE_SIZE_32x32, 2, 2); - if(overlay && type == DC_BTN_TOGGLE && GetValue()) { + if (overlay && type == DC_BTN_TOGGLE && GetValue()) { overlay->DrawTo(&pdc, SPRITE_SIZE_32x32, 2, 2); } - } else if(size == RENDER_SIZE_64x64) { + } else if (size == RENDER_SIZE_64x64) { //// } } } -void DCButton::OnClick(wxMouseEvent& WXUNUSED(evt)) -{ - wxCommandEvent event(type == DC_BTN_TOGGLE? wxEVT_COMMAND_TOGGLEBUTTON_CLICKED : wxEVT_COMMAND_BUTTON_CLICKED, GetId()); +void DCButton::OnClick(wxMouseEvent &WXUNUSED(evt)) { + wxCommandEvent event(type == DC_BTN_TOGGLE ? wxEVT_COMMAND_TOGGLEBUTTON_CLICKED : wxEVT_COMMAND_BUTTON_CLICKED, GetId()); event.SetEventObject(this); - if(type == DC_BTN_TOGGLE) { + if (type == DC_BTN_TOGGLE) { SetValue(!GetValue()); } SetFocus(); GetEventHandler()->ProcessEvent(event); } - diff --git a/source/dcbutton.h b/source/dcbutton.h index 08afccbe..d455d481 100644 --- a/source/dcbutton.h +++ b/source/dcbutton.h @@ -33,8 +33,7 @@ enum RenderSize { RENDER_SIZE_64x64, }; -class DCButton : public wxPanel -{ +class DCButton : public wxPanel { public: DCButton(); DCButton(wxWindow* parent, wxWindowID id, wxPoint pos, int type, RenderSize sz, int sprite_id); @@ -45,8 +44,9 @@ class DCButton : public wxPanel void SetSprite(int id); - void OnPaint(wxPaintEvent&); - void OnClick(wxMouseEvent&); + void OnPaint(wxPaintEvent &); + void OnClick(wxMouseEvent &); + protected: void SetOverlay(Sprite* espr); diff --git a/source/definitions.h b/source/definitions.h index ff3475ce..2744b995 100644 --- a/source/definitions.h +++ b/source/definitions.h @@ -22,31 +22,30 @@ // Version info // xxyyzzt (major, minor, subversion) -#define __RME_VERSION_MAJOR__ 3 -#define __RME_VERSION_MINOR__ 8 -#define __RME_SUBVERSION__ 0 +#define __RME_VERSION_MAJOR__ 3 +#define __RME_VERSION_MINOR__ 8 +#define __RME_SUBVERSION__ 0 -#define __LIVE_NET_VERSION__ 5 +#define __LIVE_NET_VERSION__ 5 #define MAKE_VERSION_ID(major, minor, subversion) \ - ((major) * 10000000 + \ - (minor) * 100000 + \ - (subversion) * 1000) + ((major)*10000000 + (minor)*100000 + (subversion)*1000) -#define __RME_VERSION_ID__ MAKE_VERSION_ID(\ - __RME_VERSION_MAJOR__, \ - __RME_VERSION_MINOR__, \ - __RME_SUBVERSION__) +#define __RME_VERSION_ID__ MAKE_VERSION_ID( \ + __RME_VERSION_MAJOR__, \ + __RME_VERSION_MINOR__, \ + __RME_SUBVERSION__ \ +) #ifdef __EXPERIMENTAL__ -# define __RME_VERSION__ std::string(i2s(__RME_VERSION_MAJOR__) + "." + i2s(__RME_VERSION_MINOR__) + "." + i2s(__RME_SUBVERSION__) + " BETA") -# define __W_RME_VERSION__ (wxString() << __RME_VERSION_MAJOR__ << "." << __RME_VERSION_MINOR__ << "." << __RME_SUBVERSION__ << " BETA") + #define __RME_VERSION__ std::string(i2s(__RME_VERSION_MAJOR__) + "." + i2s(__RME_VERSION_MINOR__) + "." + i2s(__RME_SUBVERSION__) + " BETA") + #define __W_RME_VERSION__ (wxString() << __RME_VERSION_MAJOR__ << "." << __RME_VERSION_MINOR__ << "." << __RME_SUBVERSION__ << " BETA") #elif __SNAPSHOT__ -# define __RME_VERSION__ std::string(i2s(__RME_VERSION_MAJOR__) + "." + i2s(__RME_VERSION_MINOR__) + "." + i2s(__RME_SUBVERSION__) + " - SNAPSHOT") -# define __W_RME_VERSION__ (wxString() << __RME_VERSION_MAJOR__ << "." << __RME_VERSION_MINOR__ << "." << __RME_SUBVERSION__ << " - SNAPSHOT") + #define __RME_VERSION__ std::string(i2s(__RME_VERSION_MAJOR__) + "." + i2s(__RME_VERSION_MINOR__) + "." + i2s(__RME_SUBVERSION__) + " - SNAPSHOT") + #define __W_RME_VERSION__ (wxString() << __RME_VERSION_MAJOR__ << "." << __RME_VERSION_MINOR__ << "." << __RME_SUBVERSION__ << " - SNAPSHOT") #else -# define __RME_VERSION__ std::string(i2s(__RME_VERSION_MAJOR__) + "." + i2s(__RME_VERSION_MINOR__) + "." + i2s(__RME_SUBVERSION__)) -# define __W_RME_VERSION__ (wxString() << __RME_VERSION_MAJOR__ << "." << __RME_VERSION_MINOR__ << "." << __RME_SUBVERSION__) + #define __RME_VERSION__ std::string(i2s(__RME_VERSION_MAJOR__) + "." + i2s(__RME_VERSION_MINOR__) + "." + i2s(__RME_SUBVERSION__)) + #define __W_RME_VERSION__ (wxString() << __RME_VERSION_MAJOR__ << "." << __RME_VERSION_MINOR__ << "." << __RME_SUBVERSION__) #endif // OS @@ -55,55 +54,55 @@ #define ASSETS_NAME "Tibia" #ifdef __VISUALC__ -#pragma warning(disable:4996) // Stupid MSVC complaining 'bout "unsafe" functions -#pragma warning(disable:4800) // Bool conversion warning -#pragma warning(disable:4100) // Unused parameter warning ( I like to name unused stuff... ) -#pragma warning(disable:4706) // Assignment within conditional expression + #pragma warning(disable : 4996) // Stupid MSVC complaining 'bout "unsafe" functions + #pragma warning(disable : 4800) // Bool conversion warning + #pragma warning(disable : 4100) // Unused parameter warning ( I like to name unused stuff... ) + #pragma warning(disable : 4706) // Assignment within conditional expression #endif #ifndef FORCEINLINE -# ifdef __VISUALC__ -# define FORCEINLINE __forceinline -# else -# define FORCEINLINE inline -# endif + #ifdef __VISUALC__ + #define FORCEINLINE __forceinline + #else + #define FORCEINLINE inline + #endif #endif // Debug mode? #if defined __DEBUG__ || defined _DEBUG || defined __DEBUG_MODE__ -# undef __DEBUG_MODE__ -# define __DEBUG_MODE__ 1 -# undef _DEBUG -# define _DEBUG 1 -# undef __DEBUG__ -# define __DEBUG__ 1 + #undef __DEBUG_MODE__ + #define __DEBUG_MODE__ 1 + #undef _DEBUG + #define _DEBUG 1 + #undef __DEBUG__ + #define __DEBUG__ 1 #else -# ifndef __RELEASE__ -# define __RELEASE__ 1 -# endif -# ifndef NDEBUG -# define NDEBUG 1 -# endif + #ifndef __RELEASE__ + #define __RELEASE__ 1 + #endif + #ifndef NDEBUG + #define NDEBUG 1 + #endif #endif #ifdef __RELEASE__ -# ifdef __VISUALC__ -# define _SCL_SECURE 0 -# define _SECURE_SCL 0 // They can't even decide on a coherent define interface! -# define _HAS_ITERATOR_DEBUGGING 0 -# endif + #ifdef __VISUALC__ + #define _SCL_SECURE 0 + #define _SECURE_SCL 0 // They can't even decide on a coherent define interface! + #define _HAS_ITERATOR_DEBUGGING 0 + #endif #endif #ifndef _DONT_USE_UPDATER_ -# if defined __WINDOWS__ && !defined _USE_UPDATER_ -# define _USE_UPDATER_ -# endif + #if defined __WINDOWS__ && !defined _USE_UPDATER_ + #define _USE_UPDATER_ + #endif #endif #ifndef _DONT_USE_PROCESS_COM -# if defined __WINDOWS__ && !defined _USE_PROCESS_COM -# define _USE_PROCESS_COM -# endif + #if defined __WINDOWS__ && !defined _USE_PROCESS_COM + #define _USE_PROCESS_COM + #endif #endif #define MAP_LOAD_FILE_WILDCARD_OTGZ "OpenTibia Binary Map (*.otbm;*.otgz)|*.otbm;*.otgz" @@ -117,24 +116,24 @@ #define wxstr(str) wxString((str).c_str(), wxConvUTF8) // increment & decrement definitions -#define IMPLEMENT_INCREMENT_OP(Type) \ - namespace { \ - Type& operator++(Type& type) { \ +#define IMPLEMENT_INCREMENT_OP(Type) \ + namespace { \ + Type &operator++(Type &type) { \ return (type = static_cast(type + 1)); \ - } \ - Type operator++(Type& type, int) { \ - return static_cast((++type) - 1); \ - } \ + } \ + Type operator++(Type &type, int) { \ + return static_cast((++type) - 1); \ + } \ } -#define IMPLEMENT_DECREMENT_OP(Type) \ - namespace { \ - Type& operator--(Type& type) { \ +#define IMPLEMENT_DECREMENT_OP(Type) \ + namespace { \ + Type &operator--(Type &type) { \ return (type = static_cast(type - 1)); \ - } \ - Type operator--(Type& type, int) { \ - return static_cast((--type) + 1); \ - } \ + } \ + Type operator--(Type &type, int) { \ + return static_cast((--type) + 1); \ + } \ } #endif diff --git a/source/doodad_brush.cpp b/source/doodad_brush.cpp index 09d42e54..6a21c74a 100644 --- a/source/doodad_brush.cpp +++ b/source/doodad_brush.cpp @@ -33,76 +33,72 @@ DoodadBrush::DoodadBrush() : do_new_borders(false), on_duplicate(false), clear_mapflags(0), - clear_statflags(0) -{ + clear_statflags(0) { //// } -DoodadBrush::~DoodadBrush() -{ - for(std::vector::iterator alt_iter = alternatives.begin(); alt_iter != alternatives.end(); ++alt_iter) { +DoodadBrush::~DoodadBrush() { + for (std::vector::iterator alt_iter = alternatives.begin(); alt_iter != alternatives.end(); ++alt_iter) { delete *alt_iter; } } DoodadBrush::AlternativeBlock::AlternativeBlock() : composite_chance(0), - single_chance(0) -{ + single_chance(0) { //// } -DoodadBrush::AlternativeBlock::~AlternativeBlock() -{ - for(std::vector::iterator composite_iter = composite_items.begin(); composite_iter != composite_items.end(); ++composite_iter) { - CompositeTileList& tv = composite_iter->items; +DoodadBrush::AlternativeBlock::~AlternativeBlock() { + for (std::vector::iterator composite_iter = composite_items.begin(); composite_iter != composite_items.end(); ++composite_iter) { + CompositeTileList &tv = composite_iter->items; - for(CompositeTileList::iterator compt_iter = tv.begin(); compt_iter != tv.end(); ++compt_iter) { - ItemVector& items = compt_iter->second; - for(ItemVector::iterator iiter = items.begin(); iiter != items.end(); ++iiter) + for (CompositeTileList::iterator compt_iter = tv.begin(); compt_iter != tv.end(); ++compt_iter) { + ItemVector &items = compt_iter->second; + for (ItemVector::iterator iiter = items.begin(); iiter != items.end(); ++iiter) { delete *iiter; + } } } - for(std::vector::iterator single_iter = single_items.begin(); single_iter != single_items.end(); ++single_iter) { + for (std::vector::iterator single_iter = single_items.begin(); single_iter != single_items.end(); ++single_iter) { delete single_iter->item; } } -bool DoodadBrush::loadAlternative(pugi::xml_node node, wxArrayString& warnings, AlternativeBlock* which) -{ +bool DoodadBrush::loadAlternative(pugi::xml_node node, wxArrayString &warnings, AlternativeBlock* which) { AlternativeBlock* alternativeBlock; - if(which) { + if (which) { alternativeBlock = which; } else { alternativeBlock = newd AlternativeBlock(); } pugi::xml_attribute attribute; - for(pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { - const std::string& childName = as_lower_str(childNode.name()); - if(childName == "item") { - if(!(attribute = childNode.attribute("chance"))) { + for (pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { + const std::string &childName = as_lower_str(childNode.name()); + if (childName == "item") { + if (!(attribute = childNode.attribute("chance"))) { warnings.push_back("Can't read chance tag of doodad item node."); continue; } Item* item = Item::Create(childNode); - if(!item) { + if (!item) { warnings.push_back("Can't create item from doodad item node."); continue; } ItemType* type = g_items.getRawItemType(item->getID()); - if(type) { + if (type) { type->doodad_brush = this; } - SingleBlock sb{ attribute.as_int(), item }; + SingleBlock sb { attribute.as_int(), item }; alternativeBlock->single_items.push_back(sb); alternativeBlock->single_chance += sb.chance; - } else if(childName == "composite") { - if(!(attribute = childNode.attribute("chance"))) { + } else if (childName == "composite") { + if (!(attribute = childNode.attribute("chance"))) { warnings.push_back("Can't read chance tag of doodad item node."); continue; } @@ -112,53 +108,53 @@ bool DoodadBrush::loadAlternative(pugi::xml_node node, wxArrayString& warnings, CompositeBlock cb; cb.chance = alternativeBlock->composite_chance; - for(pugi::xml_node compositeNode = childNode.first_child(); compositeNode; compositeNode = compositeNode.next_sibling()) { - if(as_lower_str(compositeNode.name()) != "tile") { + for (pugi::xml_node compositeNode = childNode.first_child(); compositeNode; compositeNode = compositeNode.next_sibling()) { + if (as_lower_str(compositeNode.name()) != "tile") { continue; } - if(!(attribute = compositeNode.attribute("x"))) { + if (!(attribute = compositeNode.attribute("x"))) { warnings.push_back("Couldn't read positionX values of composite tile node."); continue; } int32_t x = attribute.as_int(); - if(!(attribute = compositeNode.attribute("y"))) { + if (!(attribute = compositeNode.attribute("y"))) { warnings.push_back("Couldn't read positionY values of composite tile node."); continue; } int32_t y = attribute.as_int(); int32_t z = compositeNode.attribute("z").as_int(); - if(x < -0x7FFF || x > 0x7FFF) { + if (x < -0x7FFF || x > 0x7FFF) { warnings.push_back("Invalid range of x value on composite tile node."); continue; - } else if(y < -0x7FFF || y > 0x7FFF) { + } else if (y < -0x7FFF || y > 0x7FFF) { warnings.push_back("Invalid range of y value on composite tile node."); continue; - } else if(z < -0x7 || z > 0x7) { + } else if (z < -0x7 || z > 0x7) { warnings.push_back("Invalid range of z value on composite tile node."); continue; } ItemVector items; - for(pugi::xml_node itemNode = compositeNode.first_child(); itemNode; itemNode = itemNode.next_sibling()) { - if(as_lower_str(itemNode.name()) != "item") { + for (pugi::xml_node itemNode = compositeNode.first_child(); itemNode; itemNode = itemNode.next_sibling()) { + if (as_lower_str(itemNode.name()) != "item") { continue; } Item* item = Item::Create(itemNode); - if(item) { + if (item) { items.push_back(item); ItemType* type = g_items.getRawItemType(item->getID()); - if(type) { + if (type) { type->doodad_brush = this; } } } - if(!items.empty()) { + if (!items.empty()) { cb.items.push_back(std::make_pair(Position(x, y, z), items)); } } @@ -166,76 +162,75 @@ bool DoodadBrush::loadAlternative(pugi::xml_node node, wxArrayString& warnings, } } - if(!which) { + if (!which) { alternatives.push_back(alternativeBlock); } return true; } -bool DoodadBrush::load(pugi::xml_node node, wxArrayString& warnings) -{ +bool DoodadBrush::load(pugi::xml_node node, wxArrayString &warnings) { pugi::xml_attribute attribute; - if((attribute = node.attribute("lookid"))) { + if ((attribute = node.attribute("lookid"))) { look_id = attribute.as_uint(); } - if((attribute = node.attribute("server_lookid"))) { + if ((attribute = node.attribute("server_lookid"))) { look_id = g_items.getItemType(attribute.as_uint()).clientID; } - if((attribute = node.attribute("on_blocking"))) { + if ((attribute = node.attribute("on_blocking"))) { on_blocking = attribute.as_bool(); } - if((attribute = node.attribute("on_duplicate"))) { + if ((attribute = node.attribute("on_duplicate"))) { on_duplicate = attribute.as_bool(); } - if((attribute = node.attribute("redo_borders")) || (attribute = node.attribute("reborder"))) { + if ((attribute = node.attribute("redo_borders")) || (attribute = node.attribute("reborder"))) { do_new_borders = attribute.as_bool(); } - if((attribute = node.attribute("one_size"))) { + if ((attribute = node.attribute("one_size"))) { one_size = attribute.as_bool(); } - if((attribute = node.attribute("draggable"))) { + if ((attribute = node.attribute("draggable"))) { draggable = attribute.as_bool(); } - if(node.attribute("remove_optional_border").as_bool()) { - if(!do_new_borders) { + if (node.attribute("remove_optional_border").as_bool()) { + if (!do_new_borders) { warnings.push_back("remove_optional_border will not work without redo_borders\n"); } clear_statflags |= TILESTATE_OP_BORDER; } - const std::string& thicknessString = node.attribute("thickness").as_string(); - if(!thicknessString.empty()) { + const std::string &thicknessString = node.attribute("thickness").as_string(); + if (!thicknessString.empty()) { size_t slash = thicknessString.find('/'); - if(slash != std::string::npos) { + if (slash != std::string::npos) { try { thickness = std::stoi(thicknessString.substr(0, slash)); - } catch (const std::invalid_argument&) { + } catch (const std::invalid_argument &) { thickness = 0; - } catch (const std::out_of_range&) { + } catch (const std::out_of_range &) { thickness = 0; } try { thickness_ceiling = std::stoi(thicknessString.substr(slash + 1)); - } catch (const std::invalid_argument&) { + } catch (const std::invalid_argument &) { thickness_ceiling = 0; - } catch (const std::out_of_range&) { + } catch (const std::out_of_range &) { thickness_ceiling = 0; } } } - for(pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { - if(as_lower_str(childNode.name()) != "alternate") { + for (pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { + if (as_lower_str(childNode.name()) != "alternate") { continue; } - if(!loadAlternative(childNode, warnings)) { + if (!loadAlternative(childNode, warnings)) { return false; } } @@ -243,21 +238,20 @@ bool DoodadBrush::load(pugi::xml_node node, wxArrayString& warnings) return true; } -bool DoodadBrush::AlternativeBlock::ownsItem(uint16_t id) const -{ - for(std::vector::const_iterator single_iter = single_items.begin(); single_iter != single_items.end(); ++single_iter) { - if(single_iter->item->getID() == id) { +bool DoodadBrush::AlternativeBlock::ownsItem(uint16_t id) const { + for (std::vector::const_iterator single_iter = single_items.begin(); single_iter != single_items.end(); ++single_iter) { + if (single_iter->item->getID() == id) { return true; } } - for(std::vector::const_iterator composite_iter = composite_items.begin(); composite_iter != composite_items.end(); ++composite_iter) { - const CompositeTileList& ctl = composite_iter->items; - for(CompositeTileList::const_iterator comp_iter = ctl.begin(); comp_iter != ctl.end(); ++comp_iter) { - const ItemVector& items = comp_iter->second; + for (std::vector::const_iterator composite_iter = composite_items.begin(); composite_iter != composite_items.end(); ++composite_iter) { + const CompositeTileList &ctl = composite_iter->items; + for (CompositeTileList::const_iterator comp_iter = ctl.begin(); comp_iter != ctl.end(); ++comp_iter) { + const ItemVector &items = comp_iter->second; - for(ItemVector::const_iterator item_iter = items.begin(), item_end = items.end(); item_iter != item_end; ++item_iter) { - if((*item_iter)->getID() == id) { + for (ItemVector::const_iterator item_iter = items.begin(), item_end = items.end(); item_iter != item_end; ++item_iter) { + if ((*item_iter)->getID() == id) { return true; } } @@ -266,30 +260,30 @@ bool DoodadBrush::AlternativeBlock::ownsItem(uint16_t id) const return false; } -bool DoodadBrush::ownsItem(Item* item) const -{ - if(item->getDoodadBrush() == this) return true; +bool DoodadBrush::ownsItem(Item* item) const { + if (item->getDoodadBrush() == this) { + return true; + } uint16_t id = item->getID(); - for(std::vector::const_iterator alt_iter = alternatives.begin(); alt_iter != alternatives.end(); ++alt_iter) { - if((*alt_iter)->ownsItem(id)) { + for (std::vector::const_iterator alt_iter = alternatives.begin(); alt_iter != alternatives.end(); ++alt_iter) { + if ((*alt_iter)->ownsItem(id)) { return true; } } return false; } -void DoodadBrush::undraw(BaseMap* map, Tile* tile) -{ +void DoodadBrush::undraw(BaseMap* map, Tile* tile) { // Remove all doodad-related - for(ItemVector::iterator item_iter = tile->items.begin(); item_iter != tile->items.end();) { + for (ItemVector::iterator item_iter = tile->items.begin(); item_iter != tile->items.end();) { Item* item = *item_iter; - if(item->getDoodadBrush() != nullptr) { - if(item->isComplex() && g_settings.getInteger(Config::ERASER_LEAVE_UNIQUE)) { + if (item->getDoodadBrush() != nullptr) { + if (item->isComplex() && g_settings.getInteger(Config::ERASER_LEAVE_UNIQUE)) { ++item_iter; - } else if(g_settings.getInteger(Config::DOODAD_BRUSH_ERASE_LIKE)) { + } else if (g_settings.getInteger(Config::DOODAD_BRUSH_ERASE_LIKE)) { // Only delete items of the same doodad brush - if(ownsItem(item)) { + if (ownsItem(item)) { delete item; item_iter = tile->items.erase(item_iter); } else { @@ -304,10 +298,10 @@ void DoodadBrush::undraw(BaseMap* map, Tile* tile) } } - if(tile->ground && tile->ground->getDoodadBrush() != nullptr) { - if(g_settings.getInteger(Config::DOODAD_BRUSH_ERASE_LIKE)) { + if (tile->ground && tile->ground->getDoodadBrush() != nullptr) { + if (g_settings.getInteger(Config::DOODAD_BRUSH_ERASE_LIKE)) { // Only delete items of the same doodad brush - if(ownsItem(tile->ground)) { + if (ownsItem(tile->ground)) { delete tile->ground; tile->ground = nullptr; } @@ -318,106 +312,114 @@ void DoodadBrush::undraw(BaseMap* map, Tile* tile) } } -void DoodadBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void DoodadBrush::draw(BaseMap* map, Tile* tile, void* parameter) { int variation = 0; - if(parameter) { + if (parameter) { variation = *reinterpret_cast(parameter); } - if(alternatives.empty()) return; + if (alternatives.empty()) { + return; + } variation %= alternatives.size(); const AlternativeBlock* ab_ptr = alternatives[variation]; ASSERT(ab_ptr); int roll = random(1, ab_ptr->single_chance); - for(std::vector::const_iterator block_iter = ab_ptr->single_items.begin(); block_iter != ab_ptr->single_items.end(); ++block_iter) { - const SingleBlock& sb = *block_iter; - if(roll <= sb.chance) { + for (std::vector::const_iterator block_iter = ab_ptr->single_items.begin(); block_iter != ab_ptr->single_items.end(); ++block_iter) { + const SingleBlock &sb = *block_iter; + if (roll <= sb.chance) { // Use this! tile->addItem(sb.item->deepCopy()); break; } roll -= sb.chance; } - if(clear_mapflags || clear_statflags) { + if (clear_mapflags || clear_statflags) { tile->setMapFlags(tile->getMapFlags() & (~clear_mapflags)); tile->setMapFlags(tile->getStatFlags() & (~clear_statflags)); } } -const CompositeTileList& DoodadBrush::getComposite(int variation) const -{ +const CompositeTileList &DoodadBrush::getComposite(int variation) const { static CompositeTileList empty; - if(alternatives.empty()) + if (alternatives.empty()) { return empty; + } variation %= alternatives.size(); const AlternativeBlock* ab_ptr = alternatives[variation]; ASSERT(ab_ptr); int roll = random(1, ab_ptr->composite_chance); - for(std::vector::const_iterator block_iter = ab_ptr->composite_items.begin(); block_iter != ab_ptr->composite_items.end(); ++block_iter) { - const CompositeBlock& cb = *block_iter; - if(roll <= cb.chance) { + for (std::vector::const_iterator block_iter = ab_ptr->composite_items.begin(); block_iter != ab_ptr->composite_items.end(); ++block_iter) { + const CompositeBlock &cb = *block_iter; + if (roll <= cb.chance) { return cb.items; } } return empty; } -bool DoodadBrush::isEmpty(int variation) const -{ - if(hasCompositeObjects(variation)) +bool DoodadBrush::isEmpty(int variation) const { + if (hasCompositeObjects(variation)) { return false; - if(hasSingleObjects(variation)) + } + if (hasSingleObjects(variation)) { return false; - if(thickness <= 0) + } + if (thickness <= 0) { return false; + } return true; } -int DoodadBrush::getCompositeChance(int ab) const -{ - if(alternatives.empty()) return 0; +int DoodadBrush::getCompositeChance(int ab) const { + if (alternatives.empty()) { + return 0; + } ab %= alternatives.size(); const AlternativeBlock* ab_ptr = alternatives[ab]; ASSERT(ab_ptr); return ab_ptr->composite_chance; } -int DoodadBrush::getSingleChance(int ab) const -{ - if(alternatives.empty()) return 0; +int DoodadBrush::getSingleChance(int ab) const { + if (alternatives.empty()) { + return 0; + } ab %= alternatives.size(); const AlternativeBlock* ab_ptr = alternatives[ab]; ASSERT(ab_ptr); return ab_ptr->single_chance; } -int DoodadBrush::getTotalChance(int ab) const -{ - if(alternatives.empty()) return 0; +int DoodadBrush::getTotalChance(int ab) const { + if (alternatives.empty()) { + return 0; + } ab %= alternatives.size(); const AlternativeBlock* ab_ptr = alternatives[ab]; ASSERT(ab_ptr); return ab_ptr->composite_chance + ab_ptr->single_chance; } -bool DoodadBrush::hasSingleObjects(int ab) const -{ - if(alternatives.empty()) return false; +bool DoodadBrush::hasSingleObjects(int ab) const { + if (alternatives.empty()) { + return false; + } ab %= alternatives.size(); AlternativeBlock* ab_ptr = alternatives[ab]; ASSERT(ab_ptr); return ab_ptr->single_chance > 0; } -bool DoodadBrush::hasCompositeObjects(int ab) const -{ - if(alternatives.empty()) return false; +bool DoodadBrush::hasCompositeObjects(int ab) const { + if (alternatives.empty()) { + return false; + } ab %= alternatives.size(); AlternativeBlock* ab_ptr = alternatives[ab]; ASSERT(ab_ptr); diff --git a/source/doodad_brush.h b/source/doodad_brush.h index 29751d76..5253c61b 100644 --- a/source/doodad_brush.h +++ b/source/doodad_brush.h @@ -23,33 +23,42 @@ //============================================================================= // Doodadbrush, add doodads! -typedef std::vector > CompositeTileList; +typedef std::vector> CompositeTileList; -class DoodadBrush : public Brush -{ +class DoodadBrush : public Brush { public: DoodadBrush(); virtual ~DoodadBrush(); - bool isDoodad() const { return true; } - DoodadBrush* asDoodad() { return static_cast(this); } + bool isDoodad() const { + return true; + } + DoodadBrush* asDoodad() { + return static_cast(this); + } protected: struct AlternativeBlock; public: - bool loadAlternative(pugi::xml_node node, wxArrayString& warnings, AlternativeBlock* which = nullptr); - virtual bool load(pugi::xml_node node, wxArrayString& warnings); + bool loadAlternative(pugi::xml_node node, wxArrayString &warnings, AlternativeBlock* which = nullptr); + virtual bool load(pugi::xml_node node, wxArrayString &warnings); - virtual bool canDraw(BaseMap* map, const Position& position) const { return true; } + virtual bool canDraw(BaseMap* map, const Position &position) const { + return true; + } virtual void draw(BaseMap* map, Tile* tile, void* parameter); - const CompositeTileList& getComposite(int variation) const; + const CompositeTileList &getComposite(int variation) const; virtual void undraw(BaseMap* map, Tile* tile); bool isEmpty(int variation) const; - int getThickness() const {return thickness;} - int getThicknessCeiling() const {return thickness_ceiling;} + int getThickness() const { + return thickness; + } + int getThicknessCeiling() const { + return thickness_ceiling; + } int getCompositeChance(int variation) const; int getSingleChance(int variation) const; @@ -58,18 +67,38 @@ class DoodadBrush : public Brush bool hasSingleObjects(int variation) const; bool hasCompositeObjects(int variation) const; - bool placeOnBlocking() const { return on_blocking; } - bool placeOnDuplicate() const { return on_duplicate; } - bool doNewBorders() const { return do_new_borders; } + bool placeOnBlocking() const { + return on_blocking; + } + bool placeOnDuplicate() const { + return on_duplicate; + } + bool doNewBorders() const { + return do_new_borders; + } bool ownsItem(Item* item) const; - virtual bool canSmear() const { return draggable; } - virtual bool canDrag() const { return false; } - virtual bool oneSizeFitsAll() const { return one_size; } - virtual int getLookID() const { return look_id; } - virtual int getMaxVariation() const { return alternatives.size(); } - virtual std::string getName() const { return name; } - virtual void setName(const std::string& newName) { name = newName; } + virtual bool canSmear() const { + return draggable; + } + virtual bool canDrag() const { + return false; + } + virtual bool oneSizeFitsAll() const { + return one_size; + } + virtual int getLookID() const { + return look_id; + } + virtual int getMaxVariation() const { + return alternatives.size(); + } + virtual std::string getName() const { + return name; + } + virtual void setName(const std::string &newName) { + name = newName; + } protected: std::string name; diff --git a/source/editor.cpp b/source/editor.cpp index e54e809a..931a9602 100644 --- a/source/editor.cpp +++ b/source/editor.cpp @@ -41,24 +41,24 @@ #include "live_client.h" #include "live_action.h" -Editor::Editor(CopyBuffer& copybuffer) : +Editor::Editor(CopyBuffer ©buffer) : live_server(nullptr), live_client(nullptr), actionQueue(newd ActionQueue(*this)), selection(*this), copybuffer(copybuffer), - replace_brush(nullptr) -{ + replace_brush(nullptr) { wxString error; wxArrayString warnings; bool ok = true; ClientVersionID defaultVersion = ClientVersionID(g_settings.getInteger(Config::DEFAULT_CLIENT_VERSION)); - if(defaultVersion == CLIENT_VERSION_NONE) + if (defaultVersion == CLIENT_VERSION_NONE) { defaultVersion = ClientVersion::getLatestVersion()->getID(); + } - if(g_gui.GetCurrentVersionID() != defaultVersion) { - if(g_gui.CloseAllEditors()) { + if (g_gui.GetCurrentVersionID() != defaultVersion) { + if (g_gui.CloseAllEditors()) { ok = g_gui.LoadVersion(defaultVersion, error, warnings); g_gui.PopupDialog("Error", error, wxOK); g_gui.ListDialog("Warnings", warnings); @@ -67,8 +67,9 @@ Editor::Editor(CopyBuffer& copybuffer) : } } - if(!ok) + if (!ok) { throw std::runtime_error("Couldn't load client version"); + } MapVersion version; version.otbm = g_gui.GetCurrentVersion().getPrefferedMapVersionID(); @@ -91,16 +92,15 @@ Editor::Editor(CopyBuffer& copybuffer) : map.doChange(); } -Editor::Editor(CopyBuffer& copybuffer, const FileName& fn) : +Editor::Editor(CopyBuffer ©buffer, const FileName &fn) : live_server(nullptr), live_client(nullptr), actionQueue(newd ActionQueue(*this)), selection(*this), copybuffer(copybuffer), - replace_brush(nullptr) -{ + replace_brush(nullptr) { MapVersion ver; - if(!IOMapOTBM::getVersionInfo(fn, ver)) { + if (!IOMapOTBM::getVersionInfo(fn, ver)) { // g_gui.PopupDialog("Error", "Could not open file \"" + fn.GetFullPath() + "\".", wxOK); throw std::runtime_error("Could not open file \"" + nstr(fn.GetFullPath()) + "\".\nThis is not a valid OTBM file or it does not exist."); } @@ -116,21 +116,22 @@ Editor::Editor(CopyBuffer& copybuffer, const FileName& fn) : */ bool success = true; - if(g_gui.GetCurrentVersionID() != ver.client) { + if (g_gui.GetCurrentVersionID() != ver.client) { wxString error; wxArrayString warnings; - if(g_gui.CloseAllEditors()) { + if (g_gui.CloseAllEditors()) { success = g_gui.LoadVersion(ver.client, error, warnings); - if(!success) + if (!success) { g_gui.PopupDialog("Error", error, wxOK); - else + } else { g_gui.ListDialog("Warnings", warnings); + } } else { throw std::runtime_error("All maps of different versions were not closed."); } } - if(success) { + if (success) { ScopedLoadingBar LoadingBar("Loading OTBM map..."); success = map.open(nstr(fn.GetFullPath())); /* TODO @@ -146,20 +147,18 @@ Editor::Editor(CopyBuffer& copybuffer, const FileName& fn) : } } -Editor::Editor(CopyBuffer& copybuffer, LiveClient* client) : +Editor::Editor(CopyBuffer ©buffer, LiveClient* client) : live_server(nullptr), live_client(client), actionQueue(newd NetworkedActionQueue(*this)), selection(*this), copybuffer(copybuffer), - replace_brush(nullptr) -{ + replace_brush(nullptr) { ; } -Editor::~Editor() -{ - if(IsLive()) { +Editor::~Editor() { + if (IsLive()) { CloseLiveServer(); } @@ -168,91 +167,82 @@ Editor::~Editor() delete actionQueue; } -Action* Editor::createAction(ActionIdentifier type) -{ +Action* Editor::createAction(ActionIdentifier type) { return actionQueue->createAction(type); } -Action* Editor::createAction(BatchAction* parent) -{ +Action* Editor::createAction(BatchAction* parent) { return actionQueue->createAction(parent); } -BatchAction* Editor::createBatch(ActionIdentifier type) -{ +BatchAction* Editor::createBatch(ActionIdentifier type) { return actionQueue->createBatch(type); } -void Editor::addBatch(BatchAction* action, int stacking_delay) -{ +void Editor::addBatch(BatchAction* action, int stacking_delay) { actionQueue->addBatch(action, stacking_delay); } -void Editor::addAction(Action* action, int stacking_delay ) -{ +void Editor::addAction(Action* action, int stacking_delay) { actionQueue->addAction(action, stacking_delay); } -bool Editor::canUndo() const -{ +bool Editor::canUndo() const { return actionQueue->canUndo(); } -bool Editor::canRedo() const -{ +bool Editor::canRedo() const { return actionQueue->canRedo(); } -void Editor::undo(int indexes) -{ - if(indexes <= 0 || !actionQueue->canUndo()) +void Editor::undo(int indexes) { + if (indexes <= 0 || !actionQueue->canUndo()) { return; + } - while(indexes > 0) { - if(!actionQueue->undo()) + while (indexes > 0) { + if (!actionQueue->undo()) { break; + } indexes--; } g_gui.UpdateActions(); g_gui.RefreshView(); } -void Editor::redo(int indexes) -{ - if(indexes <= 0 || !actionQueue->canRedo()) +void Editor::redo(int indexes) { + if (indexes <= 0 || !actionQueue->canRedo()) { return; + } - while(indexes > 0) { - if(!actionQueue->redo()) + while (indexes > 0) { + if (!actionQueue->redo()) { break; + } indexes--; } g_gui.UpdateActions(); g_gui.RefreshView(); } -void Editor::updateActions() -{ +void Editor::updateActions() { actionQueue->generateLabels(); g_gui.UpdateMenus(); g_gui.UpdateActions(); } -void Editor::resetActionsTimer() -{ +void Editor::resetActionsTimer() { actionQueue->resetTimer(); } -void Editor::clearActions() -{ +void Editor::clearActions() { actionQueue->clear(); g_gui.UpdateActions(); } -bool Editor::hasChanges() const -{ - if(map.hasChanged()) { - if(map.getTileCount() == 0) { +bool Editor::hasChanges() const { + if (map.hasChanged()) { + if (map.getTileCount() == 0) { return actionQueue->hasChanges(); } return true; @@ -260,18 +250,16 @@ bool Editor::hasChanges() const return false; } -void Editor::clearChanges() -{ +void Editor::clearChanges() { map.clearChanges(); } -void Editor::saveMap(FileName filename, bool showdialog) -{ +void Editor::saveMap(FileName filename, bool showdialog) { std::string savefile = filename.GetFullPath().mb_str(wxConvUTF8).data(); bool save_as = false; bool save_otgz = false; - if(savefile.empty()) { + if (savefile.empty()) { savefile = map.filename; FileName c1(wxstr(savefile)); @@ -280,7 +268,7 @@ void Editor::saveMap(FileName filename, bool showdialog) } // If not named yet, propagate the file name to the auxilliary files - if(map.unnamed) { + if (map.unnamed) { FileName _name(filename); _name.SetExt("xml"); @@ -300,39 +288,39 @@ void Editor::saveMap(FileName filename, bool showdialog) std::string map_path = nstr(converter.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME)); // Make temporary backups - //converter.Assign(wxstr(savefile)); + // converter.Assign(wxstr(savefile)); std::string backup_otbm, backup_house, backup_spawn, backup_spawn_npc; - if(converter.GetExt() == "otgz") { + if (converter.GetExt() == "otgz") { save_otgz = true; - if(converter.FileExists()) { + if (converter.FileExists()) { backup_otbm = map_path + nstr(converter.GetName()) + ".otgz~"; std::remove(backup_otbm.c_str()); std::rename(savefile.c_str(), backup_otbm.c_str()); } } else { - if(converter.FileExists()) { + if (converter.FileExists()) { backup_otbm = map_path + nstr(converter.GetName()) + ".otbm~"; std::remove(backup_otbm.c_str()); std::rename(savefile.c_str(), backup_otbm.c_str()); } converter.SetFullName(wxstr(map.housefile)); - if(converter.FileExists()) { + if (converter.FileExists()) { backup_house = map_path + nstr(converter.GetName()) + ".xml~"; std::remove(backup_house.c_str()); std::rename((map_path + map.housefile).c_str(), backup_house.c_str()); } converter.SetFullName(wxstr(map.spawnmonsterfile)); - if(converter.FileExists()) { + if (converter.FileExists()) { backup_spawn = map_path + nstr(converter.GetName()) + ".xml~"; std::remove(backup_spawn.c_str()); std::rename((map_path + map.spawnmonsterfile).c_str(), backup_spawn.c_str()); } converter.SetFullName(wxstr(map.spawnnpcfile)); - if(converter.FileExists()) { + if (converter.FileExists()) { backup_spawn_npc = map_path + nstr(converter.GetName()) + ".xml~"; std::remove(backup_spawn_npc.c_str()); std::rename((map_path + map.spawnnpcfile).c_str(), backup_spawn_npc.c_str()); @@ -343,11 +331,10 @@ void Editor::saveMap(FileName filename, bool showdialog) { std::string n = nstr(g_gui.GetLocalDataDirectory()) + ".saving.txt"; std::ofstream f(n.c_str(), std::ios::trunc | std::ios::out); - f << - backup_otbm << std::endl << - backup_house << std::endl << - backup_spawn << std::endl << - backup_spawn_npc << std::endl; + f << backup_otbm << std::endl + << backup_house << std::endl + << backup_spawn << std::endl + << backup_spawn_npc << std::endl; } { @@ -357,38 +344,40 @@ void Editor::saveMap(FileName filename, bool showdialog) map.filename = fn.GetFullPath().mb_str(wxConvUTF8); map.name = fn.GetFullName().mb_str(wxConvUTF8); - if(showdialog) + if (showdialog) { g_gui.CreateLoadBar("Saving OTBM map..."); + } // Perform the actual save IOMapOTBM mapsaver(map.getVersion()); bool success = mapsaver.saveMap(map, fn); - if(showdialog) + if (showdialog) { g_gui.DestroyLoadBar(); + } // Check for errors... - if(!success) { + if (!success) { // Rename the temporary backup files back to their previous names - if(!backup_otbm.empty()) { + if (!backup_otbm.empty()) { converter.SetFullName(wxstr(savefile)); std::string otbm_filename = map_path + nstr(converter.GetName()); std::rename(backup_otbm.c_str(), std::string(otbm_filename + (save_otgz ? ".otgz" : ".otbm")).c_str()); } - if(!backup_house.empty()) { + if (!backup_house.empty()) { converter.SetFullName(wxstr(map.housefile)); std::string house_filename = map_path + nstr(converter.GetName()); std::rename(backup_house.c_str(), std::string(house_filename + ".xml").c_str()); } - if(!backup_spawn.empty()) { + if (!backup_spawn.empty()) { converter.SetFullName(wxstr(map.spawnmonsterfile)); std::string spawn_filename = map_path + nstr(converter.GetName()); std::rename(backup_spawn.c_str(), std::string(spawn_filename + ".xml").c_str()); } - if(!backup_spawn_npc.empty()) { + if (!backup_spawn_npc.empty()) { converter.SetFullName(wxstr(map.spawnnpcfile)); std::string spawnnpc_filename = map_path + nstr(converter.GetName()); std::rename(backup_spawn_npc.c_str(), std::string(spawnnpc_filename + ".xml").c_str()); @@ -405,12 +394,13 @@ void Editor::saveMap(FileName filename, bool showdialog) } // If failure, don't run the rest of the function - if(!success) + if (!success) { return; + } } // Move to permanent backup - if(!save_as && g_settings.getInteger(Config::ALWAYS_MAKE_BACKUP)) { + if (!save_as && g_settings.getInteger(Config::ALWAYS_MAKE_BACKUP)) { // Move temporary backups to their proper files time_t t = time(nullptr); tm* current_time = localtime(&t); @@ -418,34 +408,36 @@ void Editor::saveMap(FileName filename, bool showdialog) std::ostringstream date; date << (1900 + current_time->tm_year); - if(current_time->tm_mon < 9) - date << "-" << "0" << current_time->tm_mon+1; - else - date << "-" << current_time->tm_mon+1; + if (current_time->tm_mon < 9) { + date << "-" + << "0" << current_time->tm_mon + 1; + } else { + date << "-" << current_time->tm_mon + 1; + } date << "-" << current_time->tm_mday; date << "-" << current_time->tm_hour; date << "-" << current_time->tm_min; date << "-" << current_time->tm_sec; - if(!backup_otbm.empty()) { + if (!backup_otbm.empty()) { converter.SetFullName(wxstr(savefile)); std::string otbm_filename = map_path + nstr(converter.GetName()); std::rename(backup_otbm.c_str(), std::string(otbm_filename + "." + date.str() + (save_otgz ? ".otgz" : ".otbm")).c_str()); } - if(!backup_house.empty()) { + if (!backup_house.empty()) { converter.SetFullName(wxstr(map.housefile)); std::string house_filename = map_path + nstr(converter.GetName()); std::rename(backup_house.c_str(), std::string(house_filename + "." + date.str() + ".xml").c_str()); } - if(!backup_spawn.empty()) { + if (!backup_spawn.empty()) { converter.SetFullName(wxstr(map.spawnmonsterfile)); std::string spawn_filename = map_path + nstr(converter.GetName()); std::rename(backup_spawn.c_str(), std::string(spawn_filename + "." + date.str() + ".xml").c_str()); } - if(!backup_spawn_npc.empty()) { + if (!backup_spawn_npc.empty()) { converter.SetFullName(wxstr(map.spawnnpcfile)); std::string spawnnpc_filename = map_path + nstr(converter.GetName()); std::rename(backup_spawn_npc.c_str(), std::string(spawnnpc_filename + "." + date.str() + ".xml").c_str()); @@ -461,20 +453,18 @@ void Editor::saveMap(FileName filename, bool showdialog) clearChanges(); } -bool Editor::importMiniMap(FileName filename, int import, int import_x_offset, int import_y_offset, int import_z_offset) -{ +bool Editor::importMiniMap(FileName filename, int import, int import_x_offset, int import_y_offset, int import_z_offset) { return false; } -bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offset, int import_z_offset, ImportType house_import_type, ImportType spawn_import_type, ImportType spawn_npc_import_type) -{ +bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offset, int import_z_offset, ImportType house_import_type, ImportType spawn_import_type, ImportType spawn_npc_import_type) { selection.clear(); actionQueue->clear(); Map imported_map; bool loaded = imported_map.open(nstr(filename.GetFullPath())); - if(!loaded) { + if (!loaded) { g_gui.PopupDialog("Error", "Error loading map!\n" + imported_map.getError(), wxOK | wxICON_INFORMATION); return false; } @@ -492,30 +482,30 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs std::map town_id_map; std::map house_id_map; - if(house_import_type != IMPORT_DONT) { - for(TownMap::iterator tit = imported_map.towns.begin(); tit != imported_map.towns.end();) { + if (house_import_type != IMPORT_DONT) { + for (TownMap::iterator tit = imported_map.towns.begin(); tit != imported_map.towns.end();) { Town* imported_town = tit->second; Town* current_town = map.towns.getTown(imported_town->getID()); Position oldexit = imported_town->getTemplePosition(); Position newexit = oldexit + offset; - if(newexit.isValid()) { + if (newexit.isValid()) { imported_town->setTemplePosition(newexit); } - switch(house_import_type) { + switch (house_import_type) { case IMPORT_MERGE: { town_id_map[imported_town->getID()] = imported_town->getID(); - if(current_town) { + if (current_town) { ++tit; continue; } break; } case IMPORT_SMART_MERGE: { - if(current_town) { + if (current_town) { // Compare and insert/merge depending on parameters - if(current_town->getName() == imported_town->getName() && current_town->getID() == imported_town->getID()) { + if (current_town->getName() == imported_town->getName() && current_town->getID() == imported_town->getID()) { // Just add to map town_id_map[imported_town->getID()] = current_town->getID(); ++tit; @@ -553,11 +543,11 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs TownMap::iterator tmp_iter = tit; ++tmp_iter; uint32_t next_key = 0; - if(tmp_iter != imported_map.towns.end()) { + if (tmp_iter != imported_map.towns.end()) { next_key = tmp_iter->first; } imported_map.towns.erase(tit); - if(next_key != 0) { + if (next_key != 0) { tit = imported_map.towns.find(next_key); } else { tit = imported_map.towns.end(); @@ -565,34 +555,38 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs #endif } - for(HouseMap::iterator hit = imported_map.houses.begin(); hit != imported_map.houses.end();) { + for (HouseMap::iterator hit = imported_map.houses.begin(); hit != imported_map.houses.end();) { House* imported_house = hit->second; House* current_house = map.houses.getHouse(imported_house->id); imported_house->townid = town_id_map[imported_house->townid]; - const Position& oldexit = imported_house->getExit(); + const Position &oldexit = imported_house->getExit(); imported_house->setExit(nullptr, Position()); // Reset it - switch(house_import_type) { + switch (house_import_type) { case IMPORT_MERGE: { house_id_map[imported_house->id] = imported_house->id; - if(current_house) { + if (current_house) { ++hit; Position newexit = oldexit + offset; - if(newexit.isValid()) current_house->setExit(&map, newexit); + if (newexit.isValid()) { + current_house->setExit(&map, newexit); + } continue; } break; } case IMPORT_SMART_MERGE: { - if(current_house) { + if (current_house) { // Compare and insert/merge depending on parameters - if(current_house->name == imported_house->name && current_house->townid == imported_house->townid) { + if (current_house->name == imported_house->name && current_house->townid == imported_house->townid) { // Just add to map house_id_map[imported_house->id] = current_house->id; ++hit; Position newexit = oldexit + offset; - if(newexit.isValid()) imported_house->setExit(&map, newexit); + if (newexit.isValid()) { + imported_house->setExit(&map, newexit); + } continue; } else { // Conflict! Find a newd id and replace old @@ -615,14 +609,18 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs case IMPORT_DONT: { ++hit; Position newexit = oldexit + offset; - if(newexit.isValid()) imported_house->setExit(&map, newexit); - continue; // Should never happend..? + if (newexit.isValid()) { + imported_house->setExit(&map, newexit); + } + continue; // Should never happend..? break; } } Position newexit = oldexit + offset; - if(newexit.isValid()) imported_house->setExit(&map, newexit); + if (newexit.isValid()) { + imported_house->setExit(&map, newexit); + } map.houses.addHouse(imported_house); #ifdef __VISUALC__ // C++0x compliance to some degree :) @@ -631,11 +629,11 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs HouseMap::iterator tmp_iter = hit; ++tmp_iter; uint32_t next_key = 0; - if(tmp_iter != imported_map.houses.end()) { + if (tmp_iter != imported_map.houses.end()) { next_key = tmp_iter->first; } imported_map.houses.erase(hit); - if(next_key != 0) { + if (next_key != 0) { hit = imported_map.houses.find(next_key); } else { hit = imported_map.houses.end(); @@ -646,16 +644,16 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs // Monster spawn import std::map spawn_monster_map; - if(spawn_import_type != IMPORT_DONT) { - for(SpawnNpcPositionList::iterator siter = imported_map.spawnsMonster.begin(); siter != imported_map.spawnsMonster.end();) { + if (spawn_import_type != IMPORT_DONT) { + for (SpawnNpcPositionList::iterator siter = imported_map.spawnsMonster.begin(); siter != imported_map.spawnsMonster.end();) { Position oldSpawnMonsterPos = *siter; Position newSpawnMonsterPos = *siter + offset; - switch(spawn_import_type) { + switch (spawn_import_type) { case IMPORT_SMART_MERGE: case IMPORT_INSERT: case IMPORT_MERGE: { Tile* imported_tile = imported_map.getTile(oldSpawnMonsterPos); - if(imported_tile) { + if (imported_tile) { ASSERT(imported_tile->spawnMonster); spawn_monster_map[newSpawnMonsterPos] = imported_tile->spawnMonster; @@ -664,15 +662,17 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs Position next_spawn_monster; ++next; - if(next == imported_map.spawnsMonster.end()) + if (next == imported_map.spawnsMonster.end()) { cont = false; - else + } else { next_spawn_monster = *next; + } imported_map.spawnsMonster.erase(siter); - if(cont) + if (cont) { siter = imported_map.spawnsMonster.find(next_spawn_monster); - else + } else { siter = imported_map.spawnsMonster.end(); + } } break; } @@ -686,16 +686,16 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs // Npc spawn import std::map spawn_npc_map; - if(spawn_npc_import_type != IMPORT_DONT) { - for(SpawnNpcPositionList::iterator siter = imported_map.spawnsNpc.begin(); siter != imported_map.spawnsNpc.end();) { + if (spawn_npc_import_type != IMPORT_DONT) { + for (SpawnNpcPositionList::iterator siter = imported_map.spawnsNpc.begin(); siter != imported_map.spawnsNpc.end();) { Position oldSpawnNpcPos = *siter; Position newSpawnNpcPos = *siter + offset; - switch(spawn_npc_import_type) { + switch (spawn_npc_import_type) { case IMPORT_SMART_MERGE: case IMPORT_INSERT: case IMPORT_MERGE: { Tile* importedTile = imported_map.getTile(oldSpawnNpcPos); - if(importedTile) { + if (importedTile) { ASSERT(importedTile->spawnNpc); spawn_npc_map[newSpawnNpcPos] = importedTile->spawnNpc; @@ -704,15 +704,17 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs Position next_spawn_npc; ++next; - if(next == imported_map.spawnsNpc.end()) + if (next == imported_map.spawnsNpc.end()) { cont = false; - else + } else { next_spawn_npc = *next; + } imported_map.spawnsNpc.erase(siter); - if(cont) + if (cont) { siter = imported_map.spawnsNpc.find(next_spawn_npc); - else + } else { siter = imported_map.spawnsNpc.end(); + } } break; } @@ -725,38 +727,37 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs } // Plain merge of waypoints, very simple! :) - for(WaypointMap::iterator iter = imported_map.waypoints.begin(); iter != imported_map.waypoints.end(); ++iter) { + for (WaypointMap::iterator iter = imported_map.waypoints.begin(); iter != imported_map.waypoints.end(); ++iter) { iter->second->pos += offset; } map.waypoints.waypoints.insert(imported_map.waypoints.begin(), imported_map.waypoints.end()); imported_map.waypoints.waypoints.clear(); - uint64_t tiles_merged = 0; uint64_t tiles_to_import = imported_map.tilecount; - for(MapIterator mit = imported_map.begin(); mit != imported_map.end(); ++mit) { - if(tiles_merged % 8092 == 0) { + for (MapIterator mit = imported_map.begin(); mit != imported_map.end(); ++mit) { + if (tiles_merged % 8092 == 0) { g_gui.SetLoadDone(int(100.0 * tiles_merged / tiles_to_import)); } ++tiles_merged; Tile* import_tile = (*mit)->get(); Position new_pos = import_tile->getPosition() + offset; - if(!new_pos.isValid()) { + if (!new_pos.isValid()) { ++discarded_tiles; continue; } - if(!resizemap && (new_pos.x > map.getWidth() || new_pos.y > map.getHeight())) { - if(resize_asked) { + if (!resizemap && (new_pos.x > map.getWidth() || new_pos.y > map.getHeight())) { + if (resize_asked) { ++discarded_tiles; continue; } else { resize_asked = true; int ret = g_gui.PopupDialog("Collision", "The imported tiles are outside the current map scope. Do you want to resize the map? (Else additional tiles will be removed)", wxYES | wxNO); - if(ret == wxID_YES) { + if (ret == wxID_YES) { // ... resizemap = true; } else { @@ -766,21 +767,20 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs } } - if(new_pos.x > newsize_x) { + if (new_pos.x > newsize_x) { newsize_x = new_pos.x; } - if(new_pos.y > newsize_y) { + if (new_pos.y > newsize_y) { newsize_y = new_pos.y; } imported_map.setTile(import_tile->getPosition(), nullptr); TileLocation* location = map.createTileL(new_pos); - // Check if we should update any houses int new_houseid = house_id_map[import_tile->getHouseID()]; House* house = map.houses.getHouse(new_houseid); - if(import_tile->isHouseTile() && house_import_type != IMPORT_DONT && house) { + if (import_tile->isHouseTile() && house_import_type != IMPORT_DONT && house) { // We need to notify houses of the tile moving house->removeTile(import_tile); import_tile->setLocation(location); @@ -789,17 +789,17 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs import_tile->setLocation(location); } - if(offset != Position(0,0,0)) { - for(ItemVector::iterator iter = import_tile->items.begin(); iter != import_tile->items.end(); ++iter) { + if (offset != Position(0, 0, 0)) { + for (ItemVector::iterator iter = import_tile->items.begin(); iter != import_tile->items.end(); ++iter) { Item* item = *iter; - if(Teleport* teleport = dynamic_cast(item)) { + if (Teleport* teleport = dynamic_cast(item)) { teleport->setDestination(teleport->getDestination() + offset); } } } Tile* old_tile = map.getTile(new_pos); - if(old_tile) { + if (old_tile) { map.removeSpawnMonster(old_tile); } import_tile->spawnMonster = nullptr; @@ -807,14 +807,14 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs map.setTile(new_pos, import_tile, true); } - for(std::map::iterator spawn_monster_iter = spawn_monster_map.begin(); spawn_monster_iter != spawn_monster_map.end(); ++spawn_monster_iter) { + for (std::map::iterator spawn_monster_iter = spawn_monster_map.begin(); spawn_monster_iter != spawn_monster_map.end(); ++spawn_monster_iter) { Position pos = spawn_monster_iter->first; TileLocation* location = map.createTileL(pos); Tile* tile = location->get(); - if(!tile) { + if (!tile) { tile = map.allocator(location); map.setTile(pos, tile); - } else if(tile->spawnMonster) { + } else if (tile->spawnMonster) { map.removeSpawnMonsterInternal(tile); delete tile->spawnMonster; } @@ -823,14 +823,14 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs map.addSpawnMonster(tile); } - for(std::map::iterator spawn_npc_iter = spawn_npc_map.begin(); spawn_npc_iter != spawn_npc_map.end(); ++spawn_npc_iter) { + for (std::map::iterator spawn_npc_iter = spawn_npc_map.begin(); spawn_npc_iter != spawn_npc_map.end(); ++spawn_npc_iter) { Position pos = spawn_npc_iter->first; TileLocation* location = map.createTileL(pos); Tile* tile = location->get(); - if(!tile) { + if (!tile) { tile = map.allocator(location); map.setTile(pos, tile); - } else if(tile->spawnNpc) { + } else if (tile->spawnNpc) { map.removeSpawnNpcInternal(tile); delete tile->spawnNpc; } @@ -851,15 +851,14 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs return true; } -void Editor::borderizeSelection() -{ - if(selection.empty()) { +void Editor::borderizeSelection() { + if (selection.empty()) { g_gui.SetStatusText("No items selected. Can't borderize."); return; } Action* action = actionQueue->createAction(ACTION_BORDERIZE); - for(const Tile* tile : selection) { + for (const Tile* tile : selection) { Tile* new_tile = tile->deepCopy(map); new_tile->borderize(&map); new_tile->select(); @@ -869,15 +868,14 @@ void Editor::borderizeSelection() updateActions(); } -void Editor::borderizeMap(bool showdialog) -{ - if(showdialog) { +void Editor::borderizeMap(bool showdialog) { + if (showdialog) { g_gui.CreateLoadBar("Borderizing map..."); } uint64_t tiles_done = 0; - for(TileLocation* tileLocation : map) { - if(showdialog && tiles_done % 4096 == 0) { + for (TileLocation* tileLocation : map) { + if (showdialog && tiles_done % 4096 == 0) { g_gui.SetLoadDone(static_cast(tiles_done / double(map.tilecount) * 100.0)); } @@ -888,28 +886,27 @@ void Editor::borderizeMap(bool showdialog) ++tiles_done; } - if(showdialog) { + if (showdialog) { g_gui.DestroyLoadBar(); } } -void Editor::randomizeSelection() -{ - if(selection.empty()) { +void Editor::randomizeSelection() { + if (selection.empty()) { g_gui.SetStatusText("No items selected. Can't randomize."); return; } Action* action = actionQueue->createAction(ACTION_RANDOMIZE); - for(const Tile* tile : selection) { + for (const Tile* tile : selection) { Tile* new_tile = tile->deepCopy(map); GroundBrush* brush = new_tile->getGroundBrush(); - if(brush && brush->isReRandomizable()) { + if (brush && brush->isReRandomizable()) { brush->draw(&map, new_tile, nullptr); Item* old_ground = tile->ground; Item* new_ground = new_tile->ground; - if(old_ground && new_ground) { + if (old_ground && new_ground) { new_ground->setActionID(old_ground->getActionID()); new_ground->setUniqueID(old_ground->getUniqueID()); } @@ -922,15 +919,14 @@ void Editor::randomizeSelection() updateActions(); } -void Editor::randomizeMap(bool showdialog) -{ - if(showdialog) { +void Editor::randomizeMap(bool showdialog) { + if (showdialog) { g_gui.CreateLoadBar("Randomizing map..."); } uint64_t tiles_done = 0; - for(TileLocation* tileLocation : map) { - if(showdialog && tiles_done % 4096 == 0) { + for (TileLocation* tileLocation : map) { + if (showdialog && tiles_done % 4096 == 0) { g_gui.SetLoadDone(static_cast(tiles_done / double(map.tilecount) * 100.0)); } @@ -938,11 +934,11 @@ void Editor::randomizeMap(bool showdialog) ASSERT(tile); GroundBrush* groundBrush = tile->getGroundBrush(); - if(groundBrush) { + if (groundBrush) { Item* oldGround = tile->ground; uint16_t actionId, uniqueId; - if(oldGround) { + if (oldGround) { actionId = oldGround->getActionID(); uniqueId = oldGround->getUniqueID(); } else { @@ -952,7 +948,7 @@ void Editor::randomizeMap(bool showdialog) groundBrush->draw(&map, tile, nullptr); Item* newGround = tile->ground; - if(newGround) { + if (newGround) { newGround->setActionID(actionId); newGround->setUniqueID(uniqueId); } @@ -961,34 +957,33 @@ void Editor::randomizeMap(bool showdialog) ++tiles_done; } - if(showdialog) { + if (showdialog) { g_gui.DestroyLoadBar(); } } -void Editor::clearInvalidHouseTiles(bool showdialog) -{ - if(showdialog) { +void Editor::clearInvalidHouseTiles(bool showdialog) { + if (showdialog) { g_gui.CreateLoadBar("Clearing invalid house tiles..."); } - Houses& houses = map.houses; + Houses &houses = map.houses; HouseMap::iterator iter = houses.begin(); - while(iter != houses.end()) { + while (iter != houses.end()) { House* h = iter->second; - if(map.towns.getTown(h->townid) == nullptr) { + if (map.towns.getTown(h->townid) == nullptr) { #ifdef __VISUALC__ // C++0x compliance to some degree :) iter = houses.erase(iter); #else // Bulky, slow way HouseMap::iterator tmp_iter = iter; ++tmp_iter; uint32_t next_key = 0; - if(tmp_iter != houses.end()) { + if (tmp_iter != houses.end()) { next_key = tmp_iter->first; } houses.erase(iter); - if(next_key != 0) { + if (next_key != 0) { iter = houses.find(next_key); } else { iter = houses.end(); @@ -1000,35 +995,34 @@ void Editor::clearInvalidHouseTiles(bool showdialog) } uint64_t tiles_done = 0; - for(MapIterator map_iter = map.begin(); map_iter != map.end(); ++map_iter) { - if(showdialog && tiles_done % 4096 == 0) { + for (MapIterator map_iter = map.begin(); map_iter != map.end(); ++map_iter) { + if (showdialog && tiles_done % 4096 == 0) { g_gui.SetLoadDone(int(tiles_done / double(map.tilecount) * 100.0)); } Tile* tile = (*map_iter)->get(); ASSERT(tile); - if(tile->isHouseTile()) { - if(houses.getHouse(tile->getHouseID()) == nullptr) { + if (tile->isHouseTile()) { + if (houses.getHouse(tile->getHouseID()) == nullptr) { tile->setHouse(nullptr); } } ++tiles_done; } - if(showdialog) { + if (showdialog) { g_gui.DestroyLoadBar(); } } -void Editor::clearModifiedTileState(bool showdialog) -{ - if(showdialog) { +void Editor::clearModifiedTileState(bool showdialog) { + if (showdialog) { g_gui.CreateLoadBar("Clearing modified state from all tiles..."); } uint64_t tiles_done = 0; - for(MapIterator map_iter = map.begin(); map_iter != map.end(); ++map_iter) { - if(showdialog && tiles_done % 4096 == 0) { + for (MapIterator map_iter = map.begin(); map_iter != map.end(); ++map_iter) { + if (showdialog && tiles_done % 4096 == 0) { g_gui.SetLoadDone(int(tiles_done / double(map.tilecount) * 100.0)); } @@ -1038,14 +1032,13 @@ void Editor::clearModifiedTileState(bool showdialog) ++tiles_done; } - if(showdialog) { + if (showdialog) { g_gui.DestroyLoadBar(); } } -void Editor::moveSelection(const Position& offset) -{ - if(!CanEdit() || !hasSelection()) { +void Editor::moveSelection(const Position &offset) { + if (!CanEdit() || !hasSelection()) { return; } @@ -1059,37 +1052,37 @@ void Editor::moveSelection(const Position& offset) Action* action = actionQueue->createAction(batch_action); // Update the tiles with the new positions - for(Tile* tile : selection) { + for (Tile* tile : selection) { Tile* new_tile = tile->deepCopy(map); Tile* storage_tile = map.allocator(tile->getLocation()); ItemVector selected_items = new_tile->popSelectedItems(); - for(Item* item : selected_items) { + for (Item* item : selected_items) { storage_tile->addItem(item); } // Move monster spawns - if(new_tile->spawnMonster && new_tile->spawnMonster->isSelected()) { + if (new_tile->spawnMonster && new_tile->spawnMonster->isSelected()) { storage_tile->spawnMonster = new_tile->spawnMonster; new_tile->spawnMonster = nullptr; } // Move monster - if(new_tile->monster && new_tile->monster->isSelected()) { + if (new_tile->monster && new_tile->monster->isSelected()) { storage_tile->monster = new_tile->monster; new_tile->monster = nullptr; } // Move npc - if(new_tile->npc && new_tile->npc->isSelected()) { + if (new_tile->npc && new_tile->npc->isSelected()) { storage_tile->npc = new_tile->npc; new_tile->npc = nullptr; } // Move npc spawns - if(new_tile->spawnNpc && new_tile->spawnNpc->isSelected()) { + if (new_tile->spawnNpc && new_tile->spawnNpc->isSelected()) { storage_tile->spawnNpc = new_tile->spawnNpc; new_tile->spawnNpc = nullptr; } - if(storage_tile->ground) { + if (storage_tile->ground) { storage_tile->house_id = new_tile->house_id; new_tile->house_id = 0; storage_tile->setMapFlags(new_tile->getMapFlags()); @@ -1103,23 +1096,50 @@ void Editor::moveSelection(const Position& offset) batch_action->addAndCommitAction(action); // Remove old borders (and create some new?) - if(create_borders && selection.size() < static_cast(drag_threshold)) { + if (create_borders && selection.size() < static_cast(drag_threshold)) { action = actionQueue->createAction(batch_action); TileList borderize_tiles; // Go through all modified (selected) tiles (might be slow) - for(const Tile* tile : storage) { - const Position& pos = tile->getPosition(); + for (const Tile* tile : storage) { + const Position &pos = tile->getPosition(); // Go through all neighbours Tile* t; - t = map.getTile(pos.x , pos.y , pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t);} - t = map.getTile(pos.x-1, pos.y-1, pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t);} - t = map.getTile(pos.x , pos.y-1, pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t);} - t = map.getTile(pos.x+1, pos.y-1, pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t);} - t = map.getTile(pos.x-1, pos.y , pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t);} - t = map.getTile(pos.x+1, pos.y , pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t);} - t = map.getTile(pos.x-1, pos.y+1, pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t);} - t = map.getTile(pos.x , pos.y+1, pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t);} - t = map.getTile(pos.x+1, pos.y+1, pos.z); if(t && !t->isSelected()) {borderize_tiles.push_back(t);} + t = map.getTile(pos.x, pos.y, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + } + t = map.getTile(pos.x - 1, pos.y - 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + } + t = map.getTile(pos.x, pos.y - 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + } + t = map.getTile(pos.x + 1, pos.y - 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + } + t = map.getTile(pos.x - 1, pos.y, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + } + t = map.getTile(pos.x + 1, pos.y, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + } + t = map.getTile(pos.x - 1, pos.y + 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + } + t = map.getTile(pos.x, pos.y + 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + } + t = map.getTile(pos.x + 1, pos.y + 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + } } // Remove duplicates @@ -1127,15 +1147,15 @@ void Editor::moveSelection(const Position& offset) borderize_tiles.unique(); // Create borders - for(const Tile* tile : borderize_tiles) { + for (const Tile* tile : borderize_tiles) { Tile* new_tile = tile->deepCopy(map); - if(borderize) { + if (borderize) { new_tile->borderize(&map); } new_tile->wallize(&map); new_tile->tableize(&map); new_tile->carpetize(&map); - if(tile->ground && tile->ground->isSelected()) { + if (tile->ground && tile->ground->isSelected()) { new_tile->selectGround(); } action->addChange(new Change(new_tile)); @@ -1145,10 +1165,10 @@ void Editor::moveSelection(const Position& offset) // New action for adding the destination tiles action = actionQueue->createAction(batch_action); - for(Tile* tile : storage) { - const Position& old_pos = tile->getPosition(); + for (Tile* tile : storage) { + const Position &old_pos = tile->getPosition(); Position new_pos = old_pos - offset; - if(new_pos.z < rme::MapMinLayer && new_pos.z > rme::MapMaxLayer) { + if (new_pos.z < rme::MapMinLayer && new_pos.z > rme::MapMaxLayer) { delete tile; continue; } @@ -1157,9 +1177,9 @@ void Editor::moveSelection(const Position& offset) Tile* old_dest_tile = location->get(); Tile* new_dest_tile = nullptr; - if(!tile->ground || g_settings.getInteger(Config::MERGE_MOVE)) { + if (!tile->ground || g_settings.getInteger(Config::MERGE_MOVE)) { // Move items - if(old_dest_tile) { + if (old_dest_tile) { new_dest_tile = old_dest_tile->deepCopy(map); } else { new_dest_tile = map.allocator(location); @@ -1175,25 +1195,61 @@ void Editor::moveSelection(const Position& offset) } batch_action->addAndCommitAction(action); - if(create_borders && selection.size() < static_cast(drag_threshold)) { + if (create_borders && selection.size() < static_cast(drag_threshold)) { action = actionQueue->createAction(batch_action); TileList borderize_tiles; // Go through all modified (selected) tiles (might be slow) - for(Tile* tile : selection) { + for (Tile* tile : selection) { bool add_me = false; // If this tile is touched - const Position& pos = tile->getPosition(); + const Position &pos = tile->getPosition(); // Go through all neighbours Tile* t; - t = map.getTile(pos.x-1, pos.y-1, pos.z); if(t && !t->isSelected()) { borderize_tiles.push_back(t); add_me = true; } - t = map.getTile(pos.x-1, pos.y-1, pos.z); if(t && !t->isSelected()) { borderize_tiles.push_back(t); add_me = true; } - t = map.getTile(pos.x , pos.y-1, pos.z); if(t && !t->isSelected()) { borderize_tiles.push_back(t); add_me = true; } - t = map.getTile(pos.x+1, pos.y-1, pos.z); if(t && !t->isSelected()) { borderize_tiles.push_back(t); add_me = true; } - t = map.getTile(pos.x-1, pos.y , pos.z); if(t && !t->isSelected()) { borderize_tiles.push_back(t); add_me = true; } - t = map.getTile(pos.x+1, pos.y , pos.z); if(t && !t->isSelected()) { borderize_tiles.push_back(t); add_me = true; } - t = map.getTile(pos.x-1, pos.y+1, pos.z); if(t && !t->isSelected()) { borderize_tiles.push_back(t); add_me = true; } - t = map.getTile(pos.x , pos.y+1, pos.z); if(t && !t->isSelected()) { borderize_tiles.push_back(t); add_me = true; } - t = map.getTile(pos.x+1, pos.y+1, pos.z); if(t && !t->isSelected()) { borderize_tiles.push_back(t); add_me = true; } - if(add_me) { + t = map.getTile(pos.x - 1, pos.y - 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x - 1, pos.y - 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x, pos.y - 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x + 1, pos.y - 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x - 1, pos.y, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x + 1, pos.y, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x - 1, pos.y + 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x, pos.y + 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + t = map.getTile(pos.x + 1, pos.y + 1, pos.z); + if (t && !t->isSelected()) { + borderize_tiles.push_back(t); + add_me = true; + } + if (add_me) { borderize_tiles.push_back(tile); } } @@ -1203,19 +1259,19 @@ void Editor::moveSelection(const Position& offset) borderize_tiles.unique(); // Create borders - for(const Tile* tile : borderize_tiles) { - if(!tile || !tile->ground) { + for (const Tile* tile : borderize_tiles) { + if (!tile || !tile->ground) { continue; } - if(tile->ground->getGroundBrush()) { + if (tile->ground->getGroundBrush()) { Tile* new_tile = tile->deepCopy(map); - if(borderize) { + if (borderize) { new_tile->borderize(&map); } new_tile->wallize(&map); new_tile->tableize(&map); new_tile->carpetize(&map); - if(tile->ground->isSelected()) { + if (tile->ground->isSelected()) { new_tile->selectGround(); } action->addChange(new Change(new_tile)); @@ -1230,9 +1286,8 @@ void Editor::moveSelection(const Position& offset) selection.updateSelectionCount(); } -void Editor::destroySelection() -{ - if(selection.size() == 0) { +void Editor::destroySelection() { + if (selection.size() == 0) { g_gui.SetStatusText("No selected items to delete."); } else { int tile_count = 0; @@ -1242,43 +1297,43 @@ void Editor::destroySelection() BatchAction* batch = actionQueue->createBatch(ACTION_DELETE_TILES); Action* action = actionQueue->createAction(batch); - for(TileSet::iterator it = selection.begin(); it != selection.end(); ++it) { + for (TileSet::iterator it = selection.begin(); it != selection.end(); ++it) { tile_count++; Tile* tile = *it; Tile* newtile = tile->deepCopy(map); ItemVector tile_selection = newtile->popSelectedItems(); - for(ItemVector::iterator iit = tile_selection.begin(); iit != tile_selection.end(); ++iit) { + for (ItemVector::iterator iit = tile_selection.begin(); iit != tile_selection.end(); ++iit) { ++item_count; // Delete the items from the tile delete *iit; } // Monster - if(newtile->monster && newtile->monster->isSelected()) { + if (newtile->monster && newtile->monster->isSelected()) { delete newtile->monster; newtile->monster = nullptr; } - if(newtile->spawnMonster && newtile->spawnMonster->isSelected()) { + if (newtile->spawnMonster && newtile->spawnMonster->isSelected()) { delete newtile->spawnMonster; newtile->spawnMonster = nullptr; } // Npc - if(newtile->npc && newtile->npc->isSelected()) { + if (newtile->npc && newtile->npc->isSelected()) { delete newtile->npc; newtile->npc = nullptr; } - if(newtile->spawnNpc && newtile->spawnNpc->isSelected()) { + if (newtile->spawnNpc && newtile->spawnNpc->isSelected()) { delete newtile->spawnNpc; newtile->spawnNpc = nullptr; } - if(g_settings.getInteger(Config::USE_AUTOMAGIC)) { - for(int y = -1; y <= 1; y++) { - for(int x = -1; x <= 1; x++) { - const Position& position = tile->getPosition(); + if (g_settings.getInteger(Config::USE_AUTOMAGIC)) { + for (int y = -1; y <= 1; y++) { + for (int x = -1; x <= 1; x++) { + const Position &position = tile->getPosition(); tilestoborder.push_back(Position(position.x + x, position.y + y, position.z)); } } @@ -1288,17 +1343,17 @@ void Editor::destroySelection() batch->addAndCommitAction(action); - if(g_settings.getInteger(Config::USE_AUTOMAGIC)) { + if (g_settings.getInteger(Config::USE_AUTOMAGIC)) { // Remove duplicates tilestoborder.sort(); tilestoborder.unique(); action = actionQueue->createAction(batch); - for(PositionList::iterator it = tilestoborder.begin(); it != tilestoborder.end(); ++it) { + for (PositionList::iterator it = tilestoborder.begin(); it != tilestoborder.end(); ++it) { TileLocation* location = map.createTileL(*it); Tile* tile = location->get(); - if(tile) { + if (tile) { Tile* new_tile = tile->deepCopy(map); new_tile->borderize(&map); new_tile->wallize(&map); @@ -1308,7 +1363,7 @@ void Editor::destroySelection() } else { Tile* new_tile = map.allocator(location); new_tile->borderize(&map); - if(new_tile->size()) { + if (new_tile->size()) { action->addChange(newd Change(new_tile)); } else { delete new_tile; @@ -1323,60 +1378,57 @@ void Editor::destroySelection() updateActions(); wxString ss; - ss << "Deleted " << tile_count << " tile" << (tile_count > 1 ? "s" : "") << " (" << item_count << " item" << (item_count > 1? "s" : "") << ")"; + ss << "Deleted " << tile_count << " tile" << (tile_count > 1 ? "s" : "") << " (" << item_count << " item" << (item_count > 1 ? "s" : "") << ")"; g_gui.SetStatusText(ss); } } - // Macro to avoid useless code repetition -void doSurroundingBorders(DoodadBrush* doodad_brush, PositionList& tilestoborder, Tile* buffer_tile, Tile* new_tile) -{ - if(doodad_brush->doNewBorders() && g_settings.getInteger(Config::USE_AUTOMAGIC)) { - const Position& position = new_tile->getPosition(); +// Macro to avoid useless code repetition +void doSurroundingBorders(DoodadBrush* doodad_brush, PositionList &tilestoborder, Tile* buffer_tile, Tile* new_tile) { + if (doodad_brush->doNewBorders() && g_settings.getInteger(Config::USE_AUTOMAGIC)) { + const Position &position = new_tile->getPosition(); tilestoborder.push_back(Position(position)); - if(buffer_tile->hasGround()) { - for(int y = -1; y <= 1; y++) { - for(int x = -1; x <= 1; x++) { + if (buffer_tile->hasGround()) { + for (int y = -1; y <= 1; y++) { + for (int x = -1; x <= 1; x++) { tilestoborder.push_back(Position(position.x + x, position.y + y, position.z)); } } - } else if(buffer_tile->hasWall()) { - tilestoborder.push_back(Position(position.x, position.y-1, position.z)); - tilestoborder.push_back(Position(position.x-1, position.y, position.z)); - tilestoborder.push_back(Position(position.x+1, position.y, position.z)); - tilestoborder.push_back(Position(position.x, position.y+1, position.z)); + } else if (buffer_tile->hasWall()) { + tilestoborder.push_back(Position(position.x, position.y - 1, position.z)); + tilestoborder.push_back(Position(position.x - 1, position.y, position.z)); + tilestoborder.push_back(Position(position.x + 1, position.y, position.z)); + tilestoborder.push_back(Position(position.x, position.y + 1, position.z)); } } } -void removeDuplicateWalls(Tile* buffer, Tile* tile) -{ +void removeDuplicateWalls(Tile* buffer, Tile* tile) { if (!buffer || buffer->items.empty() || !tile || tile->items.empty()) { return; } - for(const Item* item : buffer->items) { - if(item) { + for (const Item* item : buffer->items) { + if (item) { WallBrush* brush = item->getWallBrush(); - if(brush) { + if (brush) { tile->cleanWalls(brush); } } } } -void Editor::drawInternal(Position offset, bool alt, bool dodraw) -{ - if(!CanEdit()) { +void Editor::drawInternal(Position offset, bool alt, bool dodraw) { + if (!CanEdit()) { return; } Brush* brush = g_gui.GetCurrentBrush(); - if(!brush) { + if (!brush) { return; } - if(brush->isDoodad()) { + if (brush->isDoodad()) { BatchAction* batch = actionQueue->createBatch(ACTION_DRAW); Action* action = actionQueue->createAction(batch); BaseMap* buffer_map = g_gui.doodad_buffer_map; @@ -1384,10 +1436,10 @@ void Editor::drawInternal(Position offset, bool alt, bool dodraw) Position delta_pos = offset - Position(0x8000, 0x8000, 0x8); PositionList tilestoborder; - for(MapIterator it = buffer_map->begin(); it != buffer_map->end(); ++it) { + for (MapIterator it = buffer_map->begin(); it != buffer_map->end(); ++it) { Tile* buffer_tile = (*it)->get(); Position pos = buffer_tile->getPosition() + delta_pos; - if(!pos.isValid()) { + if (!pos.isValid()) { continue; } @@ -1395,18 +1447,18 @@ void Editor::drawInternal(Position offset, bool alt, bool dodraw) Tile* tile = location->get(); DoodadBrush* doodad_brush = brush->asDoodad(); - if(doodad_brush->placeOnBlocking() || alt) { - if(tile) { + if (doodad_brush->placeOnBlocking() || alt) { + if (tile) { bool place = true; - if(!doodad_brush->placeOnDuplicate() && !alt) { - for(ItemVector::const_iterator iter = tile->items.begin(); iter != tile->items.end(); ++iter) { - if(doodad_brush->ownsItem(*iter)) { + if (!doodad_brush->placeOnDuplicate() && !alt) { + for (ItemVector::const_iterator iter = tile->items.begin(); iter != tile->items.end(); ++iter) { + if (doodad_brush->ownsItem(*iter)) { place = false; break; } } } - if(place) { + if (place) { Tile* new_tile = tile->deepCopy(map); removeDuplicateWalls(buffer_tile, new_tile); doSurroundingBorders(doodad_brush, tilestoborder, buffer_tile, new_tile); @@ -1421,17 +1473,17 @@ void Editor::drawInternal(Position offset, bool alt, bool dodraw) action->addChange(newd Change(new_tile)); } } else { - if(tile && !tile->isBlocking()) { + if (tile && !tile->isBlocking()) { bool place = true; - if(!doodad_brush->placeOnDuplicate() && !alt) { - for(ItemVector::const_iterator iter = tile->items.begin(); iter != tile->items.end(); ++iter) { - if(doodad_brush->ownsItem(*iter)) { + if (!doodad_brush->placeOnDuplicate() && !alt) { + for (ItemVector::const_iterator iter = tile->items.begin(); iter != tile->items.end(); ++iter) { + if (doodad_brush->ownsItem(*iter)) { place = false; break; } } } - if(place) { + if (place) { Tile* new_tile = tile->deepCopy(map); removeDuplicateWalls(buffer_tile, new_tile); doSurroundingBorders(doodad_brush, tilestoborder, buffer_tile, new_tile); @@ -1443,16 +1495,16 @@ void Editor::drawInternal(Position offset, bool alt, bool dodraw) } batch->addAndCommitAction(action); - if(tilestoborder.size() > 0) { + if (tilestoborder.size() > 0) { Action* action = actionQueue->createAction(batch); // Remove duplicates tilestoborder.sort(); tilestoborder.unique(); - for(PositionList::const_iterator it = tilestoborder.begin(); it != tilestoborder.end(); ++it) { + for (PositionList::const_iterator it = tilestoborder.begin(); it != tilestoborder.end(); ++it) { Tile* tile = map.getTile(*it); - if(tile) { + if (tile) { Tile* new_tile = tile->deepCopy(map); new_tile->borderize(&map); new_tile->wallize(&map); @@ -1462,47 +1514,51 @@ void Editor::drawInternal(Position offset, bool alt, bool dodraw) batch->addAndCommitAction(action); } addBatch(batch, 2); - } else if(brush->isHouseExit()) { + } else if (brush->isHouseExit()) { HouseExitBrush* house_exit_brush = brush->asHouseExit(); - if(!house_exit_brush->canDraw(&map, offset)) + if (!house_exit_brush->canDraw(&map, offset)) { return; + } House* house = map.houses.getHouse(house_exit_brush->getHouseID()); - if(!house) + if (!house) { return; + } BatchAction* batch = actionQueue->createBatch(ACTION_DRAW); Action* action = actionQueue->createAction(batch); action->addChange(Change::Create(house, offset)); batch->addAndCommitAction(action); addBatch(batch, 2); - } else if(brush->isWaypoint()) { + } else if (brush->isWaypoint()) { WaypointBrush* waypoint_brush = brush->asWaypoint(); - if(!waypoint_brush->canDraw(&map, offset)) + if (!waypoint_brush->canDraw(&map, offset)) { return; + } Waypoint* waypoint = map.waypoints.getWaypoint(waypoint_brush->getWaypoint()); - if(!waypoint || waypoint->pos == offset) + if (!waypoint || waypoint->pos == offset) { return; + } BatchAction* batch = actionQueue->createBatch(ACTION_DRAW); Action* action = actionQueue->createAction(batch); action->addChange(Change::Create(waypoint, offset)); batch->addAndCommitAction(action); addBatch(batch, 2); - } else if(brush->isWall()) { + } else if (brush->isWall()) { BatchAction* batch = actionQueue->createBatch(dodraw ? ACTION_DRAW : ACTION_ERASE); Action* action = actionQueue->createAction(batch); // This will only occur with a size 0, when clicking on a tile (not drawing) Tile* tile = map.getTile(offset); Tile* new_tile = nullptr; - if(tile) { + if (tile) { new_tile = tile->deepCopy(map); } else { new_tile = map.allocator(map.createTileL(offset)); } - if(dodraw) { + if (dodraw) { bool b = true; brush->asWall()->draw(&map, new_tile, &b); } else { @@ -1511,24 +1567,24 @@ void Editor::drawInternal(Position offset, bool alt, bool dodraw) action->addChange(newd Change(new_tile)); batch->addAndCommitAction(action); addBatch(batch, 2); - } else if(brush->isSpawnMonster() || brush->isMonster()) { + } else if (brush->isSpawnMonster() || brush->isMonster()) { BatchAction* batch = actionQueue->createBatch(dodraw ? ACTION_DRAW : ACTION_ERASE); Action* action = actionQueue->createAction(batch); Tile* tile = map.getTile(offset); Tile* new_tile = nullptr; - if(tile) { + if (tile) { new_tile = tile->deepCopy(map); } else { new_tile = map.allocator(map.createTileL(offset)); } int param; - if(brush->isMonster()) { + if (brush->isMonster()) { param = g_gui.GetSpawnMonsterTime(); } else { param = g_gui.GetBrushSize(); } - if(dodraw) { + if (dodraw) { brush->draw(&map, new_tile, ¶m); } else { brush->undraw(&map, new_tile); @@ -1536,24 +1592,24 @@ void Editor::drawInternal(Position offset, bool alt, bool dodraw) action->addChange(newd Change(new_tile)); batch->addAndCommitAction(action); addBatch(batch, 2); - } else if(brush->isSpawnNpc() || brush->isNpc()) { + } else if (brush->isSpawnNpc() || brush->isNpc()) { BatchAction* batch = actionQueue->createBatch(ACTION_DRAW); Action* action = actionQueue->createAction(batch); Tile* tile = map.getTile(offset); Tile* new_tile = nullptr; - if(tile) { + if (tile) { new_tile = tile->deepCopy(map); } else { new_tile = map.allocator(map.createTileL(offset)); } int param; - if(brush->isNpc()) { + if (brush->isNpc()) { param = g_gui.GetSpawnNpcTime(); } else { param = g_gui.GetBrushSize(); } - if(dodraw) { + if (dodraw) { brush->draw(&map, new_tile, ¶m); } else { brush->undraw(&map, new_tile); @@ -1564,19 +1620,18 @@ void Editor::drawInternal(Position offset, bool alt, bool dodraw) } } -void Editor::drawInternal(const PositionVector& tilestodraw, bool alt, bool dodraw) -{ - if(!CanEdit()) { +void Editor::drawInternal(const PositionVector &tilestodraw, bool alt, bool dodraw) { + if (!CanEdit()) { return; } Brush* brush = g_gui.GetCurrentBrush(); - if(!brush) { + if (!brush) { return; } #ifdef __DEBUG__ - if(brush->isGround() || brush->isWall()) { + if (brush->isGround() || brush->isWall()) { // Wrong function, end call return; } @@ -1584,28 +1639,28 @@ void Editor::drawInternal(const PositionVector& tilestodraw, bool alt, bool dodr Action* action = actionQueue->createAction(dodraw ? ACTION_DRAW : ACTION_ERASE); - if(brush->isOptionalBorder()) { + if (brush->isOptionalBorder()) { // We actually need to do borders, but on the same tiles we draw to - for(PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { + for (PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { TileLocation* location = map.createTileL(*it); Tile* tile = location->get(); - if(tile) { - if(dodraw) { + if (tile) { + if (dodraw) { Tile* new_tile = tile->deepCopy(map); brush->draw(&map, new_tile); new_tile->borderize(&map); action->addChange(newd Change(new_tile)); - } else if(!dodraw && tile->hasOptionalBorder()) { + } else if (!dodraw && tile->hasOptionalBorder()) { Tile* new_tile = tile->deepCopy(map); brush->undraw(&map, new_tile); new_tile->borderize(&map); action->addChange(newd Change(new_tile)); } - } else if(dodraw) { + } else if (dodraw) { Tile* new_tile = map.allocator(location); brush->draw(&map, new_tile); new_tile->borderize(&map); - if(new_tile->size() == 0) { + if (new_tile->size() == 0) { delete new_tile; continue; } @@ -1614,18 +1669,18 @@ void Editor::drawInternal(const PositionVector& tilestodraw, bool alt, bool dodr } } else { - for(PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { + for (PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { TileLocation* location = map.createTileL(*it); Tile* tile = location->get(); - if(tile) { + if (tile) { Tile* new_tile = tile->deepCopy(map); - if(dodraw) { + if (dodraw) { brush->draw(&map, new_tile, &alt); } else { brush->undraw(&map, new_tile); } action->addChange(newd Change(new_tile)); - } else if(dodraw) { + } else if (dodraw) { Tile* new_tile = map.allocator(location); brush->draw(&map, new_tile, &alt); action->addChange(newd Change(new_tile)); @@ -1635,34 +1690,33 @@ void Editor::drawInternal(const PositionVector& tilestodraw, bool alt, bool dodr addAction(action, 2); } -void Editor::drawInternal(const PositionVector& tilestodraw, PositionVector& tilestoborder, bool alt, bool dodraw) -{ - if(!CanEdit()) { +void Editor::drawInternal(const PositionVector &tilestodraw, PositionVector &tilestoborder, bool alt, bool dodraw) { + if (!CanEdit()) { return; } Brush* brush = g_gui.GetCurrentBrush(); - if(!brush) { + if (!brush) { return; } - if(brush->isGround() || brush->isEraser()) { + if (brush->isGround() || brush->isEraser()) { ActionIdentifier identifier = (dodraw && !brush->isEraser()) ? ACTION_DRAW : ACTION_ERASE; BatchAction* batch = actionQueue->createBatch(identifier); Action* action = actionQueue->createAction(batch); - for(PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { + for (PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { TileLocation* location = map.createTileL(*it); Tile* tile = location->get(); - if(tile) { + if (tile) { Tile* new_tile = tile->deepCopy(map); - if(g_settings.getInteger(Config::USE_AUTOMAGIC)) { + if (g_settings.getInteger(Config::USE_AUTOMAGIC)) { new_tile->cleanBorders(); } - if(dodraw) - if(brush->isGround() && alt) { + if (dodraw) { + if (brush->isGround() && alt) { std::pair param; - if(replace_brush) { + if (replace_brush) { param.first = false; param.second = replace_brush; } else { @@ -1673,16 +1727,16 @@ void Editor::drawInternal(const PositionVector& tilestodraw, PositionVector& til } else { g_gui.GetCurrentBrush()->draw(&map, new_tile, nullptr); } - else { + } else { g_gui.GetCurrentBrush()->undraw(&map, new_tile); tilestoborder.push_back(*it); } action->addChange(newd Change(new_tile)); - } else if(dodraw) { + } else if (dodraw) { Tile* new_tile = map.allocator(location); - if(brush->isGround() && alt) { + if (brush->isGround() && alt) { std::pair param; - if(replace_brush) { + if (replace_brush) { param.first = false; param.second = replace_brush; } else { @@ -1700,15 +1754,15 @@ void Editor::drawInternal(const PositionVector& tilestodraw, PositionVector& til // Commit changes to map batch->addAndCommitAction(action); - if(g_settings.getInteger(Config::USE_AUTOMAGIC)) { + if (g_settings.getInteger(Config::USE_AUTOMAGIC)) { // Do borders! action = actionQueue->createAction(batch); - for(PositionVector::const_iterator it = tilestoborder.begin(); it != tilestoborder.end(); ++it) { + for (PositionVector::const_iterator it = tilestoborder.begin(); it != tilestoborder.end(); ++it) { TileLocation* location = map.createTileL(*it); Tile* tile = location->get(); - if(tile) { + if (tile) { Tile* new_tile = tile->deepCopy(map); - if(brush->isEraser()) { + if (brush->isEraser()) { new_tile->wallize(&map); new_tile->tableize(&map); new_tile->carpetize(&map); @@ -1717,14 +1771,14 @@ void Editor::drawInternal(const PositionVector& tilestodraw, PositionVector& til action->addChange(newd Change(new_tile)); } else { Tile* new_tile = map.allocator(location); - if(brush->isEraser()) { + if (brush->isEraser()) { // There are no carpets/tables/walls on empty tiles... - //new_tile->wallize(map); - //new_tile->tableize(map); - //new_tile->carpetize(map); + // new_tile->wallize(map); + // new_tile->tableize(map); + // new_tile->carpetize(map); } new_tile->borderize(&map); - if(new_tile->size() > 0) { + if (new_tile->size() > 0) { action->addChange(newd Change(new_tile)); } else { delete new_tile; @@ -1735,21 +1789,22 @@ void Editor::drawInternal(const PositionVector& tilestodraw, PositionVector& til } addBatch(batch, 2); - } else if(brush->isTable() || brush->isCarpet()) { + } else if (brush->isTable() || brush->isCarpet()) { BatchAction* batch = actionQueue->createBatch(ACTION_DRAW); Action* action = actionQueue->createAction(batch); - for(PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { + for (PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { TileLocation* location = map.createTileL(*it); Tile* tile = location->get(); - if(tile) { + if (tile) { Tile* new_tile = tile->deepCopy(map); - if(dodraw) + if (dodraw) { g_gui.GetCurrentBrush()->draw(&map, new_tile, nullptr); - else + } else { g_gui.GetCurrentBrush()->undraw(&map, new_tile); + } action->addChange(newd Change(new_tile)); - } else if(dodraw) { + } else if (dodraw) { Tile* new_tile = map.allocator(location); g_gui.GetCurrentBrush()->draw(&map, new_tile, nullptr); action->addChange(newd Change(new_tile)); @@ -1761,16 +1816,16 @@ void Editor::drawInternal(const PositionVector& tilestodraw, PositionVector& til // Do borders! action = actionQueue->createAction(batch); - for(PositionVector::const_iterator it = tilestoborder.begin(); it != tilestoborder.end(); ++it) { + for (PositionVector::const_iterator it = tilestoborder.begin(); it != tilestoborder.end(); ++it) { Tile* tile = map.getTile(*it); - if(brush->isTable()) { - if(tile && tile->hasTable()) { + if (brush->isTable()) { + if (tile && tile->hasTable()) { Tile* new_tile = tile->deepCopy(map); new_tile->tableize(&map); action->addChange(newd Change(new_tile)); } - } else if(brush->isCarpet()) { - if(tile && tile->hasCarpet()) { + } else if (brush->isCarpet()) { + if (tile && tile->hasCarpet()) { Tile* new_tile = tile->deepCopy(map); new_tile->carpetize(&map); action->addChange(newd Change(new_tile)); @@ -1780,33 +1835,33 @@ void Editor::drawInternal(const PositionVector& tilestodraw, PositionVector& til batch->addAndCommitAction(action); addBatch(batch, 2); - } else if(brush->isWall()) { + } else if (brush->isWall()) { BatchAction* batch = actionQueue->createBatch(ACTION_DRAW); Action* action = actionQueue->createAction(batch); - if(alt && dodraw) { + if (alt && dodraw) { // This is exempt from USE_AUTOMAGIC g_gui.doodad_buffer_map->clear(); BaseMap* draw_map = g_gui.doodad_buffer_map; - for(PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { + for (PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { TileLocation* location = map.createTileL(*it); Tile* tile = location->get(); - if(tile) { + if (tile) { Tile* new_tile = tile->deepCopy(map); new_tile->cleanWalls(brush->isWall()); g_gui.GetCurrentBrush()->draw(draw_map, new_tile); draw_map->setTile(*it, new_tile, true); - } else if(dodraw) { + } else if (dodraw) { Tile* new_tile = map.allocator(location); g_gui.GetCurrentBrush()->draw(draw_map, new_tile); draw_map->setTile(*it, new_tile, true); } } - for(PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { + for (PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { // Get the correct tiles from the draw map instead of the editor map Tile* tile = draw_map->getTile(*it); - if(tile) { + if (tile) { tile->wallize(draw_map); action->addChange(newd Change(tile)); } @@ -1815,19 +1870,20 @@ void Editor::drawInternal(const PositionVector& tilestodraw, PositionVector& til // Commit batch->addAndCommitAction(action); } else { - for(PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { + for (PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { TileLocation* location = map.createTileL(*it); Tile* tile = location->get(); - if(tile) { + if (tile) { Tile* new_tile = tile->deepCopy(map); // Wall cleaning is exempt from automagic new_tile->cleanWalls(brush->isWall()); - if(dodraw) + if (dodraw) { g_gui.GetCurrentBrush()->draw(&map, new_tile); - else + } else { g_gui.GetCurrentBrush()->undraw(&map, new_tile); + } action->addChange(newd Change(new_tile)); - } else if(dodraw) { + } else if (dodraw) { Tile* new_tile = map.allocator(location); g_gui.GetCurrentBrush()->draw(&map, new_tile); action->addChange(newd Change(new_tile)); @@ -1837,15 +1893,15 @@ void Editor::drawInternal(const PositionVector& tilestodraw, PositionVector& til // Commit changes to map batch->addAndCommitAction(action); - if(g_settings.getInteger(Config::USE_AUTOMAGIC)) { + if (g_settings.getInteger(Config::USE_AUTOMAGIC)) { // Do borders! action = actionQueue->createAction(batch); - for(PositionVector::const_iterator it = tilestoborder.begin(); it != tilestoborder.end(); ++it) { + for (PositionVector::const_iterator it = tilestoborder.begin(); it != tilestoborder.end(); ++it) { Tile* tile = map.getTile(*it); - if(tile) { + if (tile) { Tile* new_tile = tile->deepCopy(map); new_tile->wallize(&map); - //if(*tile == *new_tile) delete new_tile; + // if(*tile == *new_tile) delete new_tile; action->addChange(newd Change(new_tile)); } } @@ -1854,26 +1910,28 @@ void Editor::drawInternal(const PositionVector& tilestodraw, PositionVector& til } actionQueue->addBatch(batch, 2); - } else if(brush->isDoor()) { + } else if (brush->isDoor()) { BatchAction* batch = actionQueue->createBatch(ACTION_DRAW); Action* action = actionQueue->createAction(batch); DoorBrush* door_brush = brush->asDoor(); // Loop is kind of redundant since there will only ever be one index. - for(PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { + for (PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { TileLocation* location = map.createTileL(*it); Tile* tile = location->get(); - if(tile) { + if (tile) { Tile* new_tile = tile->deepCopy(map); // Wall cleaning is exempt from automagic - if(brush->isWall()) + if (brush->isWall()) { new_tile->cleanWalls(brush->asWall()); - if(dodraw) + } + if (dodraw) { door_brush->draw(&map, new_tile, &alt); - else + } else { door_brush->undraw(&map, new_tile); + } action->addChange(newd Change(new_tile)); - } else if(dodraw) { + } else if (dodraw) { Tile* new_tile = map.allocator(location); door_brush->draw(&map, new_tile, &alt); action->addChange(newd Change(new_tile)); @@ -1883,15 +1941,15 @@ void Editor::drawInternal(const PositionVector& tilestodraw, PositionVector& til // Commit changes to map batch->addAndCommitAction(action); - if(g_settings.getInteger(Config::USE_AUTOMAGIC)) { + if (g_settings.getInteger(Config::USE_AUTOMAGIC)) { // Do borders! action = actionQueue->createAction(batch); - for(PositionVector::const_iterator it = tilestoborder.begin(); it != tilestoborder.end(); ++it) { + for (PositionVector::const_iterator it = tilestoborder.begin(); it != tilestoborder.end(); ++it) { Tile* tile = map.getTile(*it); - if(tile) { + if (tile) { Tile* new_tile = tile->deepCopy(map); new_tile->wallize(&map); - //if(*tile == *new_tile) delete new_tile; + // if(*tile == *new_tile) delete new_tile; action->addChange(newd Change(new_tile)); } } @@ -1901,17 +1959,18 @@ void Editor::drawInternal(const PositionVector& tilestodraw, PositionVector& til addBatch(batch, 2); } else { Action* action = actionQueue->createAction(ACTION_DRAW); - for(PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { + for (PositionVector::const_iterator it = tilestodraw.begin(); it != tilestodraw.end(); ++it) { TileLocation* location = map.createTileL(*it); Tile* tile = location->get(); - if(tile) { + if (tile) { Tile* new_tile = tile->deepCopy(map); - if(dodraw) + if (dodraw) { g_gui.GetCurrentBrush()->draw(&map, new_tile); - else + } else { g_gui.GetCurrentBrush()->undraw(&map, new_tile); + } action->addChange(newd Change(new_tile)); - } else if(dodraw) { + } else if (dodraw) { Tile* new_tile = map.allocator(location); g_gui.GetCurrentBrush()->draw(&map, new_tile); action->addChange(newd Change(new_tile)); @@ -1924,45 +1983,38 @@ void Editor::drawInternal(const PositionVector& tilestodraw, PositionVector& til /////////////////////////////////////////////////////////////////////////////// // Live! -bool Editor::IsLiveClient() const -{ +bool Editor::IsLiveClient() const { return live_client != nullptr; } -bool Editor::IsLiveServer() const -{ +bool Editor::IsLiveServer() const { return live_server != nullptr; } -bool Editor::IsLive() const -{ +bool Editor::IsLive() const { return IsLiveClient() || IsLiveServer(); } -bool Editor::IsLocal() const -{ +bool Editor::IsLocal() const { return !IsLive(); } -LiveClient* Editor::GetLiveClient() const -{ +LiveClient* Editor::GetLiveClient() const { return live_client; } -LiveServer* Editor::GetLiveServer() const -{ +LiveServer* Editor::GetLiveServer() const { return live_server; } -LiveSocket& Editor::GetLive() const -{ - if(live_server) +LiveSocket &Editor::GetLive() const { + if (live_server) { return *live_server; + } return *live_client; } -LiveServer* Editor::StartLiveServer() -{ +LiveServer* Editor::StartLiveServer() { ASSERT(IsLocal()); live_server = newd LiveServer(*this); @@ -1972,26 +2024,24 @@ LiveServer* Editor::StartLiveServer() return live_server; } -void Editor::BroadcastNodes(DirtyList& dirtyList) -{ - if(IsLiveClient()) { +void Editor::BroadcastNodes(DirtyList &dirtyList) { + if (IsLiveClient()) { live_client->sendChanges(dirtyList); } else { live_server->broadcastNodes(dirtyList); } } -void Editor::CloseLiveServer() -{ +void Editor::CloseLiveServer() { ASSERT(IsLive()); - if(live_client) { + if (live_client) { live_client->close(); delete live_client; live_client = nullptr; } - if(live_server) { + if (live_server) { live_server->close(); delete live_server; @@ -2001,20 +2051,17 @@ void Editor::CloseLiveServer() actionQueue = newd ActionQueue(*this); } - NetworkConnection& connection = NetworkConnection::getInstance(); + NetworkConnection &connection = NetworkConnection::getInstance(); connection.stop(); } -void Editor::QueryNode(int ndx, int ndy, bool underground) -{ +void Editor::QueryNode(int ndx, int ndy, bool underground) { ASSERT(live_client); live_client->queryNode(ndx, ndy, underground); } -void Editor::SendNodeRequests() -{ - if(live_client) { +void Editor::SendNodeRequests() { + if (live_client) { live_client->sendNodeRequests(); } } - diff --git a/source/editor.h b/source/editor.h index 0a19d59d..dbb9dd20 100644 --- a/source/editor.h +++ b/source/editor.h @@ -32,12 +32,11 @@ class LiveClient; class LiveServer; class LiveSocket; -class Editor -{ +class Editor { public: - Editor(CopyBuffer& copybuffer, LiveClient* client); - Editor(CopyBuffer& copybuffer, const FileName& fn); - Editor(CopyBuffer& copybuffer); + Editor(CopyBuffer ©buffer, LiveClient* client); + Editor(CopyBuffer ©buffer, const FileName &fn); + Editor(CopyBuffer ©buffer); ~Editor(); protected: @@ -47,15 +46,17 @@ class Editor public: // Public members - CopyBuffer& copybuffer; + CopyBuffer ©buffer; GroundBrush* replace_brush; public: // Functions // Live Server handling LiveClient* GetLiveClient() const; LiveServer* GetLiveServer() const; - LiveSocket& GetLive() const; - bool CanEdit() const noexcept { return true; } + LiveSocket &GetLive() const; + bool CanEdit() const noexcept { + return true; + } bool IsLocal() const; bool IsLive() const; bool IsLiveServer() const; @@ -64,7 +65,7 @@ class Editor // Server side LiveServer* StartLiveServer(); void CloseLiveServer(); - void BroadcastNodes(DirtyList& dirty_list); + void BroadcastNodes(DirtyList &dirty_list); // Client side void QueryNode(int ndx, int ndy, bool underground); @@ -76,16 +77,28 @@ class Editor // Map handling void saveMap(FileName filename, bool showdialog); // "" means default filename - Map& getMap() noexcept { return map; } - const Map& getMap() const noexcept { return map; } - uint16_t getMapWidth() const noexcept { return map.width; } - uint16_t getMapHeight() const noexcept { return map.height; } - - wxString getLoaderError() const {return map.getError();} + Map &getMap() noexcept { + return map; + } + const Map &getMap() const noexcept { + return map; + } + uint16_t getMapWidth() const noexcept { + return map.width; + } + uint16_t getMapHeight() const noexcept { + return map.height; + } + + wxString getLoaderError() const { + return map.getError(); + } bool importMap(FileName filename, int import_x_offset, int import_y_offset, int import_z_offset, ImportType house_import_type, ImportType spawn_import_type, ImportType spawn_npc_import_type); bool importMiniMap(FileName filename, int import, int import_x_offset, int import_y_offset, int import_z_offset); - ActionQueue* getHistoryActions() const noexcept { return actionQueue; } + ActionQueue* getHistoryActions() const noexcept { + return actionQueue; + } Action* createAction(ActionIdentifier type); Action* createAction(BatchAction* parent); BatchAction* createBatch(ActionIdentifier type); @@ -100,12 +113,18 @@ class Editor void clearActions(); // Selection - Selection& getSelection() noexcept { return selection; } - const Selection& getSelection() const noexcept { return selection; } - bool hasSelection() const noexcept { return selection.size() != 0; } + Selection &getSelection() noexcept { + return selection; + } + const Selection &getSelection() const noexcept { + return selection; + } + bool hasSelection() const noexcept { + return selection.size() != 0; + } // Some simple actions that work on the map (these will work through the undo queue) // Moves the selected area by the offset - void moveSelection(const Position& offset); + void moveSelection(const Position &offset); // Deletes all selected items void destroySelection(); // Borderizes the selected region @@ -123,20 +142,20 @@ class Editor // Draw using the current brush to the target position // alt is whether the ALT key is pressed - void draw(const Position& offset, bool alt); - void undraw(const Position& offset, bool alt); - void draw(const PositionVector& posvec, bool alt); - void draw(const PositionVector& todraw, PositionVector& toborder, bool alt); - void undraw(const PositionVector& posvec, bool alt); - void undraw(const PositionVector& todraw, PositionVector& toborder, bool alt); + void draw(const Position &offset, bool alt); + void undraw(const Position &offset, bool alt); + void draw(const PositionVector &posvec, bool alt); + void draw(const PositionVector &todraw, PositionVector &toborder, bool alt); + void undraw(const PositionVector &posvec, bool alt); + void undraw(const PositionVector &todraw, PositionVector &toborder, bool alt); protected: void drawInternal(const Position offset, bool alt, bool dodraw); - void drawInternal(const PositionVector& posvec, bool alt, bool dodraw); - void drawInternal(const PositionVector& todraw, PositionVector& toborder, bool alt, bool dodraw); + void drawInternal(const PositionVector &posvec, bool alt, bool dodraw); + void drawInternal(const PositionVector &todraw, PositionVector &toborder, bool alt, bool dodraw); - Editor(const Editor&); - Editor& operator=(const Editor&); + Editor(const Editor &); + Editor &operator=(const Editor &); private: Map map; @@ -144,11 +163,23 @@ class Editor ActionQueue* actionQueue; }; -inline void Editor::draw(const Position& offset, bool alt) { drawInternal(offset, alt, true); } -inline void Editor::undraw(const Position& offset, bool alt) { drawInternal(offset, alt, false); } -inline void Editor::draw(const PositionVector& posvec, bool alt) {drawInternal(posvec, alt, true);} -inline void Editor::draw(const PositionVector& todraw, PositionVector& toborder, bool alt) {drawInternal(todraw, toborder, alt, true);} -inline void Editor::undraw(const PositionVector& posvec, bool alt) {drawInternal(posvec, alt, false);} -inline void Editor::undraw(const PositionVector& todraw, PositionVector& toborder, bool alt) {drawInternal(todraw, toborder, alt, false);} +inline void Editor::draw(const Position &offset, bool alt) { + drawInternal(offset, alt, true); +} +inline void Editor::undraw(const Position &offset, bool alt) { + drawInternal(offset, alt, false); +} +inline void Editor::draw(const PositionVector &posvec, bool alt) { + drawInternal(posvec, alt, true); +} +inline void Editor::draw(const PositionVector &todraw, PositionVector &toborder, bool alt) { + drawInternal(todraw, toborder, alt, true); +} +inline void Editor::undraw(const PositionVector &posvec, bool alt) { + drawInternal(posvec, alt, false); +} +inline void Editor::undraw(const PositionVector &todraw, PositionVector &toborder, bool alt) { + drawInternal(todraw, toborder, alt, false); +} #endif diff --git a/source/editor_tabs.cpp b/source/editor_tabs.cpp index c293e952..9f855f86 100644 --- a/source/editor_tabs.cpp +++ b/source/editor_tabs.cpp @@ -21,33 +21,29 @@ #include "editor.h" #include "live_tab.h" -EditorTab::EditorTab() -{ +EditorTab::EditorTab() { ; } -EditorTab::~EditorTab() -{ +EditorTab::~EditorTab() { ; } BEGIN_EVENT_TABLE(MapTabbook, wxPanel) - EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, MapTabbook::OnNotebookPageClose) - EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, MapTabbook::OnNotebookPageChanged) +EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, MapTabbook::OnNotebookPageClose) +EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, MapTabbook::OnNotebookPageChanged) END_EVENT_TABLE() -MapTabbook::MapTabbook(wxWindow *parent, wxWindowID id) : - wxPanel(parent, id, wxDefaultPosition, wxDefaultSize) -{ +MapTabbook::MapTabbook(wxWindow* parent, wxWindowID id) : + wxPanel(parent, id, wxDefaultPosition, wxDefaultSize) { wxSizer* wxz = newd wxBoxSizer(wxHORIZONTAL); notebook = newd wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); wxz->Add(notebook, 1, wxEXPAND); SetSizerAndFit(wxz); } -void MapTabbook::CycleTab(bool forward) -{ - if(!notebook) { +void MapTabbook::CycleTab(bool forward) { + if (!notebook) { return; } @@ -55,7 +51,7 @@ void MapTabbook::CycleTab(bool forward) int32_t currentSelection = notebook->GetSelection(); int32_t selection; - if(forward) { + if (forward) { selection = (currentSelection + 1) % pageCount; } else { selection = (currentSelection - 1 + pageCount) % pageCount; @@ -63,31 +59,30 @@ void MapTabbook::CycleTab(bool forward) notebook->SetSelection(selection); } -void MapTabbook::OnNotebookPageClose(wxAuiNotebookEvent& event) -{ +void MapTabbook::OnNotebookPageClose(wxAuiNotebookEvent &event) { EditorTab* editor_tab = GetTab(event.GetInt()); MapTab* map_tab = dynamic_cast(editor_tab); - if(map_tab && map_tab->IsUniqueReference() && map_tab->GetMap()) { + if (map_tab && map_tab->IsUniqueReference() && map_tab->GetMap()) { bool need_refresh = true; Editor* editor = map_tab->GetEditor(); - if(editor->IsLive()) { - if(editor->hasChanges()) { + if (editor->IsLive()) { + if (editor->hasChanges()) { SetFocusedTab(event.GetInt()); - if(!g_gui.root->DoQuerySave(false)) { + if (!g_gui.root->DoQuerySave(false)) { need_refresh = false; event.Veto(); } } - } else if(editor->hasChanges()) { + } else if (editor->hasChanges()) { SetFocusedTab(event.GetInt()); - if(!g_gui.root->DoQuerySave()) { + if (!g_gui.root->DoQuerySave()) { need_refresh = false; event.Veto(); } } - if(need_refresh) { + if (need_refresh) { g_gui.RefreshPalettes(nullptr, false); g_gui.UpdateMenus(); } @@ -95,133 +90,121 @@ void MapTabbook::OnNotebookPageClose(wxAuiNotebookEvent& event) } LiveLogTab* live_tab = dynamic_cast(editor_tab); - if(live_tab && live_tab->IsConnected()) { + if (live_tab && live_tab->IsConnected()) { event.Veto(); } } -void MapTabbook::OnNotebookPageChanged(wxAuiNotebookEvent& evt) -{ +void MapTabbook::OnNotebookPageChanged(wxAuiNotebookEvent &evt) { g_gui.UpdateMinimap(); int32_t oldSelection = evt.GetOldSelection(); int32_t newSelection = evt.GetSelection(); MapTab* oldMapTab; - if(oldSelection != -1) { + if (oldSelection != -1) { oldMapTab = dynamic_cast(GetTab(oldSelection)); } else { oldMapTab = nullptr; } MapTab* newMapTab; - if(newSelection != -1) { + if (newSelection != -1) { newMapTab = dynamic_cast(GetTab(newSelection)); } else { newMapTab = nullptr; } - if(!newMapTab) { + if (!newMapTab) { g_gui.RefreshPalettes(nullptr); - } else if(!oldMapTab || !oldMapTab->HasSameReference(newMapTab)) { + } else if (!oldMapTab || !oldMapTab->HasSameReference(newMapTab)) { g_gui.RefreshPalettes(newMapTab->GetMap()); g_gui.UpdateMenus(); } - if(oldMapTab) + if (oldMapTab) { oldMapTab->VisibilityCheck(); - if(newMapTab) + } + if (newMapTab) { newMapTab->VisibilityCheck(); + } } -void MapTabbook::OnAllowNotebookDND(wxAuiNotebookEvent& evt) -{ +void MapTabbook::OnAllowNotebookDND(wxAuiNotebookEvent &evt) { evt.Allow(); } // Wrappers -void MapTabbook::AddTab(EditorTab* tab, bool select) -{ +void MapTabbook::AddTab(EditorTab* tab, bool select) { tab->GetWindow()->Reparent(notebook); notebook->AddPage(tab->GetWindow(), tab->GetTitle(), select); conv[tab->GetWindow()] = tab; } -void MapTabbook::SetFocusedTab(int idx) -{ +void MapTabbook::SetFocusedTab(int idx) { notebook->SetSelection(idx); } -EditorTab* MapTabbook::GetInternalTab(int idx) -{ +EditorTab* MapTabbook::GetInternalTab(int idx) { return conv[notebook->GetPage(idx)]; } -EditorTab* MapTabbook::GetCurrentTab() -{ - if(GetTabCount() == 0 || GetSelection() == -1) { +EditorTab* MapTabbook::GetCurrentTab() { + if (GetTabCount() == 0 || GetSelection() == -1) { return nullptr; } return dynamic_cast(GetInternalTab(GetSelection())); } -EditorTab* MapTabbook::GetTab(int index) -{ +EditorTab* MapTabbook::GetTab(int index) { return GetInternalTab(index); } -wxWindow* MapTabbook::GetCurrentPage() -{ - if(GetTabCount() == 0) { +wxWindow* MapTabbook::GetCurrentPage() { + if (GetTabCount() == 0) { return nullptr; } return GetCurrentTab()->GetWindow(); } -void MapTabbook::OnSwitchEditorMode(EditorMode mode) -{ - for(int32_t i = 0; i < GetTabCount(); ++i) { +void MapTabbook::OnSwitchEditorMode(EditorMode mode) { + for (int32_t i = 0; i < GetTabCount(); ++i) { EditorTab* editorTab = GetTab(i); - if(editorTab) { + if (editorTab) { editorTab->OnSwitchEditorMode(mode); } } } -void MapTabbook::SetTabLabel(int idx, wxString label) -{ - if(notebook) { +void MapTabbook::SetTabLabel(int idx, wxString label) { + if (notebook) { notebook->SetPageText(idx, label); } } -void MapTabbook::DeleteTab(int idx) -{ - if(notebook) { +void MapTabbook::DeleteTab(int idx) { + if (notebook) { notebook->DeletePage(idx); } } -int MapTabbook::GetTabCount() -{ - if(notebook) { +int MapTabbook::GetTabCount() { + if (notebook) { return notebook->GetPageCount(); } return 0; } -int MapTabbook::GetTabIndex(wxWindow* w) -{ - if(notebook) { +int MapTabbook::GetTabIndex(wxWindow* w) { + if (notebook) { return notebook->GetPageIndex(w); } return 0; } -int MapTabbook::GetSelection() -{ - if(notebook) { +int MapTabbook::GetSelection() { + if (notebook) { return notebook->GetSelection(); } return 0; diff --git a/source/editor_tabs.h b/source/editor_tabs.h index 114a38eb..7e0c2a83 100644 --- a/source/editor_tabs.h +++ b/source/editor_tabs.h @@ -22,8 +22,7 @@ class EditorTab; -class MapTabbook : public wxPanel -{ +class MapTabbook : public wxPanel { public: MapTabbook(wxWindow* parent, wxWindowID id); @@ -41,9 +40,9 @@ class MapTabbook : public wxPanel EditorTab* GetTab(int idx); // Events - void OnAllowNotebookDND(wxAuiNotebookEvent& evt); - void OnNotebookPageClose(wxAuiNotebookEvent& evt); - void OnNotebookPageChanged(wxAuiNotebookEvent& evt); + void OnAllowNotebookDND(wxAuiNotebookEvent &evt); + void OnNotebookPageClose(wxAuiNotebookEvent &evt); + void OnNotebookPageChanged(wxAuiNotebookEvent &evt); void OnSwitchEditorMode(EditorMode mode); protected: @@ -56,8 +55,7 @@ class MapTabbook : public wxPanel DECLARE_EVENT_TABLE(); }; -class EditorTab -{ +class EditorTab { public: EditorTab(); virtual ~EditorTab(); @@ -67,7 +65,7 @@ class EditorTab virtual wxString GetTitle() const = 0; // - virtual void OnSwitchEditorMode(EditorMode mode) {} + virtual void OnSwitchEditorMode(EditorMode mode) { } }; #endif diff --git a/source/enums.h b/source/enums.h index 87024249..db2e866c 100644 --- a/source/enums.h +++ b/source/enums.h @@ -18,8 +18,7 @@ #ifndef RME_ENUMS_H #define RME_ENUMS_H -enum Direction -{ +enum Direction { NORTH = 0, EAST = 1, SOUTH = 2, diff --git a/source/eraser_brush.cpp b/source/eraser_brush.cpp index 988d9c6d..81baf711 100644 --- a/source/eraser_brush.cpp +++ b/source/eraser_brush.cpp @@ -25,45 +25,39 @@ //============================================================================= // Eraser brush -EraserBrush::EraserBrush() -{ +EraserBrush::EraserBrush() { //// } -EraserBrush::~EraserBrush() -{ +EraserBrush::~EraserBrush() { //// } -std::string EraserBrush::getName() const -{ +std::string EraserBrush::getName() const { return "Eraser"; } -int EraserBrush::getLookID() const -{ +int EraserBrush::getLookID() const { return EDITOR_SPRITE_ERASER; } -bool EraserBrush::canDraw(BaseMap* map, const Position& position) const -{ +bool EraserBrush::canDraw(BaseMap* map, const Position &position) const { return true; } -void EraserBrush::undraw(BaseMap* map, Tile* tile) -{ - for(ItemVector::iterator item_iter = tile->items.begin(); item_iter != tile->items.end();) { +void EraserBrush::undraw(BaseMap* map, Tile* tile) { + for (ItemVector::iterator item_iter = tile->items.begin(); item_iter != tile->items.end();) { Item* item = *item_iter; - if(item->isComplex() && g_settings.getInteger(Config::ERASER_LEAVE_UNIQUE)) { + if (item->isComplex() && g_settings.getInteger(Config::ERASER_LEAVE_UNIQUE)) { ++item_iter; } else { delete item; item_iter = tile->items.erase(item_iter); } } - if(tile->ground) { - if(g_settings.getInteger(Config::ERASER_LEAVE_UNIQUE)) { - if(!tile->ground->isComplex()) { + if (tile->ground) { + if (g_settings.getInteger(Config::ERASER_LEAVE_UNIQUE)) { + if (!tile->ground->isComplex()) { delete tile->ground; tile->ground = nullptr; } @@ -74,14 +68,13 @@ void EraserBrush::undraw(BaseMap* map, Tile* tile) } } -void EraserBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void EraserBrush::draw(BaseMap* map, Tile* tile, void* parameter) { // Draw is undraw, undraw is super-undraw! - for(ItemVector::iterator item_iter = tile->items.begin(); item_iter != tile->items.end();) { + for (ItemVector::iterator item_iter = tile->items.begin(); item_iter != tile->items.end();) { Item* item = *item_iter; - if((item->isComplex() || item->isBorder()) && g_settings.getInteger(Config::ERASER_LEAVE_UNIQUE)) { + if ((item->isComplex() || item->isBorder()) && g_settings.getInteger(Config::ERASER_LEAVE_UNIQUE)) { ++item_iter; - //} else if(item->getDoodadBrush()) { + //} else if(item->getDoodadBrush()) { //++item_iter; } else { delete item; diff --git a/source/extension.cpp b/source/extension.cpp index 4b503f53..e87002b1 100644 --- a/source/extension.cpp +++ b/source/extension.cpp @@ -23,54 +23,49 @@ MaterialsExtension::MaterialsExtension(std::string name, std::string author, std name(name), author(author), description(description), - for_all_versions(false) -{ + for_all_versions(false) { //// } -MaterialsExtension::~MaterialsExtension() -{ +MaterialsExtension::~MaterialsExtension() { //// } -void MaterialsExtension::addVersion(const std::string& versionString) -{ - if(versionString == "all") { +void MaterialsExtension::addVersion(const std::string &versionString) { + if (versionString == "all") { for_all_versions = true; } else { ClientVersion* client = ClientVersion::get(versionString); - if(client) { + if (client) { ClientVersionList supported_versions = ClientVersion::getAllVersionsSupportedForClientVersion(client); version_list.insert(version_list.end(), supported_versions.begin(), supported_versions.end()); } } } -bool MaterialsExtension::isForVersion(uint16_t versionId) -{ - if(for_all_versions) { +bool MaterialsExtension::isForVersion(uint16_t versionId) { + if (for_all_versions) { return true; } - for(ClientVersion* version : version_list) { - if(version->getID() == versionId) { + for (ClientVersion* version : version_list) { + if (version->getID() == versionId) { return true; } } return false; } -std::string MaterialsExtension::getVersionString() -{ - if(for_all_versions) { +std::string MaterialsExtension::getVersionString() { + if (for_all_versions) { return "All"; } std::string versions; std::string last; - for(ClientVersion* version : version_list) { - if(!last.empty()) { - if(!versions.empty()) { + for (ClientVersion* version : version_list) { + if (!last.empty()) { + if (!versions.empty()) { versions += ", " + last; } else { versions = last; @@ -79,8 +74,8 @@ std::string MaterialsExtension::getVersionString() last = version->getName(); } - if(!last.empty()) { - if(!versions.empty()) { + if (!last.empty()) { + if (!versions.empty()) { versions += " and " + last; } else { versions = last; diff --git a/source/extension.h b/source/extension.h index bb958e29..38a9ad0d 100644 --- a/source/extension.h +++ b/source/extension.h @@ -21,13 +21,12 @@ #include "tileset.h" #include "client_version.h" -class MaterialsExtension -{ +class MaterialsExtension { public: MaterialsExtension(std::string name, std::string author, std::string description); ~MaterialsExtension(); - void addVersion(const std::string& versionString); + void addVersion(const std::string &versionString); bool isForVersion(uint16_t versionId); std::string getVersionString(); @@ -40,8 +39,8 @@ class MaterialsExtension ClientVersionList version_list; private: - MaterialsExtension(const MaterialsExtension&); - MaterialsExtension& operator=(const MaterialsExtension&); + MaterialsExtension(const MaterialsExtension &); + MaterialsExtension &operator=(const MaterialsExtension &); }; typedef std::vector MaterialsExtensionList; diff --git a/source/extension_window.cpp b/source/extension_window.cpp index 69582957..1a7ace6c 100644 --- a/source/extension_window.cpp +++ b/source/extension_window.cpp @@ -25,14 +25,13 @@ extern Materials g_materials; BEGIN_EVENT_TABLE(ExtensionsDialog, wxDialog) - EVT_HTML_LINK_CLICKED(wxID_ANY, ExtensionsDialog::OnClickLink) - EVT_BUTTON(wxID_OK, ExtensionsDialog::OnClickOK) - EVT_BUTTON(EXTENSIONS_OPEN_FOLDER_BUTTON, ExtensionsDialog::OnClickOpenFolder) +EVT_HTML_LINK_CLICKED(wxID_ANY, ExtensionsDialog::OnClickLink) +EVT_BUTTON(wxID_OK, ExtensionsDialog::OnClickOK) +EVT_BUTTON(EXTENSIONS_OPEN_FOLDER_BUTTON, ExtensionsDialog::OnClickOpenFolder) END_EVENT_TABLE() ExtensionsDialog::ExtensionsDialog(wxWindow* parent) : - wxDialog(parent, wxID_ANY, "Extensions", wxDefaultPosition, wxSize(600, 500), wxRESIZE_BORDER | wxCAPTION) -{ + wxDialog(parent, wxID_ANY, "Extensions", wxDefaultPosition, wxSize(600, 500), wxRESIZE_BORDER | wxCAPTION) { wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL); wxHtmlWindow* htmlWindow = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxSize(550, 400)); @@ -48,33 +47,29 @@ ExtensionsDialog::ExtensionsDialog(wxWindow* parent) : Centre(wxBOTH); } -ExtensionsDialog::~ExtensionsDialog() -{ +ExtensionsDialog::~ExtensionsDialog() { //// } -void ExtensionsDialog::OnClickLink(wxHtmlLinkEvent& evt) -{ +void ExtensionsDialog::OnClickLink(wxHtmlLinkEvent &evt) { ::wxLaunchDefaultBrowser(evt.GetLinkInfo().GetHref(), wxBROWSER_NEW_WINDOW); } -void ExtensionsDialog::OnClickOK(wxCommandEvent& evt) -{ +void ExtensionsDialog::OnClickOK(wxCommandEvent &evt) { EndModal(0); } -void ExtensionsDialog::OnClickOpenFolder(wxCommandEvent& evt) -{ +void ExtensionsDialog::OnClickOpenFolder(wxCommandEvent &evt) { wxString cmd, extensionsDir = g_gui.GetExtensionsDirectory(); #if defined __WINDOWS__ cmd << "explorer"; #elif defined __APPLE__ cmd << "open"; - extensionsDir.Replace(" ", "\\ "); //Escape spaces + extensionsDir.Replace(" ", "\\ "); // Escape spaces #elif defined __linux cmd << "xdg-open"; #else -#error "NOT IMPLEMENTED" + #error "NOT IMPLEMENTED" #endif cmd << " " << extensionsDir; @@ -82,18 +77,16 @@ void ExtensionsDialog::OnClickOpenFolder(wxCommandEvent& evt) wxExecute(cmd); } -wxString ExtensionsDialog::HTML() const -{ +wxString ExtensionsDialog::HTML() const { wxString markup; - for(MaterialsExtensionList::const_iterator me = g_materials.getExtensions().begin(); me != g_materials.getExtensions().end(); ++me) { + for (MaterialsExtensionList::const_iterator me = g_materials.getExtensions().begin(); me != g_materials.getExtensions().end(); ++me) { markup << HTMLForExtension(*me); markup << "
"; } return markup; } -wxString ExtensionsDialog::HTMLForExtension(MaterialsExtension* me) const -{ +wxString ExtensionsDialog::HTMLForExtension(MaterialsExtension* me) const { wxString markup; markup << "" @@ -102,10 +95,11 @@ wxString ExtensionsDialog::HTMLForExtension(MaterialsExtension* me) const << "" << "" @@ -115,10 +109,11 @@ wxString ExtensionsDialog::HTMLForExtension(MaterialsExtension* me) const << "" << "" @@ -134,8 +129,7 @@ wxString ExtensionsDialog::HTMLForExtension(MaterialsExtension* me) const << "" << "" - << "
Extension"; - if(me->url.empty()) + if (me->url.empty()) { markup << me->name; - else + } else { markup << "" << me->name << ""; + } markup << "Author"; - if(me->author_url.empty()) + if (me->author_url.empty()) { markup << me->author; - else + } else { markup << "" << me->author << ""; + } markup << "" << me->getVersionString() << "
" - ; + << ""; return markup; } diff --git a/source/extension_window.h b/source/extension_window.h index 944a9def..58b597c0 100644 --- a/source/extension_window.h +++ b/source/extension_window.h @@ -20,15 +20,14 @@ class MaterialsExtension; -class ExtensionsDialog : public wxDialog -{ +class ExtensionsDialog : public wxDialog { public: ExtensionsDialog(wxWindow* parent); virtual ~ExtensionsDialog(); - void OnClickOK(wxCommandEvent& evt); - void OnClickOpenFolder(wxCommandEvent& evt); - void OnClickLink(wxHtmlLinkEvent& evt); + void OnClickOK(wxCommandEvent &evt); + void OnClickOpenFolder(wxCommandEvent &evt); + void OnClickLink(wxHtmlLinkEvent &evt); DECLARE_EVENT_TABLE(); @@ -37,5 +36,4 @@ class ExtensionsDialog : public wxDialog wxString HTMLForExtension(MaterialsExtension* me) const; }; - #endif diff --git a/source/filehandle.cpp b/source/filehandle.cpp index 5bc41604..6653b240 100644 --- a/source/filehandle.cpp +++ b/source/filehandle.cpp @@ -19,51 +19,54 @@ #include "filehandle.h" - uint8_t NodeFileWriteHandle::NODE_START = ::NODE_START; uint8_t NodeFileWriteHandle::NODE_END = ::NODE_END; uint8_t NodeFileWriteHandle::ESCAPE_CHAR = ::ESCAPE_CHAR; -bool FileHandle::seek(size_t offset, int origin) -{ - if(file) { +bool FileHandle::seek(size_t offset, int origin) { + if (file) { return fseek(file, static_cast(offset), origin) == 0; } return false; } -size_t FileHandle::tell() -{ - if(file) { +size_t FileHandle::tell() { + if (file) { return ftell(file); } return 0; } -void FileHandle::close() -{ - if(file) { +void FileHandle::close() { + if (file) { fclose(file); file = nullptr; } } -std::string FileHandle::getErrorMessage() -{ - switch(error_code) { - case FILE_NO_ERROR: return "No error"; - case FILE_COULD_NOT_OPEN: return "Could not open file"; - case FILE_INVALID_IDENTIFIER: return "File magic number not recognized"; - case FILE_STRING_TOO_LONG: return "Too long string encountered"; - case FILE_READ_ERROR: return "Failed to read from file"; - case FILE_WRITE_ERROR: return "Failed to write to file"; - case FILE_SYNTAX_ERROR: return "Node file syntax error"; - case FILE_PREMATURE_END: return "File end encountered unexpectedly"; - } - if(file == nullptr) { +std::string FileHandle::getErrorMessage() { + switch (error_code) { + case FILE_NO_ERROR: + return "No error"; + case FILE_COULD_NOT_OPEN: + return "Could not open file"; + case FILE_INVALID_IDENTIFIER: + return "File magic number not recognized"; + case FILE_STRING_TOO_LONG: + return "Too long string encountered"; + case FILE_READ_ERROR: + return "Failed to read from file"; + case FILE_WRITE_ERROR: + return "Failed to write to file"; + case FILE_SYNTAX_ERROR: + return "Node file syntax error"; + case FILE_PREMATURE_END: + return "File end encountered unexpectedly"; + } + if (file == nullptr) { return "Could not open file (2)"; } - if(ferror(file)) { + if (ferror(file)) { return "Internal file error #" + i2s(ferror(file)); } return "No error"; @@ -72,14 +75,14 @@ std::string FileHandle::getErrorMessage() //============================================================================= // File read handle -FileReadHandle::FileReadHandle(const std::string& name) : file_size(0) -{ +FileReadHandle::FileReadHandle(const std::string &name) : + file_size(0) { #if defined __VISUALC__ && defined _UNICODE file = _wfopen(string2wstring(name).c_str(), L"rb"); #else file = fopen(name.c_str(), "rb"); #endif - if(!file || ferror(file)) { + if (!file || ferror(file)) { error_code = FILE_COULD_NOT_OPEN; } else { fseek(file, 0, SEEK_END); @@ -88,52 +91,46 @@ FileReadHandle::FileReadHandle(const std::string& name) : file_size(0) } } -FileReadHandle::~FileReadHandle() -{ +FileReadHandle::~FileReadHandle() { //// } -void FileReadHandle::close() -{ +void FileReadHandle::close() { file_size = 0; FileHandle::close(); } -bool FileReadHandle::getRAW(uint8_t* ptr, size_t sz) -{ +bool FileReadHandle::getRAW(uint8_t* ptr, size_t sz) { size_t o = fread(ptr, 1, sz, file); - if(o != sz) { + if (o != sz) { error_code = FILE_READ_ERROR; return false; } return true; } -bool FileReadHandle::getRAW(std::string& str, size_t sz) -{ +bool FileReadHandle::getRAW(std::string &str, size_t sz) { str.resize(sz); size_t o = fread(const_cast(str.data()), 1, sz, file); - if(o != sz) { + if (o != sz) { error_code = FILE_READ_ERROR; return false; } return true; } -bool FileReadHandle::getString(std::string& str) -{ +bool FileReadHandle::getString(std::string &str) { uint16_t sz; - if(!getU16(sz)) { + if (!getU16(sz)) { error_code = FILE_READ_ERROR; return false; } return getRAW(str, sz); } -bool FileReadHandle::getLongString(std::string& str) -{ +bool FileReadHandle::getLongString(std::string &str) { uint32_t sz; - if(!getU32(sz)) { + if (!getU32(sz)) { error_code = FILE_READ_ERROR; return false; } @@ -149,34 +146,30 @@ NodeFileReadHandle::NodeFileReadHandle() : cache_size(32768), cache_length(0), local_read_index(0), - root_node(nullptr) -{ + root_node(nullptr) { //// } -NodeFileReadHandle::~NodeFileReadHandle() -{ - while(!unused.empty()) { +NodeFileReadHandle::~NodeFileReadHandle() { + while (!unused.empty()) { free(unused.top()); unused.pop(); } } -BinaryNode* NodeFileReadHandle::getNode(BinaryNode* parent) -{ +BinaryNode* NodeFileReadHandle::getNode(BinaryNode* parent) { void* mem; - if(unused.empty()) { + if (unused.empty()) { mem = malloc(sizeof(BinaryNode)); } else { mem = unused.top(); unused.pop(); } - return new(mem) BinaryNode(this, parent); + return new (mem) BinaryNode(this, parent); } -void NodeFileReadHandle::freeNode(BinaryNode* node) -{ - if(node) { +void NodeFileReadHandle::freeNode(BinaryNode* node) { + if (node) { node->~BinaryNode(); unused.push(node); } @@ -185,13 +178,11 @@ void NodeFileReadHandle::freeNode(BinaryNode* node) //============================================================================= // Memory based node file read handle -MemoryNodeFileReadHandle::MemoryNodeFileReadHandle(const uint8_t* data, size_t size) -{ +MemoryNodeFileReadHandle::MemoryNodeFileReadHandle(const uint8_t* data, size_t size) { assign(data, size); } -void MemoryNodeFileReadHandle::assign(const uint8_t* data, size_t size) -{ +void MemoryNodeFileReadHandle::assign(const uint8_t* data, size_t size) { freeNode(root_node); root_node = nullptr; // Highly volatile, but we know we're not gonna modify @@ -200,23 +191,19 @@ void MemoryNodeFileReadHandle::assign(const uint8_t* data, size_t size) local_read_index = 0; } -MemoryNodeFileReadHandle::~MemoryNodeFileReadHandle() -{ +MemoryNodeFileReadHandle::~MemoryNodeFileReadHandle() { freeNode(root_node); } -void MemoryNodeFileReadHandle::close() -{ +void MemoryNodeFileReadHandle::close() { assign(nullptr, 0); } -bool MemoryNodeFileReadHandle::renewCache() -{ +bool MemoryNodeFileReadHandle::renewCache() { return false; } -BinaryNode* MemoryNodeFileReadHandle::getRootNode() -{ +BinaryNode* MemoryNodeFileReadHandle::getRootNode() { assert(root_node == nullptr); // You should never do this twice local_read_index++; // Skip first NODE_START @@ -229,19 +216,18 @@ BinaryNode* MemoryNodeFileReadHandle::getRootNode() //============================================================================= // File based node file read handle -DiskNodeFileReadHandle::DiskNodeFileReadHandle(const std::string& name, const std::vector& acceptable_identifiers) : - file_size(0) -{ +DiskNodeFileReadHandle::DiskNodeFileReadHandle(const std::string &name, const std::vector &acceptable_identifiers) : + file_size(0) { #if defined __VISUALC__ && defined _UNICODE file = _wfopen(string2wstring(name).c_str(), L"rb"); #else file = fopen(name.c_str(), "rb"); #endif - if(!file || ferror(file)) { + if (!file || ferror(file)) { error_code = FILE_COULD_NOT_OPEN; } else { char ver[4]; - if(fread(ver, 1, 4, file) != 4) { + if (fread(ver, 1, 4, file) != 4) { fclose(file); error_code = FILE_SYNTAX_ERROR; return; @@ -249,16 +235,16 @@ DiskNodeFileReadHandle::DiskNodeFileReadHandle(const std::string& name, const st // 0x00 00 00 00 is accepted as a wildcard version - if(ver[0] != 0 || ver[1] != 0 || ver[2] != 0 || ver[3] != 0) { + if (ver[0] != 0 || ver[1] != 0 || ver[2] != 0 || ver[3] != 0) { bool accepted = false; - for(std::vector::const_iterator id_iter = acceptable_identifiers.begin(); id_iter != acceptable_identifiers.end(); ++id_iter) { - if(memcmp(ver, id_iter->c_str(), 4) == 0) { + for (std::vector::const_iterator id_iter = acceptable_identifiers.begin(); id_iter != acceptable_identifiers.end(); ++id_iter) { + if (memcmp(ver, id_iter->c_str(), 4) == 0) { accepted = true; break; } } - if(!accepted) { + if (!accepted) { fclose(file); error_code = FILE_SYNTAX_ERROR; return; @@ -271,50 +257,46 @@ DiskNodeFileReadHandle::DiskNodeFileReadHandle(const std::string& name, const st } } -DiskNodeFileReadHandle::~DiskNodeFileReadHandle() -{ +DiskNodeFileReadHandle::~DiskNodeFileReadHandle() { close(); } -void DiskNodeFileReadHandle::close() -{ +void DiskNodeFileReadHandle::close() { freeNode(root_node); file_size = 0; FileHandle::close(); free(cache); } -bool DiskNodeFileReadHandle::renewCache() -{ - if(!cache) { +bool DiskNodeFileReadHandle::renewCache() { + if (!cache) { cache = (uint8_t*)malloc(cache_size); } cache_length = fread(cache, 1, cache_size, file); - if(cache_length == 0 || ferror(file)) { + if (cache_length == 0 || ferror(file)) { return false; } local_read_index = 0; return true; } -BinaryNode* DiskNodeFileReadHandle::getRootNode() -{ - assert(root_node == nullptr); // You should never do this twice - uint8_t first; - size_t numRead = fread(&first, 1, 1, file); - if(numRead != 1) { - error_code = FILE_READ_ERROR; - return nullptr; - } - if(first == NODE_START) { - root_node = getNode(nullptr); - root_node->load(); - return root_node; - } else { - error_code = FILE_SYNTAX_ERROR; - return nullptr; - } +BinaryNode* DiskNodeFileReadHandle::getRootNode() { + assert(root_node == nullptr); // You should never do this twice + uint8_t first; + size_t numRead = fread(&first, 1, 1, file); + if (numRead != 1) { + error_code = FILE_READ_ERROR; + return nullptr; + } + if (first == NODE_START) { + root_node = getNode(nullptr); + root_node->load(); + return root_node; + } else { + error_code = FILE_SYNTAX_ERROR; + return nullptr; + } } //============================================================================= @@ -324,22 +306,19 @@ BinaryNode::BinaryNode(NodeFileReadHandle* file, BinaryNode* parent) : read_offset(0), file(file), parent(parent), - child(nullptr) -{ + child(nullptr) { //// } -BinaryNode::~BinaryNode() -{ +BinaryNode::~BinaryNode() { file->freeNode(child); } -BinaryNode* BinaryNode::getChild() -{ +BinaryNode* BinaryNode::getChild() { ASSERT(file); ASSERT(child == nullptr); - if(file->last_was_start) { + if (file->last_was_start) { child = file->getNode(this); child->load(); return child; @@ -347,9 +326,8 @@ BinaryNode* BinaryNode::getChild() return nullptr; } -bool BinaryNode::getRAW(uint8_t* ptr, size_t sz) -{ - if(read_offset + sz > data.size()) { +bool BinaryNode::getRAW(uint8_t* ptr, size_t sz) { + if (read_offset + sz > data.size()) { read_offset = data.size(); return false; } @@ -358,9 +336,8 @@ bool BinaryNode::getRAW(uint8_t* ptr, size_t sz) return true; } -bool BinaryNode::getRAW(std::string& str, size_t sz) -{ - if(read_offset + sz > data.size()) { +bool BinaryNode::getRAW(std::string &str, size_t sz) { + if (read_offset + sz > data.size()) { read_offset = data.size(); return false; } @@ -369,54 +346,52 @@ bool BinaryNode::getRAW(std::string& str, size_t sz) return true; } -bool BinaryNode::getString(std::string& str) -{ +bool BinaryNode::getString(std::string &str) { uint16_t len; - if(!getU16(len)) { + if (!getU16(len)) { return false; } return getRAW(str, len); } -bool BinaryNode::getLongString(std::string& str) -{ +bool BinaryNode::getLongString(std::string &str) { uint32_t len; - if(!getU32(len)) { + if (!getU32(len)) { return false; } return getRAW(str, len); } -BinaryNode* BinaryNode::advance() -{ +BinaryNode* BinaryNode::advance() { // Advance this to the next position ASSERT(file); - if(file->error_code != FILE_NO_ERROR) + if (file->error_code != FILE_NO_ERROR) { return nullptr; + } - if(child == nullptr) { + if (child == nullptr) { getChild(); } // We need to move the cursor to the next node, since we're still iterating our child node! - while(child) { + while (child) { // both functions modify ourselves and sets child to nullptr, so loop will be aborted // possibly change to assignment ? child->getChild(); child->advance(); } - if(file->last_was_start) { + if (file->last_was_start) { return nullptr; } else { // Last was end (0xff) // Read next byte to decide if there is another node following this - uint8_t*& cache = file->cache; - size_t& cache_length = file->cache_length; - size_t& local_read_index = file->local_read_index; + uint8_t*&cache = file->cache; + size_t &cache_length = file->cache_length; + size_t &local_read_index = file->local_read_index; - if(local_read_index >= cache_length) { - if(!file->renewCache()) { + if (local_read_index >= cache_length) { + if (!file->renewCache()) { // Failed to renew, exit parent->child = nullptr; file->freeNode(this); @@ -427,14 +402,14 @@ BinaryNode* BinaryNode::advance() uint8_t op = cache[local_read_index]; ++local_read_index; - if(op == NODE_START) { + if (op == NODE_START) { // Another node follows this. // Load this node as the next one read_offset = 0; data.clear(); load(); return this; - } else if(op == NODE_END) { + } else if (op == NODE_END) { // End of this child-tree parent->child = nullptr; file->last_was_start = false; @@ -447,16 +422,15 @@ BinaryNode* BinaryNode::advance() } } -void BinaryNode::load() -{ +void BinaryNode::load() { ASSERT(file); // Read until next node starts - uint8_t*& cache = file->cache; - size_t& cache_length = file->cache_length; - size_t& local_read_index = file->local_read_index; - while(true) { - if(local_read_index >= cache_length) { - if(!file->renewCache()) { + uint8_t*&cache = file->cache; + size_t &cache_length = file->cache_length; + size_t &local_read_index = file->local_read_index; + while (true) { + if (local_read_index >= cache_length) { + if (!file->renewCache()) { // Failed to renew, exit file->error_code = FILE_PREMATURE_END; return; @@ -466,7 +440,7 @@ void BinaryNode::load() uint8_t op = cache[local_read_index]; ++local_read_index; - switch(op) { + switch (op) { case NODE_START: { file->last_was_start = true; return; @@ -478,8 +452,8 @@ void BinaryNode::load() } case ESCAPE_CHAR: { - if(local_read_index >= cache_length) { - if(!file->renewCache()) { + if (local_read_index >= cache_length) { + if (!file->renewCache()) { // Failed to renew, exit file->error_code = FILE_PREMATURE_END; return; @@ -494,7 +468,7 @@ void BinaryNode::load() default: break; } - //std::cout << "Appending..." << std::endl; + // std::cout << "Appending..." << std::endl; data.append(1, op); } } @@ -502,26 +476,23 @@ void BinaryNode::load() //============================================================================= // node file binary write handle -FileWriteHandle::FileWriteHandle(const std::string& name) -{ +FileWriteHandle::FileWriteHandle(const std::string &name) { #if defined __VISUALC__ && defined _UNICODE file = _wfopen(string2wstring(name).c_str(), L"wb"); #else file = fopen(name.c_str(), "wb"); #endif - if(file == nullptr || ferror(file)) { + if (file == nullptr || ferror(file)) { error_code = FILE_COULD_NOT_OPEN; } } -FileWriteHandle::~FileWriteHandle() -{ +FileWriteHandle::~FileWriteHandle() { //// } -bool FileWriteHandle::addString(const std::string& str) -{ - if(str.size() > 0xFFFF) { +bool FileWriteHandle::addString(const std::string &str) { + if (str.size() > 0xFFFF) { error_code = FILE_STRING_TOO_LONG; return false; } @@ -530,10 +501,9 @@ bool FileWriteHandle::addString(const std::string& str) return true; } -bool FileWriteHandle::addString(const char* str) -{ +bool FileWriteHandle::addString(const char* str) { size_t len = strlen(str); - if(len > 0xFFFF) { + if (len > 0xFFFF) { error_code = FILE_STRING_TOO_LONG; return false; } @@ -542,28 +512,24 @@ bool FileWriteHandle::addString(const char* str) return true; } -bool FileWriteHandle::addLongString(const std::string& str) -{ +bool FileWriteHandle::addLongString(const std::string &str) { addU32(uint32_t(str.size())); addRAW(str); return true; } -bool FileWriteHandle::addRAW(const std::string& str) -{ +bool FileWriteHandle::addRAW(const std::string &str) { fwrite(str.c_str(), 1, str.size(), file); return ferror(file) == 0; } -bool FileWriteHandle::addRAW(const uint8_t* ptr, size_t sz) -{ +bool FileWriteHandle::addRAW(const uint8_t* ptr, size_t sz) { fwrite(ptr, 1, sz, file); return ferror(file) == 0; } -void FileWriteHandle::flush() -{ - if(file) { +void FileWriteHandle::flush() { + if (file) { fflush(file); } } @@ -571,37 +537,34 @@ void FileWriteHandle::flush() //============================================================================= // Disk based node file write handle -DiskNodeFileWriteHandle::DiskNodeFileWriteHandle(const std::string& name, const std::string& identifier) -{ +DiskNodeFileWriteHandle::DiskNodeFileWriteHandle(const std::string &name, const std::string &identifier) { #if defined __VISUALC__ && defined _UNICODE file = _wfopen(string2wstring(name).c_str(), L"wb"); #else file = fopen(name.c_str(), "wb"); #endif - if(!file || ferror(file)) { + if (!file || ferror(file)) { error_code = FILE_COULD_NOT_OPEN; return; } - if(identifier.length() != 4) { + if (identifier.length() != 4) { error_code = FILE_INVALID_IDENTIFIER; return; } fwrite(identifier.c_str(), 1, 4, file); - if(!cache) { - cache = (uint8_t*)malloc(cache_size+1); + if (!cache) { + cache = (uint8_t*)malloc(cache_size + 1); } local_write_index = 0; } -DiskNodeFileWriteHandle::~DiskNodeFileWriteHandle() -{ +DiskNodeFileWriteHandle::~DiskNodeFileWriteHandle() { close(); } -void DiskNodeFileWriteHandle::close() -{ - if(file) { +void DiskNodeFileWriteHandle::close() { + if (file) { renewCache(); fclose(file); file = nullptr; @@ -609,15 +572,14 @@ void DiskNodeFileWriteHandle::close() } } -void DiskNodeFileWriteHandle::renewCache() -{ - if(cache) { +void DiskNodeFileWriteHandle::renewCache() { + if (cache) { fwrite(cache, local_write_index, 1, file); - if(ferror(file) != 0) { + if (ferror(file) != 0) { error_code = FILE_WRITE_ERROR; } } else { - cache = (uint8_t*)malloc(cache_size+1); + cache = (uint8_t*)malloc(cache_size + 1); } local_write_index = 0; } @@ -625,51 +587,44 @@ void DiskNodeFileWriteHandle::renewCache() //============================================================================= // Memory based node file write handle -MemoryNodeFileWriteHandle::MemoryNodeFileWriteHandle() -{ - if(!cache) { - cache = (uint8_t*)malloc(cache_size+1); +MemoryNodeFileWriteHandle::MemoryNodeFileWriteHandle() { + if (!cache) { + cache = (uint8_t*)malloc(cache_size + 1); } local_write_index = 0; } -MemoryNodeFileWriteHandle::~MemoryNodeFileWriteHandle() -{ +MemoryNodeFileWriteHandle::~MemoryNodeFileWriteHandle() { close(); } -void MemoryNodeFileWriteHandle::reset() -{ +void MemoryNodeFileWriteHandle::reset() { memset(cache, 0xAA, cache_size); local_write_index = 0; } -void MemoryNodeFileWriteHandle::close() -{ +void MemoryNodeFileWriteHandle::close() { free(cache); cache = nullptr; } -uint8_t* MemoryNodeFileWriteHandle::getMemory() -{ +uint8_t* MemoryNodeFileWriteHandle::getMemory() { return cache; } -size_t MemoryNodeFileWriteHandle::getSize() -{ +size_t MemoryNodeFileWriteHandle::getSize() { return local_write_index; } -void MemoryNodeFileWriteHandle::renewCache() -{ - if(cache) { +void MemoryNodeFileWriteHandle::renewCache() { + if (cache) { cache_size = cache_size * 2; cache = (uint8_t*)realloc(cache, cache_size); - if(!cache) { + if (!cache) { exit(1); } } else { - cache = (uint8_t*)malloc(cache_size+1); + cache = (uint8_t*)malloc(cache_size + 1); } } @@ -679,74 +634,64 @@ void MemoryNodeFileWriteHandle::renewCache() NodeFileWriteHandle::NodeFileWriteHandle() : cache(nullptr), cache_size(0x7FFF), - local_write_index(0) -{ + local_write_index(0) { //// } -NodeFileWriteHandle::~NodeFileWriteHandle() -{ +NodeFileWriteHandle::~NodeFileWriteHandle() { free(cache); } -bool NodeFileWriteHandle::addNode(uint8_t nodetype) -{ +bool NodeFileWriteHandle::addNode(uint8_t nodetype) { cache[local_write_index++] = NODE_START; - if(local_write_index >= cache_size) { + if (local_write_index >= cache_size) { renewCache(); } cache[local_write_index++] = nodetype; - if(local_write_index >= cache_size) { + if (local_write_index >= cache_size) { renewCache(); } return error_code == FILE_NO_ERROR; } -bool NodeFileWriteHandle::endNode() -{ +bool NodeFileWriteHandle::endNode() { cache[local_write_index++] = NODE_END; - if(local_write_index >= cache_size) { + if (local_write_index >= cache_size) { renewCache(); } return error_code == FILE_NO_ERROR; } -bool NodeFileWriteHandle::addU8(uint8_t u8) -{ +bool NodeFileWriteHandle::addU8(uint8_t u8) { writeBytes(&u8, sizeof(u8)); return error_code == FILE_NO_ERROR; } -bool NodeFileWriteHandle::addByte(uint8_t u8) -{ +bool NodeFileWriteHandle::addByte(uint8_t u8) { writeBytes(&u8, sizeof(u8)); return error_code == FILE_NO_ERROR; } -bool NodeFileWriteHandle::addU16(uint16_t u16) -{ +bool NodeFileWriteHandle::addU16(uint16_t u16) { writeBytes(reinterpret_cast(&u16), sizeof(u16)); return error_code == FILE_NO_ERROR; } -bool NodeFileWriteHandle::addU32(uint32_t u32) -{ +bool NodeFileWriteHandle::addU32(uint32_t u32) { writeBytes(reinterpret_cast(&u32), sizeof(u32)); return error_code == FILE_NO_ERROR; } -bool NodeFileWriteHandle::addU64(uint64_t u64) -{ +bool NodeFileWriteHandle::addU64(uint64_t u64) { writeBytes(reinterpret_cast(&u64), sizeof(u64)); return error_code == FILE_NO_ERROR; } -bool NodeFileWriteHandle::addString(const std::string& str) -{ - if(str.size() > 0xFFFF) { +bool NodeFileWriteHandle::addString(const std::string &str) { + if (str.size() > 0xFFFF) { error_code = FILE_STRING_TOO_LONG; return false; } @@ -755,21 +700,18 @@ bool NodeFileWriteHandle::addString(const std::string& str) return error_code == FILE_NO_ERROR; } -bool NodeFileWriteHandle::addLongString(const std::string& str) -{ +bool NodeFileWriteHandle::addLongString(const std::string &str) { addU32(uint32_t(str.size())); addRAW((const uint8_t*)str.c_str(), str.size()); return error_code == FILE_NO_ERROR; } -bool NodeFileWriteHandle::addRAW(std::string& str) -{ +bool NodeFileWriteHandle::addRAW(std::string &str) { writeBytes(reinterpret_cast(const_cast(str.data())), str.size()); return error_code == FILE_NO_ERROR; } -bool NodeFileWriteHandle::addRAW(const uint8_t* ptr, size_t sz) -{ +bool NodeFileWriteHandle::addRAW(const uint8_t* ptr, size_t sz) { writeBytes(ptr, sz); return error_code == FILE_NO_ERROR; } diff --git a/source/filehandle.h b/source/filehandle.h index 31156d92..e14590b4 100644 --- a/source/filehandle.h +++ b/source/filehandle.h @@ -21,13 +21,12 @@ #include "definitions.h" #include - #ifndef FORCEINLINE -# ifdef _MSV_VER -# define FORCEINLINE __forceinline -# else -# define FORCEINLINE inline -# endif + #ifdef _MSV_VER + #define FORCEINLINE __forceinline + #else + #define FORCEINLINE inline + #endif #endif enum FileHandleError { @@ -47,23 +46,31 @@ enum NodeType { ESCAPE_CHAR = 0xfd, }; -class FileHandle -{ +class FileHandle { public: - FileHandle() : error_code(FILE_NO_ERROR), file(nullptr) {} - virtual ~FileHandle() { close(); } + FileHandle() : + error_code(FILE_NO_ERROR), file(nullptr) { } + virtual ~FileHandle() { + close(); + } bool seek(size_t offset, int origin = SEEK_SET); size_t tell(); - FORCEINLINE void skip(size_t offset) { seek(offset, SEEK_CUR); } + FORCEINLINE void skip(size_t offset) { + seek(offset, SEEK_CUR); + } // Ensures we don't accidentally copy it. FileHandle(const FileHandle &) = delete; FileHandle &operator=(const FileHandle &) = delete; virtual void close(); - virtual bool isOpen() {return file != nullptr;} - virtual bool isOk() {return isOpen() && error_code == FILE_NO_ERROR && ferror(file) == 0;} + virtual bool isOpen() { + return file != nullptr; + } + virtual bool isOk() { + return isOpen() && error_code == FILE_NO_ERROR && ferror(file) == 0; + } std::string getErrorMessage(); public: @@ -71,53 +78,75 @@ class FileHandle FILE* file; }; -class FileReadHandle : public FileHandle -{ +class FileReadHandle : public FileHandle { public: - explicit FileReadHandle(const std::string& name); + explicit FileReadHandle(const std::string &name); virtual ~FileReadHandle(); - FORCEINLINE bool getU8(uint8_t& u8) {return getType(u8);} - FORCEINLINE bool getByte(uint8_t& u8) {return getType(u8);} - FORCEINLINE bool getSByte(int8_t& i8) { return getType(i8); } - FORCEINLINE bool getU16(uint16_t& u16) {return getType(u16);} - FORCEINLINE bool getU32(uint32_t& u32) {return getType(u32);} - FORCEINLINE bool get32(int32_t& i32) { return getType(i32); } + FORCEINLINE bool getU8(uint8_t &u8) { + return getType(u8); + } + FORCEINLINE bool getByte(uint8_t &u8) { + return getType(u8); + } + FORCEINLINE bool getSByte(int8_t &i8) { + return getType(i8); + } + FORCEINLINE bool getU16(uint16_t &u16) { + return getType(u16); + } + FORCEINLINE bool getU32(uint32_t &u32) { + return getType(u32); + } + FORCEINLINE bool get32(int32_t &i32) { + return getType(i32); + } bool getRAW(uint8_t* ptr, size_t sz); - bool getRAW(std::string& str, size_t sz); - bool getString(std::string& str); - bool getLongString(std::string& str); + bool getRAW(std::string &str, size_t sz); + bool getString(std::string &str); + bool getLongString(std::string &str); virtual void close(); - size_t size() { return file_size; } - + size_t size() { + return file_size; + } + protected: size_t file_size; - template - bool getType(T& ref) { - size_t numRead = fread(&ref, sizeof(ref), 1, file); - return numRead == 1 && ferror(file) == 0; - } + template + bool getType(T &ref) { + size_t numRead = fread(&ref, sizeof(ref), 1, file); + return numRead == 1 && ferror(file) == 0; + } }; class NodeFileReadHandle; class DiskNodeFileReadHandle; class MemoryNodeFileReadHandle; -class BinaryNode -{ +class BinaryNode { public: BinaryNode(NodeFileReadHandle* file, BinaryNode* parent); ~BinaryNode(); - FORCEINLINE bool getU8(uint8_t& u8) {return getType(u8);} - FORCEINLINE bool getByte(uint8_t& u8) {return getType(u8);} - FORCEINLINE bool getU16(uint16_t& u16) {return getType(u16);} - FORCEINLINE bool getU32(uint32_t& u32) {return getType(u32);} - FORCEINLINE bool getU64(uint64_t& u64) {return getType(u64);} + FORCEINLINE bool getU8(uint8_t &u8) { + return getType(u8); + } + FORCEINLINE bool getByte(uint8_t &u8) { + return getType(u8); + } + FORCEINLINE bool getU16(uint16_t &u16) { + return getType(u16); + } + FORCEINLINE bool getU32(uint32_t &u32) { + return getType(u32); + } + FORCEINLINE bool getU64(uint64_t &u64) { + return getType(u64); + } FORCEINLINE bool skip(size_t sz) { - if(read_offset + sz > data.size()) { + if (read_offset + sz > data.size()) { read_offset = data.size(); return false; } @@ -125,21 +154,22 @@ class BinaryNode return true; } bool getRAW(uint8_t* ptr, size_t sz); - bool getRAW(std::string& str, size_t sz); - bool getString(std::string& str); - bool getLongString(std::string& str); + bool getRAW(std::string &str, size_t sz); + bool getString(std::string &str); + bool getLongString(std::string &str); BinaryNode* getChild(); // Returns this on success, nullptr on failure BinaryNode* advance(); + protected: - template - bool getType(T& ref) { - if(read_offset + sizeof(ref) > data.size()) { + template + bool getType(T &ref) { + if (read_offset + sizeof(ref) > data.size()) { read_offset = data.size(); return false; } - ref = *(T*)(data.data()+read_offset); + ref = *(T*)(data.data() + read_offset); read_offset += sizeof(ref); return true; @@ -156,8 +186,7 @@ class BinaryNode friend class MemoryNodeFileReadHandle; }; -class NodeFileReadHandle : public FileHandle -{ +class NodeFileReadHandle : public FileHandle { public: NodeFileReadHandle(); virtual ~NodeFileReadHandle(); @@ -166,6 +195,7 @@ class NodeFileReadHandle : public FileHandle virtual size_t size() = 0; virtual size_t tell() = 0; + protected: BinaryNode* getNode(BinaryNode* parent); void freeNode(BinaryNode* node); @@ -185,25 +215,31 @@ class NodeFileReadHandle : public FileHandle friend class BinaryNode; }; -class DiskNodeFileReadHandle : public NodeFileReadHandle -{ +class DiskNodeFileReadHandle : public NodeFileReadHandle { public: - DiskNodeFileReadHandle(const std::string& name, const std::vector& acceptable_identifiers); + DiskNodeFileReadHandle(const std::string &name, const std::vector &acceptable_identifiers); virtual ~DiskNodeFileReadHandle(); virtual void close(); virtual BinaryNode* getRootNode(); - virtual size_t size() {return file_size;} - virtual size_t tell() {if(file) return ftell(file); return 0;} + virtual size_t size() { + return file_size; + } + virtual size_t tell() { + if (file) { + return ftell(file); + } + return 0; + } + protected: virtual bool renewCache(); size_t file_size; }; -class MemoryNodeFileReadHandle : public NodeFileReadHandle -{ +class MemoryNodeFileReadHandle : public NodeFileReadHandle { public: // Does NOT claim ownership of the memory it is given. MemoryNodeFileReadHandle(const uint8_t* data, size_t size); @@ -214,44 +250,61 @@ class MemoryNodeFileReadHandle : public NodeFileReadHandle virtual void close(); virtual BinaryNode* getRootNode(); - virtual size_t size() {return cache_size;} - virtual size_t tell() {return local_read_index;} - virtual bool isOk() {return true;} + virtual size_t size() { + return cache_size; + } + virtual size_t tell() { + return local_read_index; + } + virtual bool isOk() { + return true; + } + protected: virtual bool renewCache(); uint8_t* index; }; -class FileWriteHandle : public FileHandle -{ +class FileWriteHandle : public FileHandle { public: - explicit FileWriteHandle(const std::string& name); + explicit FileWriteHandle(const std::string &name); virtual ~FileWriteHandle(); - FORCEINLINE bool addU8(uint8_t u8) {return addType(u8);} - FORCEINLINE bool addByte(uint8_t u8) {return addType(u8);} - FORCEINLINE bool addU16(uint16_t u16) {return addType(u16);} - FORCEINLINE bool addU32(uint32_t u32) {return addType(u32);} - FORCEINLINE bool addU64(uint64_t u64) {return addType(u64);} - bool addString(const std::string& str); + FORCEINLINE bool addU8(uint8_t u8) { + return addType(u8); + } + FORCEINLINE bool addByte(uint8_t u8) { + return addType(u8); + } + FORCEINLINE bool addU16(uint16_t u16) { + return addType(u16); + } + FORCEINLINE bool addU32(uint32_t u32) { + return addType(u32); + } + FORCEINLINE bool addU64(uint64_t u64) { + return addType(u64); + } + bool addString(const std::string &str); bool addString(const char* str); - bool addLongString(const std::string& str); - bool addRAW(const std::string& str); + bool addLongString(const std::string &str); + bool addRAW(const std::string &str); bool addRAW(const uint8_t* ptr, size_t sz); - bool addRAW(const char* c) { return addRAW(reinterpret_cast(c), strlen(c)); } + bool addRAW(const char* c) { + return addRAW(reinterpret_cast(c), strlen(c)); + } void flush(); protected: - template + template bool addType(T ref) { fwrite(&ref, sizeof(ref), 1, file); return ferror(file) == 0; } }; -class NodeFileWriteHandle : public FileHandle -{ +class NodeFileWriteHandle : public FileHandle { public: NodeFileWriteHandle(); virtual ~NodeFileWriteHandle(); @@ -264,11 +317,13 @@ class NodeFileWriteHandle : public FileHandle bool addU16(uint16_t u16); bool addU32(uint32_t u32); bool addU64(uint64_t u64); - bool addString(const std::string& str); - bool addLongString(const std::string& str); - bool addRAW(std::string& str); + bool addString(const std::string &str); + bool addLongString(const std::string &str); + bool addRAW(std::string &str); bool addRAW(const uint8_t* ptr, size_t sz); - bool addRAW(const char* c) {return addRAW(reinterpret_cast(c), strlen(c));} + bool addRAW(const char* c) { + return addRAW(reinterpret_cast(c), strlen(c)); + } protected: virtual void renewCache() = 0; @@ -282,29 +337,28 @@ class NodeFileWriteHandle : public FileHandle size_t local_write_index; FORCEINLINE void writeBytes(const uint8_t* ptr, size_t sz) { - if(sz) { + if (sz) { do { - if(*ptr == NODE_START || *ptr == NODE_END || *ptr == ESCAPE_CHAR) { + if (*ptr == NODE_START || *ptr == NODE_END || *ptr == ESCAPE_CHAR) { cache[local_write_index++] = ESCAPE_CHAR; - if(local_write_index >= cache_size) { + if (local_write_index >= cache_size) { renewCache(); } } cache[local_write_index++] = *ptr; - if(local_write_index >= cache_size) { + if (local_write_index >= cache_size) { renewCache(); } ++ptr; --sz; - } while(sz != 0); + } while (sz != 0); } } }; -class DiskNodeFileWriteHandle : public NodeFileWriteHandle -{ +class DiskNodeFileWriteHandle : public NodeFileWriteHandle { public: - DiskNodeFileWriteHandle(const std::string& name, const std::string& identifier); + DiskNodeFileWriteHandle(const std::string &name, const std::string &identifier); virtual ~DiskNodeFileWriteHandle(); virtual void close(); @@ -313,8 +367,7 @@ class DiskNodeFileWriteHandle : public NodeFileWriteHandle virtual void renewCache(); }; -class MemoryNodeFileWriteHandle : public NodeFileWriteHandle -{ +class MemoryNodeFileWriteHandle : public NodeFileWriteHandle { public: MemoryNodeFileWriteHandle(); virtual ~MemoryNodeFileWriteHandle(); diff --git a/source/find_item_window.cpp b/source/find_item_window.cpp index ad356f60..9faa3b9b 100644 --- a/source/find_item_window.cpp +++ b/source/find_item_window.cpp @@ -24,18 +24,17 @@ #include "raw_brush.h" BEGIN_EVENT_TABLE(FindItemDialog, wxDialog) - EVT_TIMER(wxID_ANY, FindItemDialog::OnInputTimer) - EVT_BUTTON(wxID_OK, FindItemDialog::OnClickOK) - EVT_BUTTON(wxID_CANCEL, FindItemDialog::OnClickCancel) +EVT_TIMER(wxID_ANY, FindItemDialog::OnInputTimer) +EVT_BUTTON(wxID_OK, FindItemDialog::OnClickOK) +EVT_BUTTON(wxID_CANCEL, FindItemDialog::OnClickCancel) END_EVENT_TABLE() -FindItemDialog::FindItemDialog(wxWindow* parent, const wxString& title, bool onlyPickupables/* = false*/) : +FindItemDialog::FindItemDialog(wxWindow* parent, const wxString &title, bool onlyPickupables /* = false*/) : wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxSize(800, 600), wxDEFAULT_DIALOG_STYLE), input_timer(this), result_brush(nullptr), result_id(0), - only_pickupables(onlyPickupables) -{ + only_pickupables(onlyPickupables) { this->SetSizeHints(wxDefaultSize, wxDefaultSize); wxBoxSizer* box_sizer = newd wxBoxSizer(wxHORIZONTAL); @@ -199,8 +198,7 @@ FindItemDialog::FindItemDialog(wxWindow* parent, const wxString& title, bool onl floor_change->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(FindItemDialog::OnPropertyChange), NULL, this); } -FindItemDialog::~FindItemDialog() -{ +FindItemDialog::~FindItemDialog() { // Disconnect Events options_radio_box->Disconnect(wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(FindItemDialog::OnOptionChange), NULL, this); server_id_spin->Disconnect(wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler(FindItemDialog::OnServerIdChange), NULL, this); @@ -228,15 +226,14 @@ FindItemDialog::~FindItemDialog() floor_change->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(FindItemDialog::OnPropertyChange), NULL, this); } -FindItemDialog::SearchMode FindItemDialog::getSearchMode() const -{ +FindItemDialog::SearchMode FindItemDialog::getSearchMode() const { return (SearchMode)options_radio_box->GetSelection(); } -void FindItemDialog::setSearchMode(FindItemDialog::SearchMode mode) -{ - if((SearchMode)options_radio_box->GetSelection() != mode) +void FindItemDialog::setSearchMode(FindItemDialog::SearchMode mode) { + if ((SearchMode)options_radio_box->GetSelection() != mode) { options_radio_box->SetSelection(mode); + } server_id_spin->Enable(mode == SearchMode::ServerIDs); client_id_spin->Enable(mode == SearchMode::ClientIDs); @@ -245,19 +242,18 @@ void FindItemDialog::setSearchMode(FindItemDialog::SearchMode mode) EnableProperties(mode == SearchMode::Properties); RefreshContentsInternal(); - if(mode == SearchMode::ServerIDs) { + if (mode == SearchMode::ServerIDs) { server_id_spin->SetFocus(); server_id_spin->SetSelection(-1, -1); - } else if(mode == SearchMode::ClientIDs) { + } else if (mode == SearchMode::ClientIDs) { client_id_spin->SetFocus(); client_id_spin->SetSelection(-1, -1); - } else if(mode == SearchMode::Names) { + } else if (mode == SearchMode::Names) { name_text_input->SetFocus(); } } -void FindItemDialog::EnableProperties(bool enable) -{ +void FindItemDialog::EnableProperties(bool enable) { unpassable->Enable(enable); unmovable->Enable(enable); block_missiles->Enable(enable); @@ -275,145 +271,119 @@ void FindItemDialog::EnableProperties(bool enable) floor_change->Enable(enable); } -void FindItemDialog::RefreshContentsInternal() -{ +void FindItemDialog::RefreshContentsInternal() { items_list->Clear(); ok_button->Enable(false); SearchMode selection = (SearchMode)options_radio_box->GetSelection(); bool found_search_results = false; - if(selection == SearchMode::ServerIDs) { + if (selection == SearchMode::ServerIDs) { uint16_t serverID = (uint16_t)server_id_spin->GetValue(); - for(int id = g_items.getMinID(); id <= g_items.getMaxID(); ++id) { - const ItemType& item = g_items.getItemType(id); - if(item.id != serverID) + for (int id = g_items.getMinID(); id <= g_items.getMaxID(); ++id) { + const ItemType &item = g_items.getItemType(id); + if (item.id != serverID) { continue; + } RAWBrush* raw_brush = item.raw_brush; - if (!raw_brush) + if (!raw_brush) { continue; + } - if(only_pickupables && !item.pickupable) + if (only_pickupables && !item.pickupable) { continue; + } found_search_results = true; items_list->AddBrush(raw_brush); } - } - else if(selection == SearchMode::ClientIDs) { + } else if (selection == SearchMode::ClientIDs) { uint16_t clientID = static_cast(client_id_spin->GetValue()); - for(int id = g_items.getMinID(); id <= g_items.getMaxID(); ++id) { - const ItemType& item = g_items.getItemType(id); - if(item.id == 0 || item.clientID != clientID) + for (int id = g_items.getMinID(); id <= g_items.getMaxID(); ++id) { + const ItemType &item = g_items.getItemType(id); + if (item.id == 0 || item.clientID != clientID) { continue; + } RAWBrush* raw_brush = item.raw_brush; - if (!raw_brush) + if (!raw_brush) { continue; + } - if(only_pickupables && !item.pickupable) + if (only_pickupables && !item.pickupable) { continue; + } found_search_results = true; items_list->AddBrush(raw_brush); } - } - else if(selection == SearchMode::Names) { + } else if (selection == SearchMode::Names) { std::string search_string = as_lower_str(nstr(name_text_input->GetValue())); - if(search_string.size() >= 2) { - for(int id = g_items.getMinID(); id <= g_items.getMaxID(); ++id) { - const ItemType& item = g_items.getItemType(id); - if(item.id == 0) + if (search_string.size() >= 2) { + for (int id = g_items.getMinID(); id <= g_items.getMaxID(); ++id) { + const ItemType &item = g_items.getItemType(id); + if (item.id == 0) { continue; + } RAWBrush* raw_brush = item.raw_brush; - if(!raw_brush) + if (!raw_brush) { continue; + } - if(only_pickupables && !item.pickupable) + if (only_pickupables && !item.pickupable) { continue; + } - if(as_lower_str(raw_brush->getName()).find(search_string) == std::string::npos) + if (as_lower_str(raw_brush->getName()).find(search_string) == std::string::npos) { continue; + } found_search_results = true; items_list->AddBrush(raw_brush); } } - } - else if(selection == SearchMode::Types) { - for(int id = g_items.getMinID(); id <= g_items.getMaxID(); ++id) { - const ItemType& item = g_items.getItemType(id); - if(item.id == 0) + } else if (selection == SearchMode::Types) { + for (int id = g_items.getMinID(); id <= g_items.getMaxID(); ++id) { + const ItemType &item = g_items.getItemType(id); + if (item.id == 0) { continue; + } RAWBrush* raw_brush = item.raw_brush; - if(!raw_brush) + if (!raw_brush) { continue; + } - if(only_pickupables && !item.pickupable) + if (only_pickupables && !item.pickupable) { continue; + } SearchItemType selection = (SearchItemType)types_radio_box->GetSelection(); - if ((selection == SearchItemType::Depot && !item.isDepot()) || - (selection == SearchItemType::Mailbox && !item.isMailbox()) || - (selection == SearchItemType::TrashHolder && !item.isTrashHolder()) || - (selection == SearchItemType::Container && !item.isContainer()) || - (selection == SearchItemType::Door && !item.isDoor()) || - (selection == SearchItemType::MagicField && !item.isMagicField()) || - (selection == SearchItemType::Teleport && !item.isTeleport()) || - (selection == SearchItemType::Bed && !item.isBed()) || - (selection == SearchItemType::Key && !item.isKey())) { + if ((selection == SearchItemType::Depot && !item.isDepot()) || (selection == SearchItemType::Mailbox && !item.isMailbox()) || (selection == SearchItemType::TrashHolder && !item.isTrashHolder()) || (selection == SearchItemType::Container && !item.isContainer()) || (selection == SearchItemType::Door && !item.isDoor()) || (selection == SearchItemType::MagicField && !item.isMagicField()) || (selection == SearchItemType::Teleport && !item.isTeleport()) || (selection == SearchItemType::Bed && !item.isBed()) || (selection == SearchItemType::Key && !item.isKey())) { continue; } found_search_results = true; items_list->AddBrush(raw_brush); } - } - else if(selection == SearchMode::Properties) { - bool has_selected = (unpassable->GetValue() || - unmovable->GetValue() || - block_missiles->GetValue() || - block_pathfinder->GetValue() || - readable->GetValue() || - writeable->GetValue() || - pickupable->GetValue() || - stackable->GetValue() || - rotatable->GetValue() || - hangable->GetValue() || - hook_east->GetValue() || - hook_south->GetValue() || - has_elevation->GetValue() || - ignore_look->GetValue() || - floor_change->GetValue()); - - if(has_selected) { - for(int id = g_items.getMinID(); id <= g_items.getMaxID(); ++id) { - const ItemType& item = g_items.getItemType(id); - if(item.id == 0) + } else if (selection == SearchMode::Properties) { + bool has_selected = (unpassable->GetValue() || unmovable->GetValue() || block_missiles->GetValue() || block_pathfinder->GetValue() || readable->GetValue() || writeable->GetValue() || pickupable->GetValue() || stackable->GetValue() || rotatable->GetValue() || hangable->GetValue() || hook_east->GetValue() || hook_south->GetValue() || has_elevation->GetValue() || ignore_look->GetValue() || floor_change->GetValue()); + + if (has_selected) { + for (int id = g_items.getMinID(); id <= g_items.getMaxID(); ++id) { + const ItemType &item = g_items.getItemType(id); + if (item.id == 0) { continue; + } RAWBrush* raw_brush = item.raw_brush; - if(!raw_brush) + if (!raw_brush) { continue; + } - if((unpassable->GetValue() && !item.unpassable) || - (unmovable->GetValue() && item.moveable) || - (block_missiles->GetValue() && !item.blockMissiles) || - (block_pathfinder->GetValue() && !item.blockPathfinder) || - (readable->GetValue() && !item.canReadText) || - (writeable->GetValue() && !item.canWriteText) || - (pickupable->GetValue() && !item.pickupable) || - (stackable->GetValue() && !item.stackable) || - (rotatable->GetValue() && !item.rotable) || - (hangable->GetValue() && !item.isHangable) || - (hook_east->GetValue() && !item.hookEast) || - (hook_south->GetValue() && !item.hookSouth) || - (has_elevation->GetValue() && !item.hasElevation) || - (ignore_look->GetValue() && !item.ignoreLook) || - (floor_change->GetValue() && !item.isFloorChange())) { + if ((unpassable->GetValue() && !item.unpassable) || (unmovable->GetValue() && item.moveable) || (block_missiles->GetValue() && !item.blockMissiles) || (block_pathfinder->GetValue() && !item.blockPathfinder) || (readable->GetValue() && !item.canReadText) || (writeable->GetValue() && !item.canWriteText) || (pickupable->GetValue() && !item.pickupable) || (stackable->GetValue() && !item.stackable) || (rotatable->GetValue() && !item.rotable) || (hangable->GetValue() && !item.isHangable) || (hook_east->GetValue() && !item.hookEast) || (hook_south->GetValue() && !item.hookSouth) || (has_elevation->GetValue() && !item.hasElevation) || (ignore_look->GetValue() && !item.ignoreLook) || (floor_change->GetValue() && !item.isFloorChange())) { continue; } @@ -423,55 +393,48 @@ void FindItemDialog::RefreshContentsInternal() } } - if(found_search_results) { + if (found_search_results) { items_list->SetSelection(0); ok_button->Enable(true); - } else + } else { items_list->SetNoMatches(); + } items_list->Refresh(); } -void FindItemDialog::OnOptionChange(wxCommandEvent& WXUNUSED(event)) -{ +void FindItemDialog::OnOptionChange(wxCommandEvent &WXUNUSED(event)) { setSearchMode((SearchMode)options_radio_box->GetSelection()); } -void FindItemDialog::OnServerIdChange(wxCommandEvent& WXUNUSED(event)) -{ +void FindItemDialog::OnServerIdChange(wxCommandEvent &WXUNUSED(event)) { RefreshContentsInternal(); } -void FindItemDialog::OnClientIdChange(wxCommandEvent& WXUNUSED(event)) -{ +void FindItemDialog::OnClientIdChange(wxCommandEvent &WXUNUSED(event)) { RefreshContentsInternal(); } -void FindItemDialog::OnText(wxCommandEvent& WXUNUSED(event)) -{ +void FindItemDialog::OnText(wxCommandEvent &WXUNUSED(event)) { input_timer.Start(800, true); } -void FindItemDialog::OnTypeChange(wxCommandEvent& WXUNUSED(event)) -{ +void FindItemDialog::OnTypeChange(wxCommandEvent &WXUNUSED(event)) { RefreshContentsInternal(); } -void FindItemDialog::OnPropertyChange(wxCommandEvent& WXUNUSED(event)) -{ +void FindItemDialog::OnPropertyChange(wxCommandEvent &WXUNUSED(event)) { RefreshContentsInternal(); } -void FindItemDialog::OnInputTimer(wxTimerEvent& WXUNUSED(event)) -{ +void FindItemDialog::OnInputTimer(wxTimerEvent &WXUNUSED(event)) { RefreshContentsInternal(); } -void FindItemDialog::OnClickOK(wxCommandEvent& WXUNUSED(event)) -{ - if(items_list->GetItemCount() != 0) { +void FindItemDialog::OnClickOK(wxCommandEvent &WXUNUSED(event)) { + if (items_list->GetItemCount() != 0) { Brush* brush = items_list->GetSelectedBrush(); - if(brush) { + if (brush) { result_brush = brush; result_id = brush->asRaw()->getItemID(); EndModal(wxID_OK); @@ -479,7 +442,6 @@ void FindItemDialog::OnClickOK(wxCommandEvent& WXUNUSED(event)) } } -void FindItemDialog::OnClickCancel(wxCommandEvent& WXUNUSED(event)) -{ +void FindItemDialog::OnClickCancel(wxCommandEvent &WXUNUSED(event)) { EndModal(wxID_CANCEL); } diff --git a/source/find_item_window.h b/source/find_item_window.h index 982a46c4..ca378ece 100644 --- a/source/find_item_window.h +++ b/source/find_item_window.h @@ -29,8 +29,7 @@ class FindDialogListBox; -class FindItemDialog : public wxDialog -{ +class FindItemDialog : public wxDialog { public: enum SearchMode { ServerIDs = 0, @@ -52,11 +51,15 @@ class FindItemDialog : public wxDialog Key }; - FindItemDialog(wxWindow* parent, const wxString& title, bool onlyPickupables = false); + FindItemDialog(wxWindow* parent, const wxString &title, bool onlyPickupables = false); ~FindItemDialog(); - Brush* getResult() const { return result_brush; } - uint16_t getResultID() const { return result_id; } + Brush* getResult() const { + return result_brush; + } + uint16_t getResultID() const { + return result_id; + } SearchMode getSearchMode() const; void setSearchMode(SearchMode mode); @@ -65,15 +68,15 @@ class FindItemDialog : public wxDialog void EnableProperties(bool enable); void RefreshContentsInternal(); - void OnOptionChange(wxCommandEvent& event); - void OnServerIdChange(wxCommandEvent& event); - void OnClientIdChange(wxCommandEvent& event); - void OnText(wxCommandEvent& event); - void OnTypeChange(wxCommandEvent& event); - void OnPropertyChange(wxCommandEvent& event); - void OnInputTimer(wxTimerEvent& event); - void OnClickOK(wxCommandEvent& event); - void OnClickCancel(wxCommandEvent& event); + void OnOptionChange(wxCommandEvent &event); + void OnServerIdChange(wxCommandEvent &event); + void OnClientIdChange(wxCommandEvent &event); + void OnText(wxCommandEvent &event); + void OnTypeChange(wxCommandEvent &event); + void OnPropertyChange(wxCommandEvent &event); + void OnInputTimer(wxTimerEvent &event); + void OnClickOK(wxCommandEvent &event); + void OnClickCancel(wxCommandEvent &event); wxRadioBox* options_radio_box; diff --git a/source/graphics.cpp b/source/graphics.cpp index 3c728f7d..4b721840 100644 --- a/source/graphics.cpp +++ b/source/graphics.cpp @@ -29,28 +29,138 @@ // All 133 template colors static uint32_t TemplateOutfitLookupTable[] = { - 0xFFFFFF, 0xFFD4BF, 0xFFE9BF, 0xFFFFBF, 0xE9FFBF, 0xD4FFBF, - 0xBFFFBF, 0xBFFFD4, 0xBFFFE9, 0xBFFFFF, 0xBFE9FF, 0xBFD4FF, - 0xBFBFFF, 0xD4BFFF, 0xE9BFFF, 0xFFBFFF, 0xFFBFE9, 0xFFBFD4, - 0xFFBFBF, 0xDADADA, 0xBF9F8F, 0xBFAF8F, 0xBFBF8F, 0xAFBF8F, - 0x9FBF8F, 0x8FBF8F, 0x8FBF9F, 0x8FBFAF, 0x8FBFBF, 0x8FAFBF, - 0x8F9FBF, 0x8F8FBF, 0x9F8FBF, 0xAF8FBF, 0xBF8FBF, 0xBF8FAF, - 0xBF8F9F, 0xBF8F8F, 0xB6B6B6, 0xBF7F5F, 0xBFAF8F, 0xBFBF5F, - 0x9FBF5F, 0x7FBF5F, 0x5FBF5F, 0x5FBF7F, 0x5FBF9F, 0x5FBFBF, - 0x5F9FBF, 0x5F7FBF, 0x5F5FBF, 0x7F5FBF, 0x9F5FBF, 0xBF5FBF, - 0xBF5F9F, 0xBF5F7F, 0xBF5F5F, 0x919191, 0xBF6A3F, 0xBF943F, - 0xBFBF3F, 0x94BF3F, 0x6ABF3F, 0x3FBF3F, 0x3FBF6A, 0x3FBF94, - 0x3FBFBF, 0x3F94BF, 0x3F6ABF, 0x3F3FBF, 0x6A3FBF, 0x943FBF, - 0xBF3FBF, 0xBF3F94, 0xBF3F6A, 0xBF3F3F, 0x6D6D6D, 0xFF5500, - 0xFFAA00, 0xFFFF00, 0xAAFF00, 0x54FF00, 0x00FF00, 0x00FF54, - 0x00FFAA, 0x00FFFF, 0x00A9FF, 0x0055FF, 0x0000FF, 0x5500FF, - 0xA900FF, 0xFE00FF, 0xFF00AA, 0xFF0055, 0xFF0000, 0x484848, - 0xBF3F00, 0xBF7F00, 0xBFBF00, 0x7FBF00, 0x3FBF00, 0x00BF00, - 0x00BF3F, 0x00BF7F, 0x00BFBF, 0x007FBF, 0x003FBF, 0x0000BF, - 0x3F00BF, 0x7F00BF, 0xBF00BF, 0xBF007F, 0xBF003F, 0xBF0000, - 0x242424, 0x7F2A00, 0x7F5500, 0x7F7F00, 0x557F00, 0x2A7F00, - 0x007F00, 0x007F2A, 0x007F55, 0x007F7F, 0x00547F, 0x002A7F, - 0x00007F, 0x2A007F, 0x54007F, 0x7F007F, 0x7F0055, 0x7F002A, + 0xFFFFFF, + 0xFFD4BF, + 0xFFE9BF, + 0xFFFFBF, + 0xE9FFBF, + 0xD4FFBF, + 0xBFFFBF, + 0xBFFFD4, + 0xBFFFE9, + 0xBFFFFF, + 0xBFE9FF, + 0xBFD4FF, + 0xBFBFFF, + 0xD4BFFF, + 0xE9BFFF, + 0xFFBFFF, + 0xFFBFE9, + 0xFFBFD4, + 0xFFBFBF, + 0xDADADA, + 0xBF9F8F, + 0xBFAF8F, + 0xBFBF8F, + 0xAFBF8F, + 0x9FBF8F, + 0x8FBF8F, + 0x8FBF9F, + 0x8FBFAF, + 0x8FBFBF, + 0x8FAFBF, + 0x8F9FBF, + 0x8F8FBF, + 0x9F8FBF, + 0xAF8FBF, + 0xBF8FBF, + 0xBF8FAF, + 0xBF8F9F, + 0xBF8F8F, + 0xB6B6B6, + 0xBF7F5F, + 0xBFAF8F, + 0xBFBF5F, + 0x9FBF5F, + 0x7FBF5F, + 0x5FBF5F, + 0x5FBF7F, + 0x5FBF9F, + 0x5FBFBF, + 0x5F9FBF, + 0x5F7FBF, + 0x5F5FBF, + 0x7F5FBF, + 0x9F5FBF, + 0xBF5FBF, + 0xBF5F9F, + 0xBF5F7F, + 0xBF5F5F, + 0x919191, + 0xBF6A3F, + 0xBF943F, + 0xBFBF3F, + 0x94BF3F, + 0x6ABF3F, + 0x3FBF3F, + 0x3FBF6A, + 0x3FBF94, + 0x3FBFBF, + 0x3F94BF, + 0x3F6ABF, + 0x3F3FBF, + 0x6A3FBF, + 0x943FBF, + 0xBF3FBF, + 0xBF3F94, + 0xBF3F6A, + 0xBF3F3F, + 0x6D6D6D, + 0xFF5500, + 0xFFAA00, + 0xFFFF00, + 0xAAFF00, + 0x54FF00, + 0x00FF00, + 0x00FF54, + 0x00FFAA, + 0x00FFFF, + 0x00A9FF, + 0x0055FF, + 0x0000FF, + 0x5500FF, + 0xA900FF, + 0xFE00FF, + 0xFF00AA, + 0xFF0055, + 0xFF0000, + 0x484848, + 0xBF3F00, + 0xBF7F00, + 0xBFBF00, + 0x7FBF00, + 0x3FBF00, + 0x00BF00, + 0x00BF3F, + 0x00BF7F, + 0x00BFBF, + 0x007FBF, + 0x003FBF, + 0x0000BF, + 0x3F00BF, + 0x7F00BF, + 0xBF00BF, + 0xBF007F, + 0xBF003F, + 0xBF0000, + 0x242424, + 0x7F2A00, + 0x7F5500, + 0x7F7F00, + 0x557F00, + 0x2A7F00, + 0x007F00, + 0x007F2A, + 0x007F55, + 0x007F7F, + 0x00547F, + 0x002A7F, + 0x00007F, + 0x2A007F, + 0x54007F, + 0x7F007F, + 0x7F0055, + 0x7F002A, 0x7F0000, }; @@ -64,19 +174,17 @@ GraphicManager::GraphicManager() : has_frame_durations(false), has_frame_groups(false), loaded_textures(0), - lastclean(0) -{ + lastclean(0) { animation_timer = newd wxStopWatch(); animation_timer->Start(); } -GraphicManager::~GraphicManager() -{ - for(SpriteMap::iterator iter = sprite_space.begin(); iter != sprite_space.end(); ++iter) { +GraphicManager::~GraphicManager() { + for (SpriteMap::iterator iter = sprite_space.begin(); iter != sprite_space.end(); ++iter) { delete iter->second; } - for(ImageMap::iterator iter = image_space.begin(); iter != image_space.end(); ++iter) { + for (ImageMap::iterator iter = image_space.begin(); iter != image_space.end(); ++iter) { delete iter->second; } @@ -86,34 +194,30 @@ GraphicManager::~GraphicManager() delete animation_timer; } -bool GraphicManager::hasTransparency() const -{ +bool GraphicManager::hasTransparency() const { return has_transparency; } -bool GraphicManager::isUnloaded() const -{ +bool GraphicManager::isUnloaded() const { return unloaded; } -GLuint GraphicManager::getFreeTextureID() -{ +GLuint GraphicManager::getFreeTextureID() { static GLuint id_counter = 0x10000000; return id_counter++; // This should (hopefully) never run out } -void GraphicManager::clear() -{ +void GraphicManager::clear() { SpriteMap new_sprite_space; - for(SpriteMap::iterator iter = sprite_space.begin(); iter != sprite_space.end(); ++iter) { - if(iter->first >= 0) { // Don't clean internal sprites + for (SpriteMap::iterator iter = sprite_space.begin(); iter != sprite_space.end(); ++iter) { + if (iter->first >= 0) { // Don't clean internal sprites delete iter->second; } else { new_sprite_space.insert(std::make_pair(iter->first, iter->second)); } } - for(ImageMap::iterator iter = image_space.begin(); iter != image_space.end(); ++iter) { + for (ImageMap::iterator iter = image_space.begin(); iter != image_space.end(); ++iter) { delete iter->second; } @@ -130,210 +234,177 @@ void GraphicManager::clear() unloaded = true; } -void GraphicManager::cleanSoftwareSprites() -{ - for(SpriteMap::iterator iter = sprite_space.begin(); iter != sprite_space.end(); ++iter) { - if(iter->first >= 0) { // Don't clean internal sprites +void GraphicManager::cleanSoftwareSprites() { + for (SpriteMap::iterator iter = sprite_space.begin(); iter != sprite_space.end(); ++iter) { + if (iter->first >= 0) { // Don't clean internal sprites iter->second->unloadDC(); } } } -Sprite* GraphicManager::getSprite(int id) -{ +Sprite* GraphicManager::getSprite(int id) { SpriteMap::iterator it = sprite_space.find(id); - if(it != sprite_space.end()) { + if (it != sprite_space.end()) { return it->second; } return nullptr; } -GameSprite* GraphicManager::getCreatureSprite(int id) -{ - if(id < 0) { +GameSprite* GraphicManager::getCreatureSprite(int id) { + if (id < 0) { return nullptr; } - SpriteMap::iterator it = sprite_space.find(id+item_count); - if(it != sprite_space.end()) { + SpriteMap::iterator it = sprite_space.find(id + item_count); + if (it != sprite_space.end()) { return static_cast(it->second); } return nullptr; } -GameSprite* GraphicManager::getEditorSprite(int id) -{ - if(id >= 0) { +GameSprite* GraphicManager::getEditorSprite(int id) { + if (id >= 0) { return nullptr; } SpriteMap::iterator it = sprite_space.find(id); - if(it != sprite_space.end()) { + if (it != sprite_space.end()) { return dynamic_cast(it->second); } return nullptr; } #define loadPNGFile(name) _wxGetBitmapFromMemory(name, sizeof(name)) -inline wxBitmap* _wxGetBitmapFromMemory(const unsigned char* data, int length) -{ +inline wxBitmap* _wxGetBitmapFromMemory(const unsigned char* data, int length) { wxMemoryInputStream is(data, length); wxImage img(is, "image/png"); - if(!img.IsOk()) return nullptr; + if (!img.IsOk()) { + return nullptr; + } return newd wxBitmap(img, -1); } -bool GraphicManager::loadEditorSprites() -{ +bool GraphicManager::loadEditorSprites() { // Unused graphics MIGHT be loaded here, but it's a neglectable loss - sprite_space[EDITOR_SPRITE_SELECTION_MARKER] = - newd EditorSprite( - newd wxBitmap(selection_marker_xpm16x16), - newd wxBitmap(selection_marker_xpm32x32) - ); - sprite_space[EDITOR_SPRITE_BRUSH_CD_1x1] = - newd EditorSprite( - loadPNGFile(circular_1_small_png), - loadPNGFile(circular_1_png) - ); - sprite_space[EDITOR_SPRITE_BRUSH_CD_3x3] = - newd EditorSprite( - loadPNGFile(circular_2_small_png), - loadPNGFile(circular_2_png) - ); - sprite_space[EDITOR_SPRITE_BRUSH_CD_5x5] = - newd EditorSprite( - loadPNGFile(circular_3_small_png), - loadPNGFile(circular_3_png) - ); - sprite_space[EDITOR_SPRITE_BRUSH_CD_7x7] = - newd EditorSprite( - loadPNGFile(circular_4_small_png), - loadPNGFile(circular_4_png) - ); - sprite_space[EDITOR_SPRITE_BRUSH_CD_9x9] = - newd EditorSprite( - loadPNGFile(circular_5_small_png), - loadPNGFile(circular_5_png) - ); - sprite_space[EDITOR_SPRITE_BRUSH_CD_15x15] = - newd EditorSprite( - loadPNGFile(circular_6_small_png), - loadPNGFile(circular_6_png) - ); - sprite_space[EDITOR_SPRITE_BRUSH_CD_19x19] = - newd EditorSprite( - loadPNGFile(circular_7_small_png), - loadPNGFile(circular_7_png) - ); - sprite_space[EDITOR_SPRITE_BRUSH_SD_1x1] = - newd EditorSprite( - loadPNGFile(rectangular_1_small_png), - loadPNGFile(rectangular_1_png) - ); - sprite_space[EDITOR_SPRITE_BRUSH_SD_3x3] = - newd EditorSprite( - loadPNGFile(rectangular_2_small_png), - loadPNGFile(rectangular_2_png) - ); - sprite_space[EDITOR_SPRITE_BRUSH_SD_5x5] = - newd EditorSprite( - loadPNGFile(rectangular_3_small_png), - loadPNGFile(rectangular_3_png) - ); - sprite_space[EDITOR_SPRITE_BRUSH_SD_7x7] = - newd EditorSprite( - loadPNGFile(rectangular_4_small_png), - loadPNGFile(rectangular_4_png) - ); - sprite_space[EDITOR_SPRITE_BRUSH_SD_9x9] = - newd EditorSprite( - loadPNGFile(rectangular_5_small_png), - loadPNGFile(rectangular_5_png) - ); - sprite_space[EDITOR_SPRITE_BRUSH_SD_15x15] = - newd EditorSprite( - loadPNGFile(rectangular_6_small_png), - loadPNGFile(rectangular_6_png) - ); - sprite_space[EDITOR_SPRITE_BRUSH_SD_19x19] = - newd EditorSprite( - loadPNGFile(rectangular_7_small_png), - loadPNGFile(rectangular_7_png) - ); - - sprite_space[EDITOR_SPRITE_OPTIONAL_BORDER_TOOL] = - newd EditorSprite( - loadPNGFile(optional_border_small_png), - loadPNGFile(optional_border_png) - ); - sprite_space[EDITOR_SPRITE_ERASER] = - newd EditorSprite( - loadPNGFile(eraser_small_png), - loadPNGFile(eraser_png) - ); - sprite_space[EDITOR_SPRITE_PZ_TOOL] = - newd EditorSprite( - loadPNGFile(protection_zone_small_png), - loadPNGFile(protection_zone_png) - ); - sprite_space[EDITOR_SPRITE_PVPZ_TOOL] = - newd EditorSprite( - loadPNGFile(pvp_zone_small_png), - loadPNGFile(pvp_zone_png) - ); - sprite_space[EDITOR_SPRITE_NOLOG_TOOL] = - newd EditorSprite( - loadPNGFile(no_logout_small_png), - loadPNGFile(no_logout_png) - ); - sprite_space[EDITOR_SPRITE_NOPVP_TOOL] = - newd EditorSprite( - loadPNGFile(no_pvp_small_png), - loadPNGFile(no_pvp_png) - ); - - sprite_space[EDITOR_SPRITE_DOOR_NORMAL] = - newd EditorSprite( - loadPNGFile(door_normal_small_png), - loadPNGFile(door_normal_png) - ); - sprite_space[EDITOR_SPRITE_DOOR_LOCKED] = - newd EditorSprite( - loadPNGFile(door_locked_small_png), - loadPNGFile(door_locked_png) - ); - sprite_space[EDITOR_SPRITE_DOOR_MAGIC] = - newd EditorSprite( - loadPNGFile(door_magic_small_png), - loadPNGFile(door_magic_png) - ); - sprite_space[EDITOR_SPRITE_DOOR_QUEST] = - newd EditorSprite( - loadPNGFile(door_quest_small_png), - loadPNGFile(door_quest_png) - ); - sprite_space[EDITOR_SPRITE_WINDOW_NORMAL] = - newd EditorSprite( - loadPNGFile(window_normal_small_png), - loadPNGFile(window_normal_png) - ); - sprite_space[EDITOR_SPRITE_WINDOW_HATCH] = - newd EditorSprite( - loadPNGFile(window_hatch_small_png), - loadPNGFile(window_hatch_png) - ); - - sprite_space[EDITOR_SPRITE_SELECTION_GEM] = - newd EditorSprite( - loadPNGFile(gem_edit_png), - nullptr - ); - sprite_space[EDITOR_SPRITE_DRAWING_GEM] = - newd EditorSprite( - loadPNGFile(gem_move_png), - nullptr - ); + sprite_space[EDITOR_SPRITE_SELECTION_MARKER] = newd EditorSprite( + newd wxBitmap(selection_marker_xpm16x16), + newd wxBitmap(selection_marker_xpm32x32) + ); + sprite_space[EDITOR_SPRITE_BRUSH_CD_1x1] = newd EditorSprite( + loadPNGFile(circular_1_small_png), + loadPNGFile(circular_1_png) + ); + sprite_space[EDITOR_SPRITE_BRUSH_CD_3x3] = newd EditorSprite( + loadPNGFile(circular_2_small_png), + loadPNGFile(circular_2_png) + ); + sprite_space[EDITOR_SPRITE_BRUSH_CD_5x5] = newd EditorSprite( + loadPNGFile(circular_3_small_png), + loadPNGFile(circular_3_png) + ); + sprite_space[EDITOR_SPRITE_BRUSH_CD_7x7] = newd EditorSprite( + loadPNGFile(circular_4_small_png), + loadPNGFile(circular_4_png) + ); + sprite_space[EDITOR_SPRITE_BRUSH_CD_9x9] = newd EditorSprite( + loadPNGFile(circular_5_small_png), + loadPNGFile(circular_5_png) + ); + sprite_space[EDITOR_SPRITE_BRUSH_CD_15x15] = newd EditorSprite( + loadPNGFile(circular_6_small_png), + loadPNGFile(circular_6_png) + ); + sprite_space[EDITOR_SPRITE_BRUSH_CD_19x19] = newd EditorSprite( + loadPNGFile(circular_7_small_png), + loadPNGFile(circular_7_png) + ); + sprite_space[EDITOR_SPRITE_BRUSH_SD_1x1] = newd EditorSprite( + loadPNGFile(rectangular_1_small_png), + loadPNGFile(rectangular_1_png) + ); + sprite_space[EDITOR_SPRITE_BRUSH_SD_3x3] = newd EditorSprite( + loadPNGFile(rectangular_2_small_png), + loadPNGFile(rectangular_2_png) + ); + sprite_space[EDITOR_SPRITE_BRUSH_SD_5x5] = newd EditorSprite( + loadPNGFile(rectangular_3_small_png), + loadPNGFile(rectangular_3_png) + ); + sprite_space[EDITOR_SPRITE_BRUSH_SD_7x7] = newd EditorSprite( + loadPNGFile(rectangular_4_small_png), + loadPNGFile(rectangular_4_png) + ); + sprite_space[EDITOR_SPRITE_BRUSH_SD_9x9] = newd EditorSprite( + loadPNGFile(rectangular_5_small_png), + loadPNGFile(rectangular_5_png) + ); + sprite_space[EDITOR_SPRITE_BRUSH_SD_15x15] = newd EditorSprite( + loadPNGFile(rectangular_6_small_png), + loadPNGFile(rectangular_6_png) + ); + sprite_space[EDITOR_SPRITE_BRUSH_SD_19x19] = newd EditorSprite( + loadPNGFile(rectangular_7_small_png), + loadPNGFile(rectangular_7_png) + ); + + sprite_space[EDITOR_SPRITE_OPTIONAL_BORDER_TOOL] = newd EditorSprite( + loadPNGFile(optional_border_small_png), + loadPNGFile(optional_border_png) + ); + sprite_space[EDITOR_SPRITE_ERASER] = newd EditorSprite( + loadPNGFile(eraser_small_png), + loadPNGFile(eraser_png) + ); + sprite_space[EDITOR_SPRITE_PZ_TOOL] = newd EditorSprite( + loadPNGFile(protection_zone_small_png), + loadPNGFile(protection_zone_png) + ); + sprite_space[EDITOR_SPRITE_PVPZ_TOOL] = newd EditorSprite( + loadPNGFile(pvp_zone_small_png), + loadPNGFile(pvp_zone_png) + ); + sprite_space[EDITOR_SPRITE_NOLOG_TOOL] = newd EditorSprite( + loadPNGFile(no_logout_small_png), + loadPNGFile(no_logout_png) + ); + sprite_space[EDITOR_SPRITE_NOPVP_TOOL] = newd EditorSprite( + loadPNGFile(no_pvp_small_png), + loadPNGFile(no_pvp_png) + ); + + sprite_space[EDITOR_SPRITE_DOOR_NORMAL] = newd EditorSprite( + loadPNGFile(door_normal_small_png), + loadPNGFile(door_normal_png) + ); + sprite_space[EDITOR_SPRITE_DOOR_LOCKED] = newd EditorSprite( + loadPNGFile(door_locked_small_png), + loadPNGFile(door_locked_png) + ); + sprite_space[EDITOR_SPRITE_DOOR_MAGIC] = newd EditorSprite( + loadPNGFile(door_magic_small_png), + loadPNGFile(door_magic_png) + ); + sprite_space[EDITOR_SPRITE_DOOR_QUEST] = newd EditorSprite( + loadPNGFile(door_quest_small_png), + loadPNGFile(door_quest_png) + ); + sprite_space[EDITOR_SPRITE_WINDOW_NORMAL] = newd EditorSprite( + loadPNGFile(window_normal_small_png), + loadPNGFile(window_normal_png) + ); + sprite_space[EDITOR_SPRITE_WINDOW_HATCH] = newd EditorSprite( + loadPNGFile(window_hatch_small_png), + loadPNGFile(window_hatch_png) + ); + + sprite_space[EDITOR_SPRITE_SELECTION_GEM] = newd EditorSprite( + loadPNGFile(gem_edit_png), + nullptr + ); + sprite_space[EDITOR_SPRITE_DRAWING_GEM] = newd EditorSprite( + loadPNGFile(gem_move_png), + nullptr + ); sprite_space[EDITOR_SPRITE_SPAWNS] = GameSprite::createFromBitmap(ART_SPAWNS); sprite_space[EDITOR_SPRITE_HOUSE_EXIT] = GameSprite::createFromBitmap(ART_HOUSE_EXIT); @@ -344,17 +415,16 @@ bool GraphicManager::loadEditorSprites() return true; } -bool GraphicManager::loadOTFI(const FileName& filename, wxString& error, wxArrayString& warnings) -{ +bool GraphicManager::loadOTFI(const FileName &filename, wxString &error, wxArrayString &warnings) { wxDir dir(filename.GetFullPath()); wxString otfi_file; otfi_found = false; - if(dir.GetFirst(&otfi_file, "*.otfi", wxDIR_FILES)) { + if (dir.GetFirst(&otfi_file, "*.otfi", wxDIR_FILES)) { wxFileName otfi(filename.GetFullPath(), otfi_file); OTMLDocumentPtr doc = OTMLDocument::parse(otfi.GetFullPath().ToStdString()); - if(doc->size() == 0 || !doc->hasChildAt("DatSpr")) { + if (doc->size() == 0 || !doc->hasChildAt("DatSpr")) { error += "'DatSpr' tag not found"; return false; } @@ -371,7 +441,7 @@ bool GraphicManager::loadOTFI(const FileName& filename, wxString& error, wxArray otfi_found = true; } - if(!otfi_found) { + if (!otfi_found) { is_extended = false; has_transparency = false; has_frame_durations = false; @@ -383,12 +453,11 @@ bool GraphicManager::loadOTFI(const FileName& filename, wxString& error, wxArray return true; } -bool GraphicManager::loadSpriteMetadata(const FileName& datafile, wxString& error, wxArrayString& warnings) -{ +bool GraphicManager::loadSpriteMetadata(const FileName &datafile, wxString &error, wxArrayString &warnings) { // items.otb has most of the info we need. This only loads the GameSprite metadata FileReadHandle file(nstr(datafile.GetFullPath())); - if(!file.isOk()) { + if (!file.isOk()) { error += "Failed to open " + datafile.GetFullPath() + " for reading\nThe error reported was:" + wxstr(file.getErrorMessage()); return false; } @@ -397,7 +466,7 @@ bool GraphicManager::loadSpriteMetadata(const FileName& datafile, wxString& erro uint32_t datSignature; file.getU32(datSignature); - //get max id + // get max id file.getU16(item_count); file.getU16(creature_count); file.getU16(effect_count); @@ -409,12 +478,12 @@ bool GraphicManager::loadSpriteMetadata(const FileName& datafile, wxString& erro dat_format = client_version->getDatFormatForSignature(datSignature); - if(dat_format == DAT_FORMAT_UNKNOWN) { + if (dat_format == DAT_FORMAT_UNKNOWN) { error += "Failed to open " + datafile.GetFullPath() + " for reading\nCould not locate datSignature (0x" << wxString::Format(wxT("%02x"), datSignature) << ") compatible with client version " << client_version->getName(); return false; } - if(!otfi_found) { + if (!otfi_found) { is_extended = dat_format >= DAT_FORMAT_11; has_frame_durations = dat_format >= DAT_FORMAT_11; has_frame_groups = dat_format >= DAT_FORMAT_11; @@ -422,14 +491,14 @@ bool GraphicManager::loadSpriteMetadata(const FileName& datafile, wxString& erro uint16_t id = minID; // loop through all ItemDatabase until we reach the end of file - while(id <= maxID) { + while (id <= maxID) { GameSprite* sType = newd GameSprite(); sprite_space[id] = sType; sType->id = id; // Load the sprite flags - if(!loadSpriteMetadataFlags(file, sType, error, warnings)) { + if (!loadSpriteMetadataFlags(file, sType, error, warnings)) { wxString msg; msg << "Failed to load flags for sprite " << sType->id; warnings.push_back(msg); @@ -437,13 +506,13 @@ bool GraphicManager::loadSpriteMetadata(const FileName& datafile, wxString& erro // Reads the group count uint8_t group_count = 1; - if(has_frame_groups && id > item_count) { + if (has_frame_groups && id > item_count) { file.getU8(group_count); } - for(uint32_t k = 0; k < group_count; ++k) { + for (uint32_t k = 0; k < group_count; ++k) { // Skipping the group type - if(has_frame_groups && id > item_count) { + if (has_frame_groups && id > item_count) { file.skip(1); } @@ -452,7 +521,7 @@ bool GraphicManager::loadSpriteMetadata(const FileName& datafile, wxString& erro file.getByte(sType->height); // Skipping the exact size - if((sType->width > 1) || (sType->height > 1)){ + if ((sType->width > 1) || (sType->height > 1)) { file.skip(1); } @@ -462,18 +531,18 @@ bool GraphicManager::loadSpriteMetadata(const FileName& datafile, wxString& erro file.getU8(sType->pattern_z); file.getU8(sType->frames); // Length of animation - if(sType->frames > 1) { + if (sType->frames > 1) { uint8_t async = 0; int loop_count = 0; int8_t start_frame = 0; - if(has_frame_durations) { + if (has_frame_durations) { file.getByte(async); file.get32(loop_count); file.getSByte(start_frame); } sType->animator = newd Animator(sType->frames, start_frame, loop_count, async == 1); - if(has_frame_durations) { - for(int i = 0; i < sType->frames; i++) { + if (has_frame_durations) { + for (int i = 0; i < sType->frames; i++) { uint32_t min; uint32_t max; file.getU32(min); @@ -485,16 +554,12 @@ bool GraphicManager::loadSpriteMetadata(const FileName& datafile, wxString& erro } } - sType->numsprites = - (int)sType->width * (int)sType->height * - (int)sType->layers * - (int)sType->pattern_x * (int)sType->pattern_y * sType->pattern_z * - (int)sType->frames; + sType->numsprites = (int)sType->width * (int)sType->height * (int)sType->layers * (int)sType->pattern_x * (int)sType->pattern_y * sType->pattern_z * (int)sType->frames; // Read the sprite ids - for(uint32_t i = 0; i < sType->numsprites; ++i) { + for (uint32_t i = 0; i < sType->numsprites; ++i) { uint32_t sprite_id; - if(is_extended) { + if (is_extended) { file.getU32(sprite_id); } else { uint16_t u16 = 0; @@ -502,7 +567,7 @@ bool GraphicManager::loadSpriteMetadata(const FileName& datafile, wxString& erro sprite_id = u16; } - if(image_space[sprite_id] == nullptr) { + if (image_space[sprite_id] == nullptr) { GameSprite::NormalImage* img = newd GameSprite::NormalImage(); img->id = sprite_id; image_space[sprite_id] = img; @@ -516,27 +581,27 @@ bool GraphicManager::loadSpriteMetadata(const FileName& datafile, wxString& erro return true; } -bool GraphicManager::loadSpriteMetadataFlags(FileReadHandle& file, GameSprite* sType, wxString& error, wxArrayString& warnings) -{ +bool GraphicManager::loadSpriteMetadataFlags(FileReadHandle &file, GameSprite* sType, wxString &error, wxArrayString &warnings) { uint8_t prev_flag = 0; uint8_t flag = DatFlagLast; - for(int i = 0; i < DatFlagLast; ++i) { + for (int i = 0; i < DatFlagLast; ++i) { prev_flag = flag; file.getU8(flag); - if(flag == DatFlagLast) { + if (flag == DatFlagLast) { return true; } - if(dat_format >= DAT_FORMAT_11) { + if (dat_format >= DAT_FORMAT_11) { /* In 10.10+ all attributes from 16 and up were - * incremented by 1 to make space for 16 as - * "No Movement Animation" flag. - */ - if(flag == 16) + * incremented by 1 to make space for 16 as + * "No Movement Animation" flag. + */ + if (flag == 16) { flag = DatFlagNoMoveAnimation; - else if(flag > 16) + } else if (flag > 16) { flag -= 1; + } } switch (flag) { @@ -583,7 +648,7 @@ bool GraphicManager::loadSpriteMetadataFlags(FileReadHandle& file, GameSprite* s case DatFlagGround: uint16_t speed; file.getU16(speed); - sType->ground_speed = speed; + sType->ground_speed = speed; break; case DatFlagLight: { @@ -593,12 +658,12 @@ bool GraphicManager::loadSpriteMetadataFlags(FileReadHandle& file, GameSprite* s file.getU16(intensity); file.getU16(color); sType->has_light = true; - sType->light = SpriteLight{ static_cast(intensity), static_cast(color) }; + sType->light = SpriteLight { static_cast(intensity), static_cast(color) }; break; } case DatFlagDisplacement: { - if(dat_format >= DAT_FORMAT_11) { + if (dat_format >= DAT_FORMAT_11) { uint16_t offset_x; uint16_t offset_y; file.getU16(offset_x); @@ -645,28 +710,27 @@ bool GraphicManager::loadSpriteMetadataFlags(FileReadHandle& file, GameSprite* s return true; } -bool GraphicManager::loadSpriteData(const FileName& datafile, wxString& error, wxArrayString& warnings) -{ +bool GraphicManager::loadSpriteData(const FileName &datafile, wxString &error, wxArrayString &warnings) { FileReadHandle fh(nstr(datafile.GetFullPath())); - if(!fh.isOk()) { + if (!fh.isOk()) { error = "Failed to open file for reading"; return false; } -#define safe_get(func, ...) do {\ - if(!fh.get##func(__VA_ARGS__)) {\ +#define safe_get(func, ...) \ + do { \ + if (!fh.get##func(__VA_ARGS__)) { \ error = wxstr(fh.getErrorMessage()); \ - return false; \ - } \ - } while(false) - + return false; \ + } \ + } while (false) uint32_t sprSignature; safe_get(U32, sprSignature); uint32_t total_pics = 0; - if(is_extended) { + if (is_extended) { safe_get(U32, total_pics); } else { uint16_t u16 = 0; @@ -674,14 +738,14 @@ bool GraphicManager::loadSpriteData(const FileName& datafile, wxString& error, w total_pics = u16; } - if(!g_settings.getInteger(Config::USE_MEMCACHED_SPRITES)) { + if (!g_settings.getInteger(Config::USE_MEMCACHED_SPRITES)) { spritefile = nstr(datafile.GetFullPath()); unloaded = false; return true; } std::vector sprite_indexes; - for(uint32_t i = 0; i < total_pics; ++i) { + for (uint32_t i = 0; i < total_pics; ++i) { uint32_t index; safe_get(U32, index); sprite_indexes.push_back(index); @@ -689,17 +753,17 @@ bool GraphicManager::loadSpriteData(const FileName& datafile, wxString& error, w // Now read individual sprites int id = 1; - for(std::vector::iterator sprite_iter = sprite_indexes.begin(); sprite_iter != sprite_indexes.end(); ++sprite_iter, ++id) { + for (std::vector::iterator sprite_iter = sprite_indexes.begin(); sprite_iter != sprite_indexes.end(); ++sprite_iter, ++id) { uint32_t index = *sprite_iter + 3; fh.seek(index); uint16_t size; safe_get(U16, size); ImageMap::iterator it = image_space.find(id); - if(it != image_space.end()) { + if (it != image_space.end()) { GameSprite::NormalImage* spr = dynamic_cast(it->second); - if(spr && size > 0) { - if(spr->size > 0) { + if (spr && size > 0) { + if (spr->size > 0) { wxString ss; ss << "items.spr: Duplicate GameSprite id " << id; warnings.push_back(ss); @@ -708,8 +772,8 @@ bool GraphicManager::loadSpriteData(const FileName& datafile, wxString& error, w spr->id = id; spr->size = size; spr->dump = newd uint8_t[size]; - if(!fh.getRAW(spr->dump, size)) { - error = wxstr(fh.getErrorMessage()); \ + if (!fh.getRAW(spr->dump, size)) { + error = wxstr(fh.getErrorMessage()); return false; } } @@ -723,12 +787,12 @@ bool GraphicManager::loadSpriteData(const FileName& datafile, wxString& error, w return true; } -bool GraphicManager::loadSpriteDump(uint8_t*& target, uint16_t& size, int sprite_id) -{ - if(g_settings.getInteger(Config::USE_MEMCACHED_SPRITES)) +bool GraphicManager::loadSpriteDump(uint8_t*&target, uint16_t &size, int sprite_id) { + if (g_settings.getInteger(Config::USE_MEMCACHED_SPRITES)) { return false; + } - if(sprite_id == 0) { + if (sprite_id == 0) { // Empty GameSprite size = 0; target = nullptr; @@ -736,20 +800,22 @@ bool GraphicManager::loadSpriteDump(uint8_t*& target, uint16_t& size, int sprite } FileReadHandle fh(spritefile); - if(!fh.isOk()) + if (!fh.isOk()) { return false; + } unloaded = false; - if(!fh.seek((is_extended ? 4 : 2) + sprite_id * sizeof(uint32_t))) + if (!fh.seek((is_extended ? 4 : 2) + sprite_id * sizeof(uint32_t))) { return false; + } uint32_t to_seek = 0; - if(fh.getU32(to_seek)) { - fh.seek(to_seek+3); + if (fh.getU32(to_seek)) { + fh.seek(to_seek + 3); uint16_t sprite_size; - if(fh.getU16(sprite_size)) { + if (fh.getU16(sprite_size)) { target = newd uint8_t[sprite_size]; - if(fh.getRAW(target, sprite_size)) { + if (fh.getRAW(target, sprite_size)) { size = sprite_size; return true; } @@ -760,33 +826,32 @@ bool GraphicManager::loadSpriteDump(uint8_t*& target, uint16_t& size, int sprite return false; } -void GraphicManager::addSpriteToCleanup(GameSprite* spr) -{ +void GraphicManager::addSpriteToCleanup(GameSprite* spr) { cleanup_list.push_back(spr); // Clean if needed - if(cleanup_list.size() > std::max(100, g_settings.getInteger(Config::SOFTWARE_CLEAN_THRESHOLD))) { - for(int i = 0; i < g_settings.getInteger(Config::SOFTWARE_CLEAN_SIZE) && static_cast(i) < cleanup_list.size(); ++i) { + if (cleanup_list.size() > std::max(100, g_settings.getInteger(Config::SOFTWARE_CLEAN_THRESHOLD))) { + for (int i = 0; i < g_settings.getInteger(Config::SOFTWARE_CLEAN_SIZE) && static_cast(i) < cleanup_list.size(); ++i) { cleanup_list.front()->unloadDC(); cleanup_list.pop_front(); } } } -void GraphicManager::garbageCollection() -{ - if(g_settings.getInteger(Config::TEXTURE_MANAGEMENT)) { +void GraphicManager::garbageCollection() { + if (g_settings.getInteger(Config::TEXTURE_MANAGEMENT)) { int t = time(nullptr); - if(loaded_textures > g_settings.getInteger(Config::TEXTURE_CLEAN_THRESHOLD) && - t - lastclean > g_settings.getInteger(Config::TEXTURE_CLEAN_PULSE)) { + if (loaded_textures > g_settings.getInteger(Config::TEXTURE_CLEAN_THRESHOLD) && t - lastclean > g_settings.getInteger(Config::TEXTURE_CLEAN_PULSE)) { ImageMap::iterator iit = image_space.begin(); - while(iit != image_space.end()) { + while (iit != image_space.end()) { iit->second->clean(t); ++iit; } SpriteMap::iterator sit = sprite_space.begin(); - while(sit != sprite_space.end()) { + while (sit != sprite_space.end()) { GameSprite* gs = dynamic_cast(sit->second); - if(gs) gs->clean(t); + if (gs) { + gs->clean(t); + } ++sit; } lastclean = t; @@ -794,26 +859,23 @@ void GraphicManager::garbageCollection() } } -EditorSprite::EditorSprite(wxBitmap* b16x16, wxBitmap* b32x32) -{ +EditorSprite::EditorSprite(wxBitmap* b16x16, wxBitmap* b32x32) { bm[SPRITE_SIZE_16x16] = b16x16; bm[SPRITE_SIZE_32x32] = b32x32; } -EditorSprite::~EditorSprite() -{ +EditorSprite::~EditorSprite() { unloadDC(); } -void EditorSprite::DrawTo(wxDC* dc, SpriteSize sz, int start_x, int start_y, int width, int height) -{ +void EditorSprite::DrawTo(wxDC* dc, SpriteSize sz, int start_x, int start_y, int width, int height) { wxBitmap* sp = bm[sz]; - if(sp) + if (sp) { dc->DrawBitmap(*sp, start_x, start_y, true); + } } -void EditorSprite::unloadDC() -{ +void EditorSprite::unloadDC() { delete bm[SPRITE_SIZE_16x16]; delete bm[SPRITE_SIZE_32x32]; bm[SPRITE_SIZE_16x16] = nullptr; @@ -833,16 +895,14 @@ GameSprite::GameSprite() : animator(nullptr), ground_speed(0), draw_height(0), - minimap_color(0) -{ + minimap_color(0) { dc[SPRITE_SIZE_16x16] = nullptr; dc[SPRITE_SIZE_32x32] = nullptr; } -GameSprite::~GameSprite() -{ +GameSprite::~GameSprite() { unloadDC(); - for(std::list::iterator iter = instanced_templates.begin(); iter != instanced_templates.end(); ++iter) { + for (std::list::iterator iter = instanced_templates.begin(); iter != instanced_templates.end(); ++iter) { delete *iter; } @@ -850,43 +910,33 @@ GameSprite::~GameSprite() } void GameSprite::clean(int time) { - for(std::list::iterator iter = instanced_templates.begin(); - iter != instanced_templates.end(); - ++iter) - { + for (std::list::iterator iter = instanced_templates.begin(); + iter != instanced_templates.end(); + ++iter) { (*iter)->clean(time); } } -void GameSprite::unloadDC() -{ +void GameSprite::unloadDC() { delete dc[SPRITE_SIZE_16x16]; delete dc[SPRITE_SIZE_32x32]; dc[SPRITE_SIZE_16x16] = nullptr; dc[SPRITE_SIZE_32x32] = nullptr; } -int GameSprite::getIndex(int width, int height, int layer, int pattern_x, int pattern_y, int pattern_z, int frame) const -{ - return ((((((frame % this->frames) * - this->pattern_z + pattern_z) * - this->pattern_y + pattern_y) * - this->pattern_x + pattern_x) * - this->layers + layer) * - this->height + height) * - this->width + width; +int GameSprite::getIndex(int width, int height, int layer, int pattern_x, int pattern_y, int pattern_z, int frame) const { + return ((((((frame % this->frames) * this->pattern_z + pattern_z) * this->pattern_y + pattern_y) * this->pattern_x + pattern_x) * this->layers + layer) * this->height + height) * this->width + width; } -GLuint GameSprite::getHardwareID(int _x, int _y, int _layer, int _count, int _pattern_x, int _pattern_y, int _pattern_z, int _frame) -{ +GLuint GameSprite::getHardwareID(int _x, int _y, int _layer, int _count, int _pattern_x, int _pattern_y, int _pattern_z, int _frame) { uint32_t v; - if(_count >= 0 && height <= 1 && width <= 1) { + if (_count >= 0 && height <= 1 && width <= 1) { v = _count; } else { - v = ((((((_frame)*pattern_y+_pattern_y)*pattern_x+_pattern_x)*layers+_layer)*height+_y)*width+_x); + v = ((((((_frame)*pattern_y + _pattern_y) * pattern_x + _pattern_x) * layers + _layer) * height + _y) * width + _x); } - if(v >= numsprites) { - if(numsprites == 1) { + if (v >= numsprites) { + if (numsprites == 1) { v = 0; } else { v %= numsprites; @@ -895,19 +945,18 @@ GLuint GameSprite::getHardwareID(int _x, int _y, int _layer, int _count, int _pa return spriteList[v]->getHardwareID(); } -GameSprite::TemplateImage* GameSprite::getTemplateImage(int sprite_index, const Outfit& outfit) -{ - if(instanced_templates.empty()) { +GameSprite::TemplateImage* GameSprite::getTemplateImage(int sprite_index, const Outfit &outfit) { + if (instanced_templates.empty()) { TemplateImage* img = newd TemplateImage(this, sprite_index, outfit); instanced_templates.push_back(img); return img; } // While this is linear lookup, it is very rare for the list to contain more than 4-8 entries, so it's faster than a hashmap anyways. - for(std::list::iterator iter = instanced_templates.begin(); iter != instanced_templates.end(); ++iter) { + for (std::list::iterator iter = instanced_templates.begin(); iter != instanced_templates.end(); ++iter) { TemplateImage* img = *iter; - if(img->sprite_index == sprite_index) { + if (img->sprite_index == sprite_index) { uint32_t lookHash = img->lookHead << 24 | img->lookBody << 16 | img->lookLegs << 8 | img->lookFeet; - if(outfit.getColorHash() == lookHash) { + if (outfit.getColorHash() == lookHash) { return img; } } @@ -917,28 +966,26 @@ GameSprite::TemplateImage* GameSprite::getTemplateImage(int sprite_index, const return img; } -GLuint GameSprite::getHardwareID(int _x, int _y, int _dir, int _addon, int _pattern_z, const Outfit& _outfit, int _frame) -{ +GLuint GameSprite::getHardwareID(int _x, int _y, int _dir, int _addon, int _pattern_z, const Outfit &_outfit, int _frame) { uint32_t v = getIndex(_x, _y, 0, _dir, _addon, _pattern_z, _frame); - if(v >= numsprites) { - if(numsprites == 1) { + if (v >= numsprites) { + if (numsprites == 1) { v = 0; } else { v %= numsprites; } } - if(layers > 1) { // Template + if (layers > 1) { // Template TemplateImage* img = getTemplateImage(v, _outfit); return img->getHardwareID(); } return spriteList[v]->getHardwareID(); } -wxMemoryDC* GameSprite::getDC(SpriteSize size) -{ +wxMemoryDC* GameSprite::getDC(SpriteSize size) { ASSERT(size == SPRITE_SIZE_16x16 || size == SPRITE_SIZE_32x32); - if(!dc[size]) { + if (!dc[size]) { ASSERT(width >= 1 && height >= 1); const int bgshade = g_settings.getInteger(Config::ICON_BACKGROUND); @@ -947,12 +994,12 @@ wxMemoryDC* GameSprite::getDC(SpriteSize size) wxImage image(image_size, image_size); image.Clear(bgshade); - for(uint8_t l = 0; l < layers; l++) { - for(uint8_t w = 0; w < width; w++) { - for(uint8_t h = 0; h < height; h++) { + for (uint8_t l = 0; l < layers; l++) { + for (uint8_t w = 0; w < width; w++) { + for (uint8_t h = 0; h < height; h++) { const int i = getIndex(w, h, l, 0, 0, 0, 0); uint8_t* data = spriteList[i]->getRGBData(); - if(data) { + if (data) { wxImage img(rme::SpritePixels, rme::SpritePixels, data); img.SetMaskColour(0xFF, 0x00, 0xFF); image.Paste(img, (width - w - 1) * rme::SpritePixels, (height - h - 1) * rme::SpritePixels); @@ -963,7 +1010,7 @@ wxMemoryDC* GameSprite::getDC(SpriteSize size) } // Now comes the resizing / antialiasing - if(size == SPRITE_SIZE_16x16 || image.GetWidth() > rme::SpritePixels || image.GetHeight() > rme::SpritePixels) { + if (size == SPRITE_SIZE_16x16 || image.GetWidth() > rme::SpritePixels || image.GetHeight() > rme::SpritePixels) { int new_size = SPRITE_SIZE_16x16 ? 16 : 32; image.Rescale(new_size, new_size); } @@ -976,15 +1023,18 @@ wxMemoryDC* GameSprite::getDC(SpriteSize size) return dc[size]; } -void GameSprite::DrawTo(wxDC* dc, SpriteSize sz, int start_x, int start_y, int width, int height) -{ - if(width == -1) width = sz == SPRITE_SIZE_32x32 ? 32 : 16; - if(height == -1) height= sz == SPRITE_SIZE_32x32 ? 32 : 16; +void GameSprite::DrawTo(wxDC* dc, SpriteSize sz, int start_x, int start_y, int width, int height) { + if (width == -1) { + width = sz == SPRITE_SIZE_32x32 ? 32 : 16; + } + if (height == -1) { + height = sz == SPRITE_SIZE_32x32 ? 32 : 16; + } wxDC* sdc = getDC(sz); - if(sdc) { + if (sdc) { dc->Blit(start_x, start_y, width, height, sdc, 0, 0, wxCOPY, true); } else { - const wxBrush& b = dc->GetBrush(); + const wxBrush &b = dc->GetBrush(); dc->SetBrush(*wxRED_BRUSH); dc->DrawRectangle(start_x, start_y, width, height); dc->SetBrush(b); @@ -993,22 +1043,19 @@ void GameSprite::DrawTo(wxDC* dc, SpriteSize sz, int start_x, int start_y, int w GameSprite::Image::Image() : isGLLoaded(false), - lastaccess(0) -{ + lastaccess(0) { //// } -GameSprite::Image::~Image() -{ +GameSprite::Image::~Image() { unloadGLTexture(0); } -void GameSprite::Image::createGLTexture(GLuint textureId) -{ +void GameSprite::Image::createGLTexture(GLuint textureId) { ASSERT(!isGLLoaded); uint8_t* rgba = getRGBAData(); - if(!rgba) { + if (!rgba) { return; } @@ -1025,21 +1072,18 @@ void GameSprite::Image::createGLTexture(GLuint textureId) delete[] rgba; } -void GameSprite::Image::unloadGLTexture(GLuint textureId) -{ +void GameSprite::Image::unloadGLTexture(GLuint textureId) { isGLLoaded = false; g_gui.gfx.loaded_textures -= 1; glDeleteTextures(1, &textureId); } -void GameSprite::Image::visit() -{ +void GameSprite::Image::visit() { lastaccess = time(nullptr); } -void GameSprite::Image::clean(int time) -{ - if(isGLLoaded && time - lastaccess > g_settings.getInteger(Config::TEXTURE_LONGEVITY)) { +void GameSprite::Image::clean(int time) { + if (isGLLoaded && time - lastaccess > g_settings.getInteger(Config::TEXTURE_LONGEVITY)) { unloadGLTexture(0); } } @@ -1047,33 +1091,29 @@ void GameSprite::Image::clean(int time) GameSprite::NormalImage::NormalImage() : id(0), size(0), - dump(nullptr) -{ + dump(nullptr) { //// } -GameSprite::NormalImage::~NormalImage() -{ +GameSprite::NormalImage::~NormalImage() { delete[] dump; } -void GameSprite::NormalImage::clean(int time) -{ +void GameSprite::NormalImage::clean(int time) { Image::clean(time); - if(time - lastaccess > 5 && !g_settings.getInteger(Config::USE_MEMCACHED_SPRITES)) { // We keep dumps around for 5 seconds. + if (time - lastaccess > 5 && !g_settings.getInteger(Config::USE_MEMCACHED_SPRITES)) { // We keep dumps around for 5 seconds. delete[] dump; dump = nullptr; } } -uint8_t* GameSprite::NormalImage::getRGBData() -{ - if(!dump) { - if(g_settings.getInteger(Config::USE_MEMCACHED_SPRITES)) { +uint8_t* GameSprite::NormalImage::getRGBData() { + if (!dump) { + if (g_settings.getInteger(Config::USE_MEMCACHED_SPRITES)) { return nullptr; } - if(!g_gui.gfx.loadSpriteDump(dump, size, id)) { + if (!g_gui.gfx.loadSpriteDump(dump, size, id)) { return nullptr; } } @@ -1085,10 +1125,10 @@ uint8_t* GameSprite::NormalImage::getRGBData() int read = 0; // decompress pixels - while(read < size && write < pixels_data_size) { + while (read < size && write < pixels_data_size) { int transparent = dump[read] | dump[read + 1] << 8; read += 2; - for(int i = 0; i < transparent && write < pixels_data_size; i++) { + for (int i = 0; i < transparent && write < pixels_data_size; i++) { data[write + 0] = 0xFF; // red data[write + 1] = 0x00; // green data[write + 2] = 0xFF; // blue @@ -1097,7 +1137,7 @@ uint8_t* GameSprite::NormalImage::getRGBData() int colored = dump[read] | dump[read + 1] << 8; read += 2; - for(int i = 0; i < colored && write < pixels_data_size; i++) { + for (int i = 0; i < colored && write < pixels_data_size; i++) { data[write + 0] = dump[read + 0]; // red data[write + 1] = dump[read + 1]; // green data[write + 2] = dump[read + 2]; // blue @@ -1107,7 +1147,7 @@ uint8_t* GameSprite::NormalImage::getRGBData() } // fill remaining pixels - while(write < pixels_data_size) { + while (write < pixels_data_size) { data[write + 0] = 0xFF; // red data[write + 1] = 0x00; // green data[write + 2] = 0xFF; // blue @@ -1116,15 +1156,13 @@ uint8_t* GameSprite::NormalImage::getRGBData() return data; } - -uint8_t* GameSprite::NormalImage::getRGBAData() -{ - if(!dump) { - if(g_settings.getInteger(Config::USE_MEMCACHED_SPRITES)) { +uint8_t* GameSprite::NormalImage::getRGBAData() { + if (!dump) { + if (g_settings.getInteger(Config::USE_MEMCACHED_SPRITES)) { return nullptr; } - if(!g_gui.gfx.loadSpriteDump(dump, size, id)) { + if (!g_gui.gfx.loadSpriteDump(dump, size, id)) { return nullptr; } } @@ -1137,12 +1175,13 @@ uint8_t* GameSprite::NormalImage::getRGBAData() int read = 0; // decompress pixels - while(read < size && write < pixels_data_size) { + while (read < size && write < pixels_data_size) { int transparent = dump[read] | dump[read + 1] << 8; - if(use_alpha && transparent >= rme::SpritePixelsSize) // Corrupted sprite? + if (use_alpha && transparent >= rme::SpritePixelsSize) { // Corrupted sprite? break; + } read += 2; - for(int i = 0; i < transparent && write < pixels_data_size; i++) { + for (int i = 0; i < transparent && write < pixels_data_size; i++) { data[write + 0] = 0x00; // red data[write + 1] = 0x00; // green data[write + 2] = 0x00; // blue @@ -1152,7 +1191,7 @@ uint8_t* GameSprite::NormalImage::getRGBAData() int colored = dump[read] | dump[read + 1] << 8; read += 2; - for(int i = 0; i < colored && write < pixels_data_size; i++) { + for (int i = 0; i < colored && write < pixels_data_size; i++) { data[write + 0] = dump[read + 0]; // red data[write + 1] = dump[read + 1]; // green data[write + 2] = dump[read + 2]; // blue @@ -1163,7 +1202,7 @@ uint8_t* GameSprite::NormalImage::getRGBAData() } // fill remaining pixels - while(write < pixels_data_size) { + while (write < pixels_data_size) { data[write + 0] = 0x00; // red data[write + 1] = 0x00; // green data[write + 2] = 0x00; // blue @@ -1173,53 +1212,48 @@ uint8_t* GameSprite::NormalImage::getRGBAData() return data; } -GLuint GameSprite::NormalImage::getHardwareID() -{ - if(!isGLLoaded) { +GLuint GameSprite::NormalImage::getHardwareID() { + if (!isGLLoaded) { createGLTexture(id); } visit(); return id; } -void GameSprite::NormalImage::createGLTexture(GLuint textureId) -{ +void GameSprite::NormalImage::createGLTexture(GLuint textureId) { Image::createGLTexture(id); } -void GameSprite::NormalImage::unloadGLTexture(GLuint textureId) -{ +void GameSprite::NormalImage::unloadGLTexture(GLuint textureId) { Image::unloadGLTexture(id); } -GameSprite::EditorImage::EditorImage(const wxArtID& bitmapId) : +GameSprite::EditorImage::EditorImage(const wxArtID &bitmapId) : NormalImage(), - bitmapId(bitmapId) -{ } + bitmapId(bitmapId) { } -void GameSprite::EditorImage::createGLTexture(GLuint textureId) -{ +void GameSprite::EditorImage::createGLTexture(GLuint textureId) { ASSERT(!isGLLoaded); wxSize size(rme::SpritePixels, rme::SpritePixels); wxBitmap bitmap = wxArtProvider::GetBitmap(bitmapId, wxART_OTHER, size); wxNativePixelData data(bitmap); - if (!data) return; + if (!data) { + return; + } const int imageSize = rme::SpritePixelsSize * 4; - GLubyte *imageData = new GLubyte[imageSize]; + GLubyte* imageData = new GLubyte[imageSize]; int write = 0; wxNativePixelData::Iterator it(data); it.Offset(data, 0, 0); - for(size_t y = 0; y < rme::SpritePixels; ++y) - { + for (size_t y = 0; y < rme::SpritePixels; ++y) { wxNativePixelData::Iterator row_start = it; - for(size_t x = 0; x < rme::SpritePixels; ++x, it++) - { + for (size_t x = 0; x < rme::SpritePixels; ++x, it++) { uint8_t red = it.Red(); uint8_t green = it.Green(); uint8_t blue = it.Blue(); @@ -1250,30 +1284,26 @@ void GameSprite::EditorImage::createGLTexture(GLuint textureId) delete[] imageData; } -void GameSprite::EditorImage::unloadGLTexture(GLuint textureId) -{ +void GameSprite::EditorImage::unloadGLTexture(GLuint textureId) { Image::unloadGLTexture(id); } -GameSprite::TemplateImage::TemplateImage(GameSprite* parent, int v, const Outfit& outfit) : +GameSprite::TemplateImage::TemplateImage(GameSprite* parent, int v, const Outfit &outfit) : gl_tid(0), parent(parent), sprite_index(v), lookHead(outfit.lookHead), lookBody(outfit.lookBody), lookLegs(outfit.lookLegs), - lookFeet(outfit.lookFeet) -{ + lookFeet(outfit.lookFeet) { //// } -GameSprite::TemplateImage::~TemplateImage() -{ +GameSprite::TemplateImage::~TemplateImage() { //// } -void GameSprite::TemplateImage::colorizePixel(uint8_t color, uint8_t& red, uint8_t& green, uint8_t& blue) -{ +void GameSprite::TemplateImage::colorizePixel(uint8_t color, uint8_t &red, uint8_t &green, uint8_t &blue) { // Thanks! Khaos, or was it mips? Hmmm... =) uint8_t ro = (TemplateOutfitLookupTable[color] & 0xFF0000) >> 16; // rgb outfit uint8_t go = (TemplateOutfitLookupTable[color] & 0xFF00) >> 8; @@ -1283,50 +1313,49 @@ void GameSprite::TemplateImage::colorizePixel(uint8_t color, uint8_t& red, uint8 blue = (uint8_t)(blue * (bo / 255.f)); } -uint8_t* GameSprite::TemplateImage::getRGBData() -{ +uint8_t* GameSprite::TemplateImage::getRGBData() { uint8_t* rgbdata = parent->spriteList[sprite_index]->getRGBData(); uint8_t* template_rgbdata = parent->spriteList[sprite_index + parent->height * parent->width]->getRGBData(); - if(!rgbdata) { + if (!rgbdata) { delete[] template_rgbdata; return nullptr; } - if(!template_rgbdata) { + if (!template_rgbdata) { delete[] rgbdata; return nullptr; } - if(lookHead > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { + if (lookHead > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { lookHead = 0; } - if(lookBody > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { + if (lookBody > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { lookBody = 0; } - if(lookLegs > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { + if (lookLegs > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { lookLegs = 0; } - if(lookFeet > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { + if (lookFeet > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { lookFeet = 0; } - for(int y = 0; y < rme::SpritePixels; ++y) { - for(int x = 0; x < rme::SpritePixels; ++x) { - uint8_t& red = rgbdata[y*rme::SpritePixels*3 + x*3 + 0]; - uint8_t& green = rgbdata[y*rme::SpritePixels*3 + x*3 + 1]; - uint8_t& blue = rgbdata[y*rme::SpritePixels*3 + x*3 + 2]; + for (int y = 0; y < rme::SpritePixels; ++y) { + for (int x = 0; x < rme::SpritePixels; ++x) { + uint8_t &red = rgbdata[y * rme::SpritePixels * 3 + x * 3 + 0]; + uint8_t &green = rgbdata[y * rme::SpritePixels * 3 + x * 3 + 1]; + uint8_t &blue = rgbdata[y * rme::SpritePixels * 3 + x * 3 + 2]; - uint8_t& tred = template_rgbdata[y*rme::SpritePixels*3 + x*3 + 0]; - uint8_t& tgreen = template_rgbdata[y*rme::SpritePixels*3 + x*3 + 1]; - uint8_t& tblue = template_rgbdata[y*rme::SpritePixels*3 + x*3 + 2]; + uint8_t &tred = template_rgbdata[y * rme::SpritePixels * 3 + x * 3 + 0]; + uint8_t &tgreen = template_rgbdata[y * rme::SpritePixels * 3 + x * 3 + 1]; + uint8_t &tblue = template_rgbdata[y * rme::SpritePixels * 3 + x * 3 + 2]; - if(tred && tgreen && !tblue) { // yellow => head + if (tred && tgreen && !tblue) { // yellow => head colorizePixel(lookHead, red, green, blue); - } else if(tred && !tgreen && !tblue) { // red => body + } else if (tred && !tgreen && !tblue) { // red => body colorizePixel(lookBody, red, green, blue); - } else if(!tred && tgreen && !tblue) { // green => legs + } else if (!tred && tgreen && !tblue) { // green => legs colorizePixel(lookLegs, red, green, blue); - } else if(!tred && !tgreen && tblue) { // blue => feet + } else if (!tred && !tgreen && tblue) { // blue => feet colorizePixel(lookFeet, red, green, blue); } } @@ -1335,50 +1364,49 @@ uint8_t* GameSprite::TemplateImage::getRGBData() return rgbdata; } -uint8_t* GameSprite::TemplateImage::getRGBAData() -{ +uint8_t* GameSprite::TemplateImage::getRGBAData() { uint8_t* rgbadata = parent->spriteList[sprite_index]->getRGBAData(); uint8_t* template_rgbdata = parent->spriteList[sprite_index + parent->height * parent->width]->getRGBData(); - if(!rgbadata) { + if (!rgbadata) { delete[] template_rgbdata; return nullptr; } - if(!template_rgbdata) { + if (!template_rgbdata) { delete[] rgbadata; return nullptr; } - if(lookHead > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { + if (lookHead > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { lookHead = 0; } - if(lookBody > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { + if (lookBody > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { lookBody = 0; } - if(lookLegs > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { + if (lookLegs > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { lookLegs = 0; } - if(lookFeet > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { + if (lookFeet > (sizeof(TemplateOutfitLookupTable) / sizeof(TemplateOutfitLookupTable[0]))) { lookFeet = 0; } - for(int y = 0; y < rme::SpritePixels; ++y) { - for(int x = 0; x < rme::SpritePixels; ++x) { - uint8_t& red = rgbadata[y*rme::SpritePixels*4 + x*4 + 0]; - uint8_t& green = rgbadata[y*rme::SpritePixels*4 + x*4 + 1]; - uint8_t& blue = rgbadata[y*rme::SpritePixels*4 + x*4 + 2]; + for (int y = 0; y < rme::SpritePixels; ++y) { + for (int x = 0; x < rme::SpritePixels; ++x) { + uint8_t &red = rgbadata[y * rme::SpritePixels * 4 + x * 4 + 0]; + uint8_t &green = rgbadata[y * rme::SpritePixels * 4 + x * 4 + 1]; + uint8_t &blue = rgbadata[y * rme::SpritePixels * 4 + x * 4 + 2]; - uint8_t& tred = template_rgbdata[y*rme::SpritePixels*3 + x*3 + 0]; - uint8_t& tgreen = template_rgbdata[y*rme::SpritePixels*3 + x*3 + 1]; - uint8_t& tblue = template_rgbdata[y*rme::SpritePixels*3 + x*3 + 2]; + uint8_t &tred = template_rgbdata[y * rme::SpritePixels * 3 + x * 3 + 0]; + uint8_t &tgreen = template_rgbdata[y * rme::SpritePixels * 3 + x * 3 + 1]; + uint8_t &tblue = template_rgbdata[y * rme::SpritePixels * 3 + x * 3 + 2]; - if(tred && tgreen && !tblue) { // yellow => head + if (tred && tgreen && !tblue) { // yellow => head colorizePixel(lookHead, red, green, blue); - } else if(tred && !tgreen && !tblue) { // red => body + } else if (tred && !tgreen && !tblue) { // red => body colorizePixel(lookBody, red, green, blue); - } else if(!tred && tgreen && !tblue) { // green => legs + } else if (!tred && tgreen && !tblue) { // green => legs colorizePixel(lookLegs, red, green, blue); - } else if(!tred && !tgreen && tblue) { // blue => feet + } else if (!tred && !tgreen && tblue) { // blue => feet colorizePixel(lookFeet, red, green, blue); } } @@ -1387,14 +1415,13 @@ uint8_t* GameSprite::TemplateImage::getRGBAData() return rgbadata; } -GLuint GameSprite::TemplateImage::getHardwareID() -{ - if(!isGLLoaded) { - if(gl_tid == 0) { +GLuint GameSprite::TemplateImage::getHardwareID() { + if (!isGLLoaded) { + if (gl_tid == 0) { gl_tid = g_gui.gfx.getFreeTextureID(); } createGLTexture(gl_tid); - if(!isGLLoaded) { + if (!isGLLoaded) { return 0; } } @@ -1402,18 +1429,15 @@ GLuint GameSprite::TemplateImage::getHardwareID() return gl_tid; } -void GameSprite::TemplateImage::createGLTexture(GLuint unused) -{ +void GameSprite::TemplateImage::createGLTexture(GLuint unused) { Image::createGLTexture(gl_tid); } -void GameSprite::TemplateImage::unloadGLTexture(GLuint unused) -{ +void GameSprite::TemplateImage::unloadGLTexture(GLuint unused) { Image::unloadGLTexture(gl_tid); } -GameSprite* GameSprite::createFromBitmap(const wxArtID& bitmapId) -{ +GameSprite* GameSprite::createFromBitmap(const wxArtID &bitmapId) { GameSprite::EditorImage* image = new GameSprite::EditorImage(bitmapId); GameSprite* sprite = new GameSprite(); @@ -1443,53 +1467,50 @@ Animator::Animator(int frame_count, int start_frame, int loop_count, bool async) total_duration(0), direction(ANIMATION_FORWARD), last_time(0), - is_complete(false) -{ + is_complete(false) { ASSERT(start_frame >= -1 && start_frame < frame_count); - for(int i = 0; i < frame_count; i++) { + for (int i = 0; i < frame_count; i++) { durations.push_back(newd FrameDuration(ITEM_FRAME_DURATION, ITEM_FRAME_DURATION)); } reset(); } -Animator::~Animator() -{ - for(int i = 0; i < frame_count; i++) { +Animator::~Animator() { + for (int i = 0; i < frame_count; i++) { delete durations[i]; } durations.clear(); } -int Animator::getStartFrame() const -{ - if(start_frame > -1) +int Animator::getStartFrame() const { + if (start_frame > -1) { return start_frame; + } return uniform_random(0, frame_count - 1); } -FrameDuration* Animator::getFrameDuration(int frame) -{ +FrameDuration* Animator::getFrameDuration(int frame) { ASSERT(frame >= 0 && frame < frame_count); return durations[frame]; } -int Animator::getFrame() -{ +int Animator::getFrame() { long time = g_gui.gfx.getElapsedTime(); - if(time != last_time && !is_complete) { + if (time != last_time && !is_complete) { long elapsed = time - last_time; - if(elapsed >= current_duration) { + if (elapsed >= current_duration) { int frame = 0; - if(loop_count < 0) + if (loop_count < 0) { frame = getPingPongFrame(); - else + } else { frame = getLoopFrame(); + } - if(current_frame != frame) { + if (current_frame != frame) { int duration = getDuration(frame) - (elapsed - current_duration); - if(duration < 0 && !async) { + if (duration < 0 && !async) { calculateSynchronous(); } else { current_frame = frame; @@ -1507,22 +1528,23 @@ int Animator::getFrame() return current_frame; } -void Animator::setFrame(int frame) -{ +void Animator::setFrame(int frame) { ASSERT(frame == -1 || frame == 255 || frame == 254 || (frame >= 0 && frame < frame_count)); - if(current_frame == frame) + if (current_frame == frame) { return; + } - if(async) { - if(frame == 255) // Async mode + if (async) { + if (frame == 255) { // Async mode current_frame = 0; - else if(frame == 254) // Random mode + } else if (frame == 254) { // Random mode current_frame = uniform_random(0, frame_count - 1); - else if(frame >= 0 && frame < frame_count) + } else if (frame >= 0 && frame < frame_count) { current_frame = frame; - else + } else { current_frame = getStartFrame(); + } is_complete = false; last_time = g_gui.gfx.getElapsedTime(); @@ -1533,11 +1555,11 @@ void Animator::setFrame(int frame) } } -void Animator::reset() -{ +void Animator::reset() { total_duration = 0; - for(int i = 0; i < frame_count; i++) + for (int i = 0; i < frame_count; i++) { total_duration += durations[i]->max; + } is_complete = false; direction = ANIMATION_FORWARD; @@ -1546,48 +1568,46 @@ void Animator::reset() setFrame(-1); } -int Animator::getDuration(int frame) const -{ +int Animator::getDuration(int frame) const { ASSERT(frame >= 0 && frame < frame_count); return durations[frame]->getDuration(); } -int Animator::getPingPongFrame() -{ +int Animator::getPingPongFrame() { int count = direction == ANIMATION_FORWARD ? 1 : -1; int next_frame = current_frame + count; - if(next_frame < 0 || next_frame >= frame_count) { + if (next_frame < 0 || next_frame >= frame_count) { direction = direction == ANIMATION_FORWARD ? ANIMATION_BACKWARD : ANIMATION_FORWARD; count *= -1; } return current_frame + count; } -int Animator::getLoopFrame() -{ +int Animator::getLoopFrame() { int next_phase = current_frame + 1; - if(next_phase < frame_count) + if (next_phase < frame_count) { return next_phase; + } - if(loop_count == 0) + if (loop_count == 0) { return 0; + } - if(current_loop < (loop_count - 1)) { + if (current_loop < (loop_count - 1)) { current_loop++; return 0; } return current_frame; } -void Animator::calculateSynchronous() -{ +void Animator::calculateSynchronous() { long time = g_gui.gfx.getElapsedTime(); - if(time > 0 && total_duration > 0) { + if (time > 0 && total_duration > 0) { long elapsed = time % total_duration; int total_time = 0; - for(int i = 0; i < frame_count; i++) { + for (int i = 0; i < frame_count; i++) { int duration = getDuration(i); - if(elapsed >= total_time && elapsed < total_time + duration) { + if (elapsed >= total_time && elapsed < total_time + duration) { current_frame = i; current_duration = duration - (elapsed - total_time); break; diff --git a/source/graphics.h b/source/graphics.h index b21f05c8..6703c3c2 100644 --- a/source/graphics.h +++ b/source/graphics.h @@ -26,7 +26,7 @@ enum SpriteSize { SPRITE_SIZE_16x16, - //SPRITE_SIZE_24x24, + // SPRITE_SIZE_24x24, SPRITE_SIZE_32x32, SPRITE_SIZE_COUNT }; @@ -50,16 +50,15 @@ struct SpriteLight { uint8_t color = 0; }; -class Sprite -{ +class Sprite { public: - Sprite() {} + Sprite() { } virtual void DrawTo(wxDC* dc, SpriteSize sz, int start_x, int start_y, int width = -1, int height = -1) = 0; virtual void unloadDC() = 0; private: - Sprite(const Sprite&); + Sprite(const Sprite &); }; class EditorSprite : public Sprite { @@ -74,29 +73,38 @@ class EditorSprite : public Sprite { wxBitmap* bm[SPRITE_SIZE_COUNT]; }; - -class GameSprite : public Sprite{ +class GameSprite : public Sprite { public: GameSprite(); virtual ~GameSprite(); int getIndex(int width, int height, int layer, int pattern_x, int pattern_y, int pattern_z, int frame) const; GLuint getHardwareID(int _x, int _y, int _layer, int _subtype, int _pattern_x, int _pattern_y, int _pattern_z, int _frame); - GLuint getHardwareID(int _x, int _y, int _dir, int _addon, int _pattern_z, const Outfit& _outfit, int _frame); // CreatureDatabase + GLuint getHardwareID(int _x, int _y, int _dir, int _addon, int _pattern_z, const Outfit &_outfit, int _frame); // CreatureDatabase virtual void DrawTo(wxDC* dc, SpriteSize sz, int start_x, int start_y, int width = -1, int height = -1); virtual void unloadDC(); void clean(int time); - uint16_t getDrawHeight() const noexcept { return draw_height; } - const wxPoint& getDrawOffset() const noexcept { return draw_offset; } - uint8_t getMiniMapColor() const noexcept { return minimap_color; } + uint16_t getDrawHeight() const noexcept { + return draw_height; + } + const wxPoint &getDrawOffset() const noexcept { + return draw_offset; + } + uint8_t getMiniMapColor() const noexcept { + return minimap_color; + } - bool hasLight() const noexcept { return has_light; } - const SpriteLight& getLight() const noexcept { return light; } + bool hasLight() const noexcept { + return has_light; + } + const SpriteLight &getLight() const noexcept { + return light; + } - static GameSprite* createFromBitmap(const wxArtID& bitmapId); + static GameSprite* createFromBitmap(const wxArtID &bitmapId); protected: class Image; @@ -104,7 +112,7 @@ class GameSprite : public Sprite{ class TemplateImage; wxMemoryDC* getDC(SpriteSize size); - TemplateImage* getTemplateImage(int sprite_index, const Outfit& outfit); + TemplateImage* getTemplateImage(int sprite_index, const Outfit &outfit); class Image { public: @@ -120,6 +128,7 @@ class GameSprite : public Sprite{ virtual GLuint getHardwareID() = 0; virtual uint8_t* getRGBData() = 0; virtual uint8_t* getRGBAData() = 0; + protected: virtual void createGLTexture(GLuint textureId); virtual void unloadGLTexture(GLuint textureId); @@ -142,6 +151,7 @@ class GameSprite : public Sprite{ virtual GLuint getHardwareID(); virtual uint8_t* getRGBData(); virtual uint8_t* getRGBAData(); + protected: virtual void createGLTexture(GLuint textureId = 0); virtual void unloadGLTexture(GLuint textureId = 0); @@ -149,17 +159,19 @@ class GameSprite : public Sprite{ class EditorImage : public NormalImage { public: - EditorImage(const wxArtID& bitmapId); + EditorImage(const wxArtID &bitmapId); + protected: void createGLTexture(GLuint textureId) override; void unloadGLTexture(GLuint textureId) override; + private: wxArtID bitmapId; }; class TemplateImage : public Image { public: - TemplateImage(GameSprite* parent, int v, const Outfit& outfit); + TemplateImage(GameSprite* parent, int v, const Outfit &outfit); virtual ~TemplateImage(); virtual GLuint getHardwareID(); @@ -173,6 +185,7 @@ class GameSprite : public Sprite{ uint8_t lookBody; uint8_t lookLegs; uint8_t lookFeet; + protected: void colorizePixel(uint8_t color, uint8_t &r, uint8_t &b, uint8_t &g); @@ -211,33 +224,30 @@ class GameSprite : public Sprite{ friend class GraphicManager; }; -struct FrameDuration -{ +struct FrameDuration { int min; int max; - FrameDuration(int min, int max) : min(min), max(max) - { + FrameDuration(int min, int max) : + min(min), max(max) { ASSERT(min <= max); } - int getDuration() const - { - if(min == max) + int getDuration() const { + if (min == max) { return min; + } return uniform_random(min, max); }; - void setValues(int min, int max) - { + void setValues(int min, int max) { ASSERT(min <= max); this->min = min; this->max = max; } }; -class Animator -{ +class Animator { public: Animator(int frames, int start_frame, int loop_count, bool async); ~Animator(); @@ -271,8 +281,7 @@ class Animator bool is_complete; }; -class GraphicManager -{ +class GraphicManager { public: GraphicManager(); ~GraphicManager(); @@ -284,11 +293,19 @@ class GraphicManager GameSprite* getCreatureSprite(int id); GameSprite* getEditorSprite(int id); - long getElapsedTime() const { return (animation_timer->TimeInMicro() / 1000).ToLong(); } + long getElapsedTime() const { + return (animation_timer->TimeInMicro() / 1000).ToLong(); + } - uint16_t getItemSpriteMinID() const noexcept { return 100; } - uint16_t getItemSpriteMaxID() const noexcept { return item_count; } - uint16_t getCreatureSpriteMaxID() const noexcept { return creature_count; } + uint16_t getItemSpriteMinID() const noexcept { + return 100; + } + uint16_t getItemSpriteMaxID() const noexcept { + return item_count; + } + uint16_t getCreatureSpriteMaxID() const noexcept { + return creature_count; + } // Get an unused texture id (this is acquired by simply increasing a value starting from 0x10000000) GLuint getFreeTextureID(); @@ -297,28 +314,32 @@ class GraphicManager bool loadEditorSprites(); // Metadata should be loaded first // This fills the item / creature adress space - bool loadOTFI(const FileName& filename, wxString& error, wxArrayString& warnings); - bool loadSpriteMetadata(const FileName& datafile, wxString& error, wxArrayString& warnings); - bool loadSpriteMetadataFlags(FileReadHandle& file, GameSprite* sType, wxString& error, wxArrayString& warnings); - bool loadSpriteData(const FileName& datafile, wxString& error, wxArrayString& warnings); + bool loadOTFI(const FileName &filename, wxString &error, wxArrayString &warnings); + bool loadSpriteMetadata(const FileName &datafile, wxString &error, wxArrayString &warnings); + bool loadSpriteMetadataFlags(FileReadHandle &file, GameSprite* sType, wxString &error, wxArrayString &warnings); + bool loadSpriteData(const FileName &datafile, wxString &error, wxArrayString &warnings); // Cleans old & unused textures according to config settings void garbageCollection(); void addSpriteToCleanup(GameSprite* spr); - wxFileName getMetadataFileName() const { return metadata_file; } - wxFileName getSpritesFileName() const { return sprites_file; } + wxFileName getMetadataFileName() const { + return metadata_file; + } + wxFileName getSpritesFileName() const { + return sprites_file; + } bool hasTransparency() const; bool isUnloaded() const; - ClientVersion *client_version; + ClientVersion* client_version; private: bool unloaded; // This is used if memcaching is NOT on std::string spritefile; - bool loadSpriteDump(uint8_t*& target, uint16_t& size, int sprite_id); + bool loadSpriteDump(uint8_t*&target, uint16_t &size, int sprite_id); typedef std::map SpriteMap; SpriteMap sprite_space; diff --git a/source/ground_brush.cpp b/source/ground_brush.cpp index a9ae5f53..d43207be 100644 --- a/source/ground_brush.cpp +++ b/source/ground_brush.cpp @@ -23,72 +23,70 @@ uint32_t GroundBrush::border_types[256]; -int AutoBorder::edgeNameToID(const std::string& edgename) -{ - if(edgename == "n") { +int AutoBorder::edgeNameToID(const std::string &edgename) { + if (edgename == "n") { return NORTH_HORIZONTAL; - } else if(edgename == "w") { + } else if (edgename == "w") { return WEST_HORIZONTAL; - } else if(edgename == "s") { + } else if (edgename == "s") { return SOUTH_HORIZONTAL; - } else if(edgename == "e") { + } else if (edgename == "e") { return EAST_HORIZONTAL; - } else if(edgename == "cnw") { + } else if (edgename == "cnw") { return NORTHWEST_CORNER; - } else if(edgename == "cne") { + } else if (edgename == "cne") { return NORTHEAST_CORNER; - } else if(edgename == "csw") { + } else if (edgename == "csw") { return SOUTHWEST_CORNER; - } else if(edgename == "cse") { + } else if (edgename == "cse") { return SOUTHEAST_CORNER; - } else if(edgename == "dnw") { + } else if (edgename == "dnw") { return NORTHWEST_DIAGONAL; - } else if(edgename == "dne") { + } else if (edgename == "dne") { return NORTHEAST_DIAGONAL; - } else if(edgename == "dsw") { + } else if (edgename == "dsw") { return SOUTHWEST_DIAGONAL; - } else if(edgename == "dse") { + } else if (edgename == "dse") { return SOUTHEAST_DIAGONAL; } return BORDER_NONE; } -bool AutoBorder::load(pugi::xml_node node, wxArrayString& warnings, GroundBrush* owner, uint16_t ground_equivalent) -{ +bool AutoBorder::load(pugi::xml_node node, wxArrayString &warnings, GroundBrush* owner, uint16_t ground_equivalent) { ASSERT(ground ? ground_equivalent != 0 : true); pugi::xml_attribute attribute; bool optionalBorder = false; - if((attribute = node.attribute("type"))) { - if(std::string(attribute.as_string()) == "optional") { + if ((attribute = node.attribute("type"))) { + if (std::string(attribute.as_string()) == "optional") { optionalBorder = true; } } - if((attribute = node.attribute("group"))) { + if ((attribute = node.attribute("group"))) { group = attribute.as_uint(); } - for(pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { - if(!(attribute = childNode.attribute("item"))) { + for (pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { + if (!(attribute = childNode.attribute("item"))) { continue; } uint16_t itemid = attribute.as_uint(); - if(!(attribute = childNode.attribute("edge"))) { + if (!(attribute = childNode.attribute("edge"))) { continue; } - const std::string& orientation = attribute.as_string(); + const std::string &orientation = attribute.as_string(); ItemType* type = g_items.getRawItemType(itemid); - if(!type) { + if (!type) { warnings.push_back("Invalid item ID " + std::to_string(itemid) + " for border " + std::to_string(id)); continue; } - if(ground) { // We are a ground border + if (ground) { // We are a ground border type->group = ITEM_GROUP_NONE; type->ground_equivalent = ground_equivalent; type->brush = owner; @@ -100,14 +98,14 @@ bool AutoBorder::load(pugi::xml_node node, wxArrayString& warnings, GroundBrush* type->alwaysOnBottom = true; // Never-ever place other items under this, will confuse the user something awful. type->isBorder = true; type->isOptionalBorder = type->isOptionalBorder ? true : optionalBorder; - if(group && !type->border_group) { + if (group && !type->border_group) { type->border_group = group; } int32_t edge_id = edgeNameToID(orientation); - if(edge_id != BORDER_NONE) { + if (edge_id != BORDER_NONE) { tiles[edge_id] = itemid; - if(type->border_alignment == BORDER_NONE) { + if (type->border_alignment == BORDER_NONE) { type->border_alignment = ::BorderType(edge_id); } } @@ -124,20 +122,18 @@ GroundBrush::GroundBrush() : optional_border(nullptr), use_only_optional(false), randomize(true), - total_chance(0) -{ + total_chance(0) { //// } -GroundBrush::~GroundBrush() -{ - for(BorderBlock* borderBlock : borders) { - if(borderBlock->autoborder) { - for(SpecificCaseBlock* specificCaseBlock : borderBlock->specific_cases) { +GroundBrush::~GroundBrush() { + for (BorderBlock* borderBlock : borders) { + if (borderBlock->autoborder) { + for (SpecificCaseBlock* specificCaseBlock : borderBlock->specific_cases) { delete specificCaseBlock; } - if(borderBlock->autoborder->ground) { + if (borderBlock->autoborder->ground) { delete borderBlock->autoborder; } } @@ -146,43 +142,42 @@ GroundBrush::~GroundBrush() borders.clear(); } -bool GroundBrush::load(pugi::xml_node node, wxArrayString& warnings) -{ +bool GroundBrush::load(pugi::xml_node node, wxArrayString &warnings) { pugi::xml_attribute attribute; - if((attribute = node.attribute("lookid"))) { + if ((attribute = node.attribute("lookid"))) { look_id = attribute.as_uint(); } - if((attribute = node.attribute("z-order"))) { + if ((attribute = node.attribute("z-order"))) { z_order = attribute.as_int(); } - if((attribute = node.attribute("solo_optional"))) { + if ((attribute = node.attribute("solo_optional"))) { use_only_optional = attribute.as_bool(); } - if((attribute = node.attribute("randomize"))) { + if ((attribute = node.attribute("randomize"))) { randomize = attribute.as_bool(); } - for(pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { - const std::string& childName = as_lower_str(childNode.name()); - if(childName == "item") { + for (pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { + const std::string &childName = as_lower_str(childNode.name()); + if (childName == "item") { uint16_t itemId = childNode.attribute("id").as_uint(); int32_t chance = childNode.attribute("chance").as_int(); ItemType* type = g_items.getRawItemType(itemId); - if(!type) { + if (!type) { warnings.push_back("\nInvalid item id " + std::to_string(itemId)); return false; } - if(!type->isGroundTile()) { + if (!type->isGroundTile()) { warnings.push_back("\nItem " + std::to_string(itemId) + " is not ground item."); return false; } - if(type->brush && type->brush != this) { + if (type->brush && type->brush != this) { warnings.push_back("\nItem " + std::to_string(itemId) + " can not be member of two brushes"); return false; } @@ -194,25 +189,25 @@ bool GroundBrush::load(pugi::xml_node node, wxArrayString& warnings) ci.id = itemId; ci.chance = total_chance; border_items.push_back(ci); - } else if(childName == "optional") { + } else if (childName == "optional") { // Mountain border! - if(optional_border) { + if (optional_border) { warnings.push_back("\nDuplicate optional borders!"); continue; } - if((attribute = childNode.attribute("ground_equivalent"))) { + if ((attribute = childNode.attribute("ground_equivalent"))) { uint16_t ground_equivalent = attribute.as_uint(); // Load from inline definition - const ItemType& type = g_items.getItemType(ground_equivalent); - if(type.id == 0) { + const ItemType &type = g_items.getItemType(ground_equivalent); + if (type.id == 0) { warnings.push_back("Invalid id of ground dependency equivalent item.\n"); continue; - } else if(!type.isGroundTile()) { + } else if (!type.isGroundTile()) { warnings.push_back("Ground dependency equivalent is not a ground item.\n"); continue; - } else if(type.brush && type.brush != this) { + } else if (type.brush && type.brush != this) { warnings.push_back("Ground dependency equivalent does not use the same brush as ground border.\n"); continue; } @@ -222,38 +217,38 @@ bool GroundBrush::load(pugi::xml_node node, wxArrayString& warnings) optional_border = autoBorder; } else { // Load from ID - if(!(attribute = childNode.attribute("id"))) { + if (!(attribute = childNode.attribute("id"))) { warnings.push_back("\nMissing tag id for border node"); continue; } uint16_t id = attribute.as_uint(); auto it = g_brushes.borders.find(id); - if(it == g_brushes.borders.end() || !it->second) { + if (it == g_brushes.borders.end() || !it->second) { warnings.push_back("\nCould not find border id " + std::to_string(id)); continue; } optional_border = it->second; } - } else if(childName == "border") { + } else if (childName == "border") { AutoBorder* autoBorder; - if(!(attribute = childNode.attribute("id"))) { - if(!(attribute = childNode.attribute("ground_equivalent"))) { + if (!(attribute = childNode.attribute("id"))) { + if (!(attribute = childNode.attribute("ground_equivalent"))) { continue; } uint16_t ground_equivalent = attribute.as_uint(); - const ItemType& it = g_items.getItemType(ground_equivalent); - if(it.id == 0) { + const ItemType &it = g_items.getItemType(ground_equivalent); + if (it.id == 0) { warnings.push_back("Invalid id of ground dependency equivalent item.\n"); } - if(!it.isGroundTile()) { + if (!it.isGroundTile()) { warnings.push_back("Ground id " + std::to_string(ground_equivalent) + " dependency equivalent is not a ground item.\n"); } - if(it.brush && it.brush != this) { + if (it.brush && it.brush != this) { warnings.push_back("Ground dependency equivalent does not use the same brush as ground border.\n"); } @@ -261,11 +256,11 @@ bool GroundBrush::load(pugi::xml_node node, wxArrayString& warnings) autoBorder->load(childNode, warnings, this, ground_equivalent); } else { int32_t id = attribute.as_int(); - if(id == 0) { + if (id == 0) { autoBorder = nullptr; } else { auto it = g_brushes.borders.find(id); - if(it == g_brushes.borders.end() || !it->second) { + if (it == g_brushes.borders.end() || !it->second) { warnings.push_back("\nCould not find border id " + std::to_string(id)); continue; } @@ -277,15 +272,15 @@ bool GroundBrush::load(pugi::xml_node node, wxArrayString& warnings) borderBlock->super = false; borderBlock->autoborder = autoBorder; - if((attribute = childNode.attribute("to"))) { - const std::string& value = attribute.as_string(); - if(value == "all") { + if ((attribute = childNode.attribute("to"))) { + const std::string &value = attribute.as_string(); + if (value == "all") { borderBlock->to = 0xFFFFFFFF; - } else if(value == "none") { + } else if (value == "none") { borderBlock->to = 0; } else { Brush* tobrush = g_brushes.getBrush(value); - if(!tobrush) { + if (!tobrush) { warnings.push_back("To brush " + wxstr(value) + " doesn't exist."); continue; } @@ -295,59 +290,59 @@ bool GroundBrush::load(pugi::xml_node node, wxArrayString& warnings) borderBlock->to = 0xFFFFFFFF; } - if((attribute = childNode.attribute("super")) && attribute.as_bool()) { + if ((attribute = childNode.attribute("super")) && attribute.as_bool()) { borderBlock->super = true; } - if((attribute = childNode.attribute("align"))) { - const std::string& value = attribute.as_string(); - if(value == "outer") { + if ((attribute = childNode.attribute("align"))) { + const std::string &value = attribute.as_string(); + if (value == "outer") { borderBlock->outer = true; - } else if(value == "inner") { + } else if (value == "inner") { borderBlock->outer = false; } else { borderBlock->outer = true; } } - if(borderBlock->outer) { - if(borderBlock->to == 0) { + if (borderBlock->outer) { + if (borderBlock->to == 0) { has_zilch_outer_border = true; } else { has_outer_border = true; } } else { - if(borderBlock->to == 0) { + if (borderBlock->to == 0) { has_zilch_inner_border = true; } else { has_inner_border = true; } } - for(pugi::xml_node subChildNode = childNode.first_child(); subChildNode; subChildNode = subChildNode.next_sibling()) { - if(as_lower_str(subChildNode.name()) != "specific") { + for (pugi::xml_node subChildNode = childNode.first_child(); subChildNode; subChildNode = subChildNode.next_sibling()) { + if (as_lower_str(subChildNode.name()) != "specific") { continue; } SpecificCaseBlock* specificCaseBlock = nullptr; - for(pugi::xml_node superChildNode = subChildNode.first_child(); superChildNode; superChildNode = superChildNode.next_sibling()) { - const std::string& superChildName = as_lower_str(superChildNode.name()); - if(superChildName == "conditions") { - for(pugi::xml_node conditionChild = superChildNode.first_child(); conditionChild; conditionChild = conditionChild.next_sibling()) { - const std::string& conditionName = as_lower_str(conditionChild.name()); - if(conditionName == "match_border") { - if(!(attribute = conditionChild.attribute("id"))) { + for (pugi::xml_node superChildNode = subChildNode.first_child(); superChildNode; superChildNode = superChildNode.next_sibling()) { + const std::string &superChildName = as_lower_str(superChildNode.name()); + if (superChildName == "conditions") { + for (pugi::xml_node conditionChild = superChildNode.first_child(); conditionChild; conditionChild = conditionChild.next_sibling()) { + const std::string &conditionName = as_lower_str(conditionChild.name()); + if (conditionName == "match_border") { + if (!(attribute = conditionChild.attribute("id"))) { continue; } int32_t border_id = attribute.as_int(); - if(!(attribute = conditionChild.attribute("edge"))) { + if (!(attribute = conditionChild.attribute("edge"))) { continue; } int32_t edge_id = AutoBorder::edgeNameToID(attribute.as_string()); auto it = g_brushes.borders.find(border_id); - if(it == g_brushes.borders.end()) { + if (it == g_brushes.borders.end()) { warnings.push_back("Unknown border id in specific case match block " + std::to_string(border_id)); continue; } @@ -356,35 +351,35 @@ bool GroundBrush::load(pugi::xml_node node, wxArrayString& warnings) ASSERT(autoBorder != nullptr); uint32_t match_itemid = autoBorder->tiles[edge_id]; - if(!specificCaseBlock) { + if (!specificCaseBlock) { specificCaseBlock = newd SpecificCaseBlock(); } specificCaseBlock->items_to_match.push_back(match_itemid); - } else if(conditionName == "match_group") { - if(!(attribute = conditionChild.attribute("group"))) { + } else if (conditionName == "match_group") { + if (!(attribute = conditionChild.attribute("group"))) { continue; } uint16_t group = attribute.as_uint(); - if(!(attribute = conditionChild.attribute("edge"))) { + if (!(attribute = conditionChild.attribute("edge"))) { continue; } int32_t edge_id = AutoBorder::edgeNameToID(attribute.as_string()); - if(!specificCaseBlock) { + if (!specificCaseBlock) { specificCaseBlock = newd SpecificCaseBlock(); } specificCaseBlock->match_group = group; specificCaseBlock->group_match_alignment = ::BorderType(edge_id); specificCaseBlock->items_to_match.push_back(group); - } else if(conditionName == "match_item") { - if(!(attribute = conditionChild.attribute("id"))) { + } else if (conditionName == "match_item") { + if (!(attribute = conditionChild.attribute("id"))) { continue; } int32_t match_itemid = attribute.as_int(); - if(!specificCaseBlock) { + if (!specificCaseBlock) { specificCaseBlock = newd SpecificCaseBlock(); } @@ -392,27 +387,27 @@ bool GroundBrush::load(pugi::xml_node node, wxArrayString& warnings) specificCaseBlock->items_to_match.push_back(match_itemid); } } - } else if(superChildName == "actions") { - for(pugi::xml_node actionChild = superChildNode.first_child(); actionChild; actionChild = actionChild.next_sibling()) { - const std::string& actionName = as_lower_str(actionChild.name()); - if(actionName == "replace_border") { - if(!(attribute = actionChild.attribute("id"))) { + } else if (superChildName == "actions") { + for (pugi::xml_node actionChild = superChildNode.first_child(); actionChild; actionChild = actionChild.next_sibling()) { + const std::string &actionName = as_lower_str(actionChild.name()); + if (actionName == "replace_border") { + if (!(attribute = actionChild.attribute("id"))) { continue; } int32_t border_id = attribute.as_int(); - if(!(attribute = actionChild.attribute("edge"))) { + if (!(attribute = actionChild.attribute("edge"))) { continue; } int32_t edge_id = AutoBorder::edgeNameToID(attribute.as_string()); - if(!(attribute = actionChild.attribute("with"))) { + if (!(attribute = actionChild.attribute("with"))) { continue; } int32_t with_id = attribute.as_int(); auto itt = g_brushes.borders.find(border_id); - if(itt == g_brushes.borders.end()) { + if (itt == g_brushes.borders.end()) { warnings.push_back("Unknown border id in specific case match block " + std::to_string(border_id)); continue; } @@ -421,42 +416,42 @@ bool GroundBrush::load(pugi::xml_node node, wxArrayString& warnings) ASSERT(autoBorder != nullptr); ItemType* type = g_items.getRawItemType(with_id); - if(!type) { + if (!type) { return false; } type->isBorder = true; - if(!specificCaseBlock) { + if (!specificCaseBlock) { specificCaseBlock = newd SpecificCaseBlock(); } specificCaseBlock->to_replace_id = autoBorder->tiles[edge_id]; specificCaseBlock->with_id = with_id; - } else if(actionName == "replace_item") { - if(!(attribute = actionChild.attribute("id"))) { + } else if (actionName == "replace_item") { + if (!(attribute = actionChild.attribute("id"))) { continue; } int32_t to_replace_id = attribute.as_int(); - if(!(attribute = actionChild.attribute("with"))) { + if (!(attribute = actionChild.attribute("with"))) { continue; } int32_t with_id = attribute.as_int(); ItemType* type = g_items.getRawItemType(with_id); - if(!type) { + if (!type) { return false; } type->isBorder = true; - if(!specificCaseBlock) { + if (!specificCaseBlock) { specificCaseBlock = newd SpecificCaseBlock(); } specificCaseBlock->to_replace_id = to_replace_id; specificCaseBlock->with_id = with_id; - } else if(actionName == "delete_borders") { - if(!specificCaseBlock) { + } else if (actionName == "delete_borders") { + if (!specificCaseBlock) { specificCaseBlock = newd SpecificCaseBlock(); } specificCaseBlock->delete_all = true; @@ -466,14 +461,14 @@ bool GroundBrush::load(pugi::xml_node node, wxArrayString& warnings) } } borders.push_back(borderBlock); - } else if(childName == "friend") { - const std::string& name = childNode.attribute("name").as_string(); - if(!name.empty()) { - if(name == "all") { + } else if (childName == "friend") { + const std::string &name = childNode.attribute("name").as_string(); + if (!name.empty()) { + if (name == "all") { friends.push_back(0xFFFFFFFF); } else { Brush* brush = g_brushes.getBrush(name); - if(brush) { + if (brush) { friends.push_back(brush->getID()); } else { warnings.push_back("Brush '" + wxstr(name) + "' is not defined."); @@ -481,14 +476,14 @@ bool GroundBrush::load(pugi::xml_node node, wxArrayString& warnings) } } hate_friends = false; - } else if(childName == "enemy") { - const std::string& name = childNode.attribute("name").as_string(); - if(!name.empty()) { - if(name == "all") { + } else if (childName == "enemy") { + const std::string &name = childNode.attribute("name").as_string(); + if (!name.empty()) { + if (name == "all") { friends.push_back(0xFFFFFFFF); } else { Brush* brush = g_brushes.getBrush(name); - if(brush) { + if (brush) { friends.push_back(brush->getID()); } else { warnings.push_back("Brush '" + wxstr(name) + "' is not defined."); @@ -496,70 +491,69 @@ bool GroundBrush::load(pugi::xml_node node, wxArrayString& warnings) } } hate_friends = true; - } else if(childName == "clear_borders") { - for(std::vector::iterator it = borders.begin(); - it != borders.end(); - ++it) - { + } else if (childName == "clear_borders") { + for (std::vector::iterator it = borders.begin(); + it != borders.end(); + ++it) { BorderBlock* bb = *it; - if(bb->autoborder) { - for(std::vector::iterator specific_iter = bb->specific_cases.begin(); specific_iter != bb->specific_cases.end(); ++specific_iter) { + if (bb->autoborder) { + for (std::vector::iterator specific_iter = bb->specific_cases.begin(); specific_iter != bb->specific_cases.end(); ++specific_iter) { delete *specific_iter; } - if(bb->autoborder->ground) { + if (bb->autoborder->ground) { delete bb->autoborder; } } delete bb; } borders.clear(); - } else if(childName == "clear_friends") { + } else if (childName == "clear_friends") { friends.clear(); hate_friends = false; } } - if(total_chance == 0) { + if (total_chance == 0) { randomize = false; } return true; } -void GroundBrush::undraw(BaseMap* map, Tile* tile) -{ +void GroundBrush::undraw(BaseMap* map, Tile* tile) { ASSERT(tile); - if(tile->hasGround() && tile->ground->getGroundBrush() == this) { + if (tile->hasGround() && tile->ground->getGroundBrush() == this) { delete tile->ground; tile->ground = nullptr; } } -void GroundBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void GroundBrush::draw(BaseMap* map, Tile* tile, void* parameter) { ASSERT(tile); - if(border_items.empty()) return; + if (border_items.empty()) { + return; + } - if(parameter != nullptr) { - std::pair& param = *reinterpret_cast* >(parameter); + if (parameter != nullptr) { + std::pair ¶m = *reinterpret_cast*>(parameter); GroundBrush* other = tile->getGroundBrush(); - if(param.first) { // Volatile? :) - if(other != nullptr) { + if (param.first) { // Volatile? :) + if (other != nullptr) { return; } - } else if(other != param.second) { + } else if (other != param.second) { return; } } int chance = random(1, total_chance); uint16_t id = 0; - for(std::vector::const_iterator it = border_items.begin(); it != border_items.end(); ++it) { - if(chance < it->chance) { + for (std::vector::const_iterator it = border_items.begin(); it != border_items.end(); ++it) { + if (chance < it->chance) { id = it->id; break; } } - if(id == 0) { + if (id == 0) { id = border_items.front().id; } @@ -567,78 +561,77 @@ void GroundBrush::draw(BaseMap* map, Tile* tile, void* parameter) } const GroundBrush::BorderBlock* GroundBrush::getBrushTo(GroundBrush* first, GroundBrush* second) { - //printf("Border from %s to %s : ", first->getName().c_str(), second->getName().c_str()); - if(first) { - if(second) { - if(first->getZ() < second->getZ() && second->hasOuterBorder()) { - if(first->hasInnerBorder()) { - for(std::vector::iterator it = first->borders.begin(); it != first->borders.end(); ++it) { + // printf("Border from %s to %s : ", first->getName().c_str(), second->getName().c_str()); + if (first) { + if (second) { + if (first->getZ() < second->getZ() && second->hasOuterBorder()) { + if (first->hasInnerBorder()) { + for (std::vector::iterator it = first->borders.begin(); it != first->borders.end(); ++it) { BorderBlock* bb = *it; - if(bb->outer) { + if (bb->outer) { continue; - } else if(bb->to == second->getID() || bb->to == 0xFFFFFFFF) { - //printf("%d\n", bb->autoborder); + } else if (bb->to == second->getID() || bb->to == 0xFFFFFFFF) { + // printf("%d\n", bb->autoborder); return bb; } } } - for(std::vector::iterator it = second->borders.begin(); it != second->borders.end(); ++it) { + for (std::vector::iterator it = second->borders.begin(); it != second->borders.end(); ++it) { BorderBlock* bb = *it; - if(!bb->outer) { + if (!bb->outer) { continue; - } else if(bb->to == first->getID()) { - //printf("%d\n", bb->autoborder); + } else if (bb->to == first->getID()) { + // printf("%d\n", bb->autoborder); return bb; - } else if(bb->to == 0xFFFFFFFF) { - //printf("%d\n", bb->autoborder); + } else if (bb->to == 0xFFFFFFFF) { + // printf("%d\n", bb->autoborder); return bb; } } - } else if(first->hasInnerBorder()) { - for(std::vector::iterator it = first->borders.begin(); it != first->borders.end(); ++it) { + } else if (first->hasInnerBorder()) { + for (std::vector::iterator it = first->borders.begin(); it != first->borders.end(); ++it) { BorderBlock* bb = *it; - if(bb->outer) { + if (bb->outer) { continue; - } else if(bb->to == second->getID()) { - //printf("%d\n", bb->autoborder); + } else if (bb->to == second->getID()) { + // printf("%d\n", bb->autoborder); return bb; - } else if(bb->to == 0xFFFFFFFF) { - //printf("%d\n", bb->autoborder); + } else if (bb->to == 0xFFFFFFFF) { + // printf("%d\n", bb->autoborder); return bb; } } } - } else if(first->hasInnerZilchBorder()) { - for(std::vector::iterator it = first->borders.begin(); it != first->borders.end(); ++it) { + } else if (first->hasInnerZilchBorder()) { + for (std::vector::iterator it = first->borders.begin(); it != first->borders.end(); ++it) { BorderBlock* bb = *it; - if(bb->outer) { + if (bb->outer) { continue; - } else if(bb->to == 0) { - //printf("%d\n", bb->autoborder); + } else if (bb->to == 0) { + // printf("%d\n", bb->autoborder); return bb; } } } - } else if(second && second->hasOuterZilchBorder()) { - for(std::vector::iterator it = second->borders.begin(); it != second->borders.end(); ++it) { + } else if (second && second->hasOuterZilchBorder()) { + for (std::vector::iterator it = second->borders.begin(); it != second->borders.end(); ++it) { BorderBlock* bb = *it; - if(!bb->outer) { + if (!bb->outer) { continue; - } else if(bb->to == 0) { - //printf("%d\n", bb->autoborder); + } else if (bb->to == 0) { + // printf("%d\n", bb->autoborder); return bb; } } } - //printf("None\n"); + // printf("None\n"); return nullptr; } -void GroundBrush::doBorders(BaseMap* map, Tile* tile) -{ +void GroundBrush::doBorders(BaseMap* map, Tile* tile) { static const auto extractGroundBrushFromTile = [](BaseMap* map, uint32_t x, uint32_t y, uint32_t z) -> GroundBrush* { Tile* tile = map->getTile(x, y, z); - if(tile) { + if (tile) { return tile->getGroundBrush(); } return nullptr; @@ -647,13 +640,13 @@ void GroundBrush::doBorders(BaseMap* map, Tile* tile) ASSERT(tile); GroundBrush* borderBrush; - if(tile->ground) { + if (tile->ground) { borderBrush = tile->ground->getGroundBrush(); } else { borderBrush = nullptr; } - const Position& position = tile->getPosition(); + const Position &position = tile->getPosition(); uint32_t x = position.x; uint32_t y = position.y; @@ -661,43 +654,43 @@ void GroundBrush::doBorders(BaseMap* map, Tile* tile) // Pair of visited / what border type std::pair neighbours[8]; - if(x == 0) { - if(y == 0) { + if (x == 0) { + if (y == 0) { neighbours[0] = { false, nullptr }; neighbours[1] = { false, nullptr }; neighbours[2] = { false, nullptr }; neighbours[3] = { false, nullptr }; - neighbours[4] = { false, extractGroundBrushFromTile(map, x + 1, y, z) }; + neighbours[4] = { false, extractGroundBrushFromTile(map, x + 1, y, z) }; neighbours[5] = { false, nullptr }; - neighbours[6] = { false, extractGroundBrushFromTile(map, x, y + 1, z) }; + neighbours[6] = { false, extractGroundBrushFromTile(map, x, y + 1, z) }; neighbours[7] = { false, extractGroundBrushFromTile(map, x + 1, y + 1, z) }; } else { neighbours[0] = { false, nullptr }; - neighbours[1] = { false, extractGroundBrushFromTile(map, x, y - 1, z) }; + neighbours[1] = { false, extractGroundBrushFromTile(map, x, y - 1, z) }; neighbours[2] = { false, extractGroundBrushFromTile(map, x + 1, y - 1, z) }; neighbours[3] = { false, nullptr }; - neighbours[4] = { false, extractGroundBrushFromTile(map, x + 1, y, z) }; + neighbours[4] = { false, extractGroundBrushFromTile(map, x + 1, y, z) }; neighbours[5] = { false, nullptr }; - neighbours[6] = { false, extractGroundBrushFromTile(map, x, y + 1, z) }; + neighbours[6] = { false, extractGroundBrushFromTile(map, x, y + 1, z) }; neighbours[7] = { false, extractGroundBrushFromTile(map, x + 1, y + 1, z) }; } - } else if(y == 0) { + } else if (y == 0) { neighbours[0] = { false, nullptr }; neighbours[1] = { false, nullptr }; neighbours[2] = { false, nullptr }; - neighbours[3] = { false, extractGroundBrushFromTile(map, x - 1, y, z) }; - neighbours[4] = { false, extractGroundBrushFromTile(map, x + 1, y, z) }; + neighbours[3] = { false, extractGroundBrushFromTile(map, x - 1, y, z) }; + neighbours[4] = { false, extractGroundBrushFromTile(map, x + 1, y, z) }; neighbours[5] = { false, extractGroundBrushFromTile(map, x - 1, y + 1, z) }; - neighbours[6] = { false, extractGroundBrushFromTile(map, x, y + 1, z) }; + neighbours[6] = { false, extractGroundBrushFromTile(map, x, y + 1, z) }; neighbours[7] = { false, extractGroundBrushFromTile(map, x + 1, y + 1, z) }; } else { neighbours[0] = { false, extractGroundBrushFromTile(map, x - 1, y - 1, z) }; - neighbours[1] = { false, extractGroundBrushFromTile(map, x, y - 1, z) }; + neighbours[1] = { false, extractGroundBrushFromTile(map, x, y - 1, z) }; neighbours[2] = { false, extractGroundBrushFromTile(map, x + 1, y - 1, z) }; - neighbours[3] = { false, extractGroundBrushFromTile(map, x - 1, y, z) }; - neighbours[4] = { false, extractGroundBrushFromTile(map, x + 1, y, z) }; + neighbours[3] = { false, extractGroundBrushFromTile(map, x - 1, y, z) }; + neighbours[4] = { false, extractGroundBrushFromTile(map, x + 1, y, z) }; neighbours[5] = { false, extractGroundBrushFromTile(map, x - 1, y + 1, z) }; - neighbours[6] = { false, extractGroundBrushFromTile(map, x, y + 1, z) }; + neighbours[6] = { false, extractGroundBrushFromTile(map, x, y + 1, z) }; neighbours[7] = { false, extractGroundBrushFromTile(map, x + 1, y + 1, z) }; } @@ -705,69 +698,69 @@ void GroundBrush::doBorders(BaseMap* map, Tile* tile) specificList.clear(); std::vector borderList; - for(int32_t i = 0; i < 8; ++i) { - auto& neighbourPair = neighbours[i]; - if(neighbourPair.first) { + for (int32_t i = 0; i < 8; ++i) { + auto &neighbourPair = neighbours[i]; + if (neighbourPair.first) { continue; } - //printf("Checking neighbour #%d\n", i); - //printf("\tNeighbour not checked before\n"); + // printf("Checking neighbour #%d\n", i); + // printf("\tNeighbour not checked before\n"); GroundBrush* other = neighbourPair.second; - if(borderBrush) { - if(other) { - //printf("\tNeighbour has brush\n"); - if(other->getID() == borderBrush->getID()) { - //printf("\tNeighbour has same brush as we\n"); + if (borderBrush) { + if (other) { + // printf("\tNeighbour has brush\n"); + if (other->getID() == borderBrush->getID()) { + // printf("\tNeighbour has same brush as we\n"); continue; } - if(other->hasOuterBorder() || borderBrush->hasInnerBorder()) { + if (other->hasOuterBorder() || borderBrush->hasInnerBorder()) { bool only_mountain = false; - if(/*!borderBrush->hasInnerBorder() && */(other->friendOf(borderBrush) || borderBrush->friendOf(other))) { - if(!other->hasOptionalBorder()) { + if (/*!borderBrush->hasInnerBorder() && */ (other->friendOf(borderBrush) || borderBrush->friendOf(other))) { + if (!other->hasOptionalBorder()) { continue; } only_mountain = true; } uint32_t tiledata = 0; - for(int32_t j = i; j < 8; ++j) { - auto& otherPair = neighbours[j]; - if(!otherPair.first && otherPair.second && otherPair.second->getID() == other->getID()) { + for (int32_t j = i; j < 8; ++j) { + auto &otherPair = neighbours[j]; + if (!otherPair.first && otherPair.second && otherPair.second->getID() == other->getID()) { otherPair.first = true; tiledata |= 1 << j; } } - if(tiledata != 0) { + if (tiledata != 0) { // Add mountain if appropriate! - if(other->hasOptionalBorder() && tile->hasOptionalBorder()) { + if (other->hasOptionalBorder() && tile->hasOptionalBorder()) { BorderCluster borderCluster; borderCluster.alignment = tiledata; borderCluster.z = 0x7FFFFFFF; // Above all other borders borderCluster.border = other->optional_border; borderList.push_back(borderCluster); - if(other->useSoloOptionalBorder()) { + if (other->useSoloOptionalBorder()) { only_mountain = true; } } - if(!only_mountain) { + if (!only_mountain) { const BorderBlock* borderBlock = getBrushTo(borderBrush, other); - if(borderBlock) { + if (borderBlock) { bool found = false; - for(BorderCluster& borderCluster : borderList) { - if(borderCluster.border == borderBlock->autoborder) { + for (BorderCluster &borderCluster : borderList) { + if (borderCluster.border == borderBlock->autoborder) { borderCluster.alignment |= tiledata; - if(borderCluster.z < other->getZ()) { + if (borderCluster.z < other->getZ()) { borderCluster.z = other->getZ(); } - if(!borderBlock->specific_cases.empty()) { - if(std::find(specificList.begin(), specificList.end(), borderBlock) == specificList.end()) { + if (!borderBlock->specific_cases.empty()) { + if (std::find(specificList.begin(), specificList.end(), borderBlock) == specificList.end()) { specificList.push_back(borderBlock); } } @@ -777,15 +770,15 @@ void GroundBrush::doBorders(BaseMap* map, Tile* tile) } } - if(!found) { + if (!found) { BorderCluster borderCluster; borderCluster.alignment = tiledata; borderCluster.z = other->getZ(); borderCluster.border = borderBlock->autoborder; borderList.push_back(borderCluster); - if(!borderBlock->specific_cases.empty()) { - if(std::find(specificList.begin(), specificList.end(), borderBlock) == specificList.end()) { + if (!borderBlock->specific_cases.empty()) { + if (std::find(specificList.begin(), specificList.end(), borderBlock) == specificList.end()) { specificList.push_back(borderBlock); } } @@ -794,24 +787,24 @@ void GroundBrush::doBorders(BaseMap* map, Tile* tile) } } } - } else if(borderBrush->hasInnerZilchBorder()) { + } else if (borderBrush->hasInnerZilchBorder()) { // Border against nothing (or undefined tile) uint32_t tiledata = 0; - for(int32_t j = i; j < 8; ++j) { - auto& otherPair = neighbours[j]; - if(!otherPair.first && !otherPair.second) { + for (int32_t j = i; j < 8; ++j) { + auto &otherPair = neighbours[j]; + if (!otherPair.first && !otherPair.second) { otherPair.first = true; tiledata |= 1 << j; } } - if(tiledata != 0) { + if (tiledata != 0) { const BorderBlock* borderBlock = getBrushTo(borderBrush, nullptr); - if(!borderBlock) { + if (!borderBlock) { continue; } - if(borderBlock->autoborder) { + if (borderBlock->autoborder) { BorderCluster borderCluster; borderCluster.alignment = tiledata; borderCluster.z = 5000; @@ -820,29 +813,29 @@ void GroundBrush::doBorders(BaseMap* map, Tile* tile) borderList.push_back(borderCluster); } - if(!borderBlock->specific_cases.empty()) { - if(std::find(specificList.begin(), specificList.end(), borderBlock) == specificList.end()) { + if (!borderBlock->specific_cases.empty()) { + if (std::find(specificList.begin(), specificList.end(), borderBlock) == specificList.end()) { specificList.push_back(borderBlock); } } } continue; } - } else if(other && other->hasOuterZilchBorder()) { + } else if (other && other->hasOuterZilchBorder()) { // Border against nothing (or undefined tile) uint32_t tiledata = 0; - for(int32_t j = i; j < 8; ++j) { - auto& otherPair = neighbours[j]; - if(!otherPair.first && otherPair.second && otherPair.second->getID() == other->getID()) { + for (int32_t j = i; j < 8; ++j) { + auto &otherPair = neighbours[j]; + if (!otherPair.first && otherPair.second && otherPair.second->getID() == other->getID()) { otherPair.first = true; tiledata |= 1 << j; } } - if(tiledata != 0) { + if (tiledata != 0) { const BorderBlock* borderBlock = getBrushTo(nullptr, other); - if(borderBlock) { - if(borderBlock->autoborder) { + if (borderBlock) { + if (borderBlock->autoborder) { BorderCluster borderCluster; borderCluster.alignment = tiledata; borderCluster.z = other->getZ(); @@ -851,15 +844,15 @@ void GroundBrush::doBorders(BaseMap* map, Tile* tile) borderList.push_back(borderCluster); } - if(!borderBlock->specific_cases.empty()) { - if(std::find(specificList.begin(), specificList.end(), borderBlock) == specificList.end()) { + if (!borderBlock->specific_cases.empty()) { + if (std::find(specificList.begin(), specificList.end(), borderBlock) == specificList.end()) { specificList.push_back(borderBlock); } } } // Add mountain if appropriate! - if(other->hasOptionalBorder() && tile->hasOptionalBorder()) { + if (other->hasOptionalBorder() && tile->hasOptionalBorder()) { BorderCluster borderCluster; borderCluster.alignment = tiledata; borderCluster.z = 0x7FFFFFFF; // Above other zilch borders @@ -878,9 +871,9 @@ void GroundBrush::doBorders(BaseMap* map, Tile* tile) std::sort(borderList.begin(), borderList.end()); tile->cleanBorders(); - while(!borderList.empty()) { - BorderCluster& borderCluster = borderList.back(); - if(!borderCluster.border) { + while (!borderList.empty()) { + BorderCluster &borderCluster = borderList.back(); + if (!borderCluster.border) { borderList.pop_back(); continue; } @@ -892,25 +885,25 @@ void GroundBrush::doBorders(BaseMap* map, Tile* tile) static_cast((border_types[borderCluster.alignment] & 0xFF000000) >> 24) }; - for(int32_t i = 0; i < 4; ++i) { + for (int32_t i = 0; i < 4; ++i) { BorderType direction = directions[i]; - if(direction == BORDER_NONE) { + if (direction == BORDER_NONE) { break; } - if(borderCluster.border->tiles[direction]) { + if (borderCluster.border->tiles[direction]) { tile->addBorderItem(Item::Create(borderCluster.border->tiles[direction])); } else { - if(direction == NORTHWEST_DIAGONAL) { + if (direction == NORTHWEST_DIAGONAL) { tile->addBorderItem(Item::Create(borderCluster.border->tiles[WEST_HORIZONTAL])); tile->addBorderItem(Item::Create(borderCluster.border->tiles[NORTH_HORIZONTAL])); - } else if(direction == NORTHEAST_DIAGONAL) { + } else if (direction == NORTHEAST_DIAGONAL) { tile->addBorderItem(Item::Create(borderCluster.border->tiles[EAST_HORIZONTAL])); tile->addBorderItem(Item::Create(borderCluster.border->tiles[NORTH_HORIZONTAL])); - } else if(direction == SOUTHWEST_DIAGONAL) { + } else if (direction == SOUTHWEST_DIAGONAL) { tile->addBorderItem(Item::Create(borderCluster.border->tiles[SOUTH_HORIZONTAL])); tile->addBorderItem(Item::Create(borderCluster.border->tiles[WEST_HORIZONTAL])); - } else if(direction == SOUTHEAST_DIAGONAL) { + } else if (direction == SOUTHEAST_DIAGONAL) { tile->addBorderItem(Item::Create(borderCluster.border->tiles[SOUTH_HORIZONTAL])); tile->addBorderItem(Item::Create(borderCluster.border->tiles[EAST_HORIZONTAL])); } @@ -920,8 +913,8 @@ void GroundBrush::doBorders(BaseMap* map, Tile* tile) borderList.pop_back(); } - for(const BorderBlock* borderBlock : specificList) { - for(const SpecificCaseBlock* specificCaseBlock : borderBlock->specific_cases) { + for (const BorderBlock* borderBlock : specificList) { + for (const SpecificCaseBlock* specificCaseBlock : borderBlock->specific_cases) { /* printf("New round\n"); if(specificCaseBlock->to_replace_id == 0) { @@ -933,44 +926,44 @@ void GroundBrush::doBorders(BaseMap* map, Tile* tile) } */ uint32_t matches = 0; - for(Item* item : tile->items) { - if(!item->isBorder()) { + for (Item* item : tile->items) { + if (!item->isBorder()) { break; } - if(specificCaseBlock->match_group > 0) { - //printf("Matching %d == %d : %d == %d\n", item->getBorderGroup(), specificCaseBlock->match_group, item->getBorderAlignment(), specificCaseBlock->group_match_alignment); - if(item->getBorderGroup() == specificCaseBlock->match_group && item->getBorderAlignment() == specificCaseBlock->group_match_alignment) { - //printf("Successfully matched %d == %d : %d == %d\n", item->getBorderGroup(), specificCaseBlock->match_group, item->getBorderAlignment(), specificCaseBlock->group_match_alignment); + if (specificCaseBlock->match_group > 0) { + // printf("Matching %d == %d : %d == %d\n", item->getBorderGroup(), specificCaseBlock->match_group, item->getBorderAlignment(), specificCaseBlock->group_match_alignment); + if (item->getBorderGroup() == specificCaseBlock->match_group && item->getBorderAlignment() == specificCaseBlock->group_match_alignment) { + // printf("Successfully matched %d == %d : %d == %d\n", item->getBorderGroup(), specificCaseBlock->match_group, item->getBorderAlignment(), specificCaseBlock->group_match_alignment); ++matches; continue; } } - //printf("\tInvestigating first item id:%d\n", item->getID()); - for(uint16_t matchId : specificCaseBlock->items_to_match) { - if(item->getID() == matchId) { - //printf("\t\tMatched item id %d\n", item->getID()); + // printf("\tInvestigating first item id:%d\n", item->getID()); + for (uint16_t matchId : specificCaseBlock->items_to_match) { + if (item->getID() == matchId) { + // printf("\t\tMatched item id %d\n", item->getID()); ++matches; } } } - //printf("\t\t%d matches of %d\n", matches, scb->items_to_match.size()); - if(matches == specificCaseBlock->items_to_match.size()) { - auto& tileItems = tile->items; + // printf("\t\t%d matches of %d\n", matches, scb->items_to_match.size()); + if (matches == specificCaseBlock->items_to_match.size()) { + auto &tileItems = tile->items; auto it = tileItems.begin(); - if(specificCaseBlock->delete_all) { + if (specificCaseBlock->delete_all) { // Delete all matching borders - while(it != tileItems.end()) { + while (it != tileItems.end()) { Item* item = *it; - if(!item->isBorder()) { + if (!item->isBorder()) { break; } bool inc = true; - for(uint16_t matchId : specificCaseBlock->items_to_match) { - if(item->getID() == matchId) { + for (uint16_t matchId : specificCaseBlock->items_to_match) { + if (item->getID() == matchId) { delete item; it = tileItems.erase(it); inc = false; @@ -978,19 +971,19 @@ void GroundBrush::doBorders(BaseMap* map, Tile* tile) } } - if(inc) { + if (inc) { ++it; } } } else { // All matched, replace! - while(it != tileItems.end()) { + while (it != tileItems.end()) { Item* item = *it; - if(!item->isBorder()) { + if (!item->isBorder()) { return; } - if(item->getID() == specificCaseBlock->to_replace_id) { + if (item->getID() == specificCaseBlock->to_replace_id) { item->setID(specificCaseBlock->with_id); return; } diff --git a/source/ground_brush.h b/source/ground_brush.h index 64c7b69b..38673bea 100644 --- a/source/ground_brush.h +++ b/source/ground_brush.h @@ -22,8 +22,7 @@ //============================================================================= -class GroundBrush : public TerrainBrush -{ +class GroundBrush : public TerrainBrush { protected: struct BorderBlock; @@ -33,25 +32,45 @@ class GroundBrush : public TerrainBrush GroundBrush(); virtual ~GroundBrush(); - bool isGround() const { return true; } - GroundBrush* asGround() { return static_cast(this); } + bool isGround() const { + return true; + } + GroundBrush* asGround() { + return static_cast(this); + } - virtual bool load(pugi::xml_node node, wxArrayString& warnings); + virtual bool load(pugi::xml_node node, wxArrayString &warnings); virtual void draw(BaseMap* map, Tile* tile, void* parameter); virtual void undraw(BaseMap* map, Tile* tile); static void doBorders(BaseMap* map, Tile* tile); static const BorderBlock* getBrushTo(GroundBrush* first, GroundBrush* second); - virtual int32_t getZ() const { return z_order; } - bool useSoloOptionalBorder() const { return use_only_optional; } - bool isReRandomizable() const { return randomize; } - - bool hasOuterZilchBorder() const { return has_zilch_outer_border || optional_border; } - bool hasInnerZilchBorder() const { return has_zilch_inner_border; } - bool hasOuterBorder() const { return has_outer_border || optional_border; } - bool hasInnerBorder() const { return has_inner_border; } - bool hasOptionalBorder() const { return optional_border != nullptr; } + virtual int32_t getZ() const { + return z_order; + } + bool useSoloOptionalBorder() const { + return use_only_optional; + } + bool isReRandomizable() const { + return randomize; + } + + bool hasOuterZilchBorder() const { + return has_zilch_outer_border || optional_border; + } + bool hasInnerZilchBorder() const { + return has_zilch_inner_border; + } + bool hasOuterBorder() const { + return has_outer_border || optional_border; + } + bool hasInnerBorder() const { + return has_inner_border; + } + bool hasOptionalBorder() const { + return optional_border != nullptr; + } protected: // Members int32_t z_order; @@ -64,7 +83,8 @@ class GroundBrush : public TerrainBrush bool randomize; struct SpecificCaseBlock { - SpecificCaseBlock() : match_group(0), group_match_alignment(BORDER_NONE), to_replace_id(0), with_id(0), delete_all(false) {} + SpecificCaseBlock() : + match_group(0), group_match_alignment(BORDER_NONE), to_replace_id(0), with_id(0), delete_all(false) { } std::vector items_to_match; uint32_t match_group; BorderType group_match_alignment; @@ -92,7 +112,7 @@ class GroundBrush : public TerrainBrush int32_t z; const AutoBorder* border; - bool operator<(const BorderCluster& other) const { + bool operator<(const BorderCluster &other) const { return other.z > z; } }; diff --git a/source/gui.cpp b/source/gui.cpp index 10ee7dbe..a1e044aa 100644 --- a/source/gui.cpp +++ b/source/gui.cpp @@ -43,7 +43,7 @@ #include "live_server.h" #ifdef __WXOSX__ -#include + #include #endif const wxEventType EVT_UPDATE_MENUS = wxNewEventType(); @@ -92,45 +92,41 @@ GUI::GUI() : use_custom_thickness(false), custom_thickness_mod(0.0), progressBar(nullptr), - disabled_counter(0) -{ + disabled_counter(0) { doodad_buffer_map = newd BaseMap(); } -GUI::~GUI() -{ +GUI::~GUI() { delete doodad_buffer_map; delete g_gui.aui_manager; delete OGLContext; } -wxGLContext* GUI::GetGLContext(wxGLCanvas* win) -{ - if(OGLContext == nullptr) { +wxGLContext* GUI::GetGLContext(wxGLCanvas* win) { + if (OGLContext == nullptr) { #ifdef __WXOSX__ - /* - wxGLContext(AGLPixelFormat fmt, wxGLCanvas *win, - const wxPalette& WXUNUSED(palette), - const wxGLContext *other - ); - */ + /* + wxGLContext(AGLPixelFormat fmt, wxGLCanvas *win, + const wxPalette& WXUNUSED(palette), + const wxGLContext *other + ); + */ OGLContext = new wxGLContext(win, nullptr); #else OGLContext = newd wxGLContext(win); #endif - } + } return OGLContext; } -wxString GUI::GetDataDirectory() -{ +wxString GUI::GetDataDirectory() { std::string cfg_str = g_settings.getString(Config::DATA_DIRECTORY); - if(!cfg_str.empty()) { + if (!cfg_str.empty()) { FileName dir; dir.Assign(wxstr(cfg_str)); wxString path; - if(dir.DirExists()) { + if (dir.DirExists()) { path = dir.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR); return path; } @@ -138,12 +134,9 @@ wxString GUI::GetDataDirectory() // Silently reset directory FileName exec_directory; - try - { - exec_directory = dynamic_cast(wxStandardPaths::Get()).GetExecutablePath(); - } - catch(const std::bad_cast&) - { + try { + exec_directory = dynamic_cast(wxStandardPaths::Get()).GetExecutablePath(); + } catch (const std::bad_cast &) { throw; // Crash application (this should never happend anyways...) } @@ -151,31 +144,27 @@ wxString GUI::GetDataDirectory() return exec_directory.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR); } -wxString GUI::GetExecDirectory() -{ +wxString GUI::GetExecDirectory() { // Silently reset directory FileName exec_directory; - try - { - exec_directory = dynamic_cast(wxStandardPaths::Get()).GetExecutablePath(); - } - catch(const std::bad_cast&) - { + try { + exec_directory = dynamic_cast(wxStandardPaths::Get()).GetExecutablePath(); + } catch (const std::bad_cast &) { wxLogError("Could not fetch executable directory."); } return exec_directory.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR); } -wxString GUI::GetLocalDataDirectory() -{ - if(g_settings.getInteger(Config::INDIRECTORY_INSTALLATION)) { +wxString GUI::GetLocalDataDirectory() { + if (g_settings.getInteger(Config::INDIRECTORY_INSTALLATION)) { FileName dir = GetDataDirectory(); dir.AppendDir("user"); dir.AppendDir("data"); dir.Mkdir(0755, wxPATH_MKDIR_FULL); - return dir.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);; + return dir.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR); + ; } else { - FileName dir = dynamic_cast(wxStandardPaths::Get()).GetUserDataDir(); + FileName dir = dynamic_cast(wxStandardPaths::Get()).GetUserDataDir(); #ifdef __WINDOWS__ dir.AppendDir("Remere's Map Editor"); #else @@ -187,15 +176,15 @@ wxString GUI::GetLocalDataDirectory() } } -wxString GUI::GetLocalDirectory() -{ - if(g_settings.getInteger(Config::INDIRECTORY_INSTALLATION)) { +wxString GUI::GetLocalDirectory() { + if (g_settings.getInteger(Config::INDIRECTORY_INSTALLATION)) { FileName dir = GetDataDirectory(); dir.AppendDir("user"); dir.Mkdir(0755, wxPATH_MKDIR_FULL); - return dir.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);; + return dir.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR); + ; } else { - FileName dir = dynamic_cast(wxStandardPaths::Get()).GetUserDataDir(); + FileName dir = dynamic_cast(wxStandardPaths::Get()).GetUserDataDir(); #ifdef __WINDOWS__ dir.AppendDir("Remere's Map Editor"); #else @@ -206,14 +195,13 @@ wxString GUI::GetLocalDirectory() } } -wxString GUI::GetExtensionsDirectory() -{ +wxString GUI::GetExtensionsDirectory() { std::string cfg_str = g_settings.getString(Config::EXTENSIONS_DIRECTORY); - if(!cfg_str.empty()) { + if (!cfg_str.empty()) { FileName dir; dir.Assign(wxstr(cfg_str)); wxString path; - if(dir.DirExists()) { + if (dir.DirExists()) { path = dir.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR); return path; } @@ -226,8 +214,7 @@ wxString GUI::GetExtensionsDirectory() return local_directory.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR); } -void GUI::discoverDataDirectory(const wxString& existentFile) -{ +void GUI::discoverDataDirectory(const wxString &existentFile) { wxString currentDir = wxGetCwd(); wxString execDir = GetExecDirectory(); @@ -243,29 +230,30 @@ void GUI::discoverDataDirectory(const wxString& existentFile) }; bool found = false; - for(const wxString& path : possiblePaths) { - if(wxFileName(path + "data/" + existentFile).FileExists()) { + for (const wxString &path : possiblePaths) { + if (wxFileName(path + "data/" + existentFile).FileExists()) { m_dataDirectory = path + "data/"; found = true; break; } } - if(!found) + if (!found) { wxLogError(wxString() + "Could not find data directory.\n"); + } } -bool GUI::LoadVersion(ClientVersionID version, wxString& error, wxArrayString& warnings, bool force) -{ - if(ClientVersion::get(version) == nullptr) { +bool GUI::LoadVersion(ClientVersionID version, wxString &error, wxArrayString &warnings, bool force) { + if (ClientVersion::get(version) == nullptr) { error = "Unsupported client version! (8)"; return false; } - if(version != loaded_version || force) { - if(getLoadedVersion() != nullptr) + if (version != loaded_version || force) { + if (getLoadedVersion() != nullptr) { // There is another version loaded right now, save window layout g_gui.SavePerspective(); + } // Disable all rendering so the data is not accessed while reloading UnnamedRenderingLock(); @@ -276,8 +264,8 @@ bool GUI::LoadVersion(ClientVersionID version, wxString& error, wxArrayString& w UnloadVersion(); loaded_version = version; - if(!getLoadedVersion()->hasValidPaths()) { - if(!getLoadedVersion()->loadValidPaths()) { + if (!getLoadedVersion()->hasValidPaths()) { + if (!getLoadedVersion()->loadValidPaths()) { error = "Couldn't load relevant asset files"; loaded_version = CLIENT_VERSION_NONE; return false; @@ -285,70 +273,61 @@ bool GUI::LoadVersion(ClientVersionID version, wxString& error, wxArrayString& w } bool ret = LoadDataFiles(error, warnings); - if(ret) + if (ret) { g_gui.LoadPerspective(); - else + } else { loaded_version = CLIENT_VERSION_NONE; + } return ret; } return true; } -void GUI::EnableHotkeys() -{ +void GUI::EnableHotkeys() { hotkeys_enabled = true; } -void GUI::DisableHotkeys() -{ +void GUI::DisableHotkeys() { hotkeys_enabled = false; } -bool GUI::AreHotkeysEnabled() const -{ +bool GUI::AreHotkeysEnabled() const { return hotkeys_enabled; } -ClientVersionID GUI::GetCurrentVersionID() const -{ - if(loaded_version != CLIENT_VERSION_NONE) { +ClientVersionID GUI::GetCurrentVersionID() const { + if (loaded_version != CLIENT_VERSION_NONE) { return getLoadedVersion()->getID(); } return CLIENT_VERSION_NONE; } -const ClientVersion& GUI::GetCurrentVersion() const -{ +const ClientVersion &GUI::GetCurrentVersion() const { assert(loaded_version); return *getLoadedVersion(); } -void GUI::CycleTab(bool forward) -{ +void GUI::CycleTab(bool forward) { tabbook->CycleTab(forward); } -bool GUI::LoadDataFiles(wxString& error, wxArrayString& warnings) -{ +bool GUI::LoadDataFiles(wxString &error, wxArrayString &warnings) { FileName data_path = getLoadedVersion()->getDataPath(); FileName client_path = getLoadedVersion()->getClientPath(); FileName extension_path = GetExtensionsDirectory(); FileName exec_directory; - try - { - exec_directory = dynamic_cast(wxStandardPaths::Get()).GetExecutablePath(); - } - catch(std::bad_cast&) - { + try { + exec_directory = dynamic_cast(wxStandardPaths::Get()).GetExecutablePath(); + } catch (std::bad_cast &) { error = "Couldn't establish working directory..."; return false; } g_gui.gfx.client_version = getLoadedVersion(); - if(!g_gui.gfx.loadOTFI(client_path.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR), error, warnings)) { + if (!g_gui.gfx.loadOTFI(client_path.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR), error, warnings)) { error = "Couldn't load otfi file: " + error; g_gui.DestroyLoadBar(); UnloadVersion(); @@ -359,7 +338,7 @@ bool GUI::LoadDataFiles(wxString& error, wxArrayString& warnings) g_gui.SetLoadDone(0, "Loading metadata file..."); wxFileName metadata_path = g_gui.gfx.getMetadataFileName(); - if(!g_gui.gfx.loadSpriteMetadata(metadata_path, error, warnings)) { + if (!g_gui.gfx.loadSpriteMetadata(metadata_path, error, warnings)) { error = "Couldn't load metadata: " + error; g_gui.DestroyLoadBar(); UnloadVersion(); @@ -369,7 +348,7 @@ bool GUI::LoadDataFiles(wxString& error, wxArrayString& warnings) g_gui.SetLoadDone(10, "Loading sprites file..."); wxFileName sprites_path = g_gui.gfx.getSpritesFileName(); - if(!g_gui.gfx.loadSpriteData(sprites_path.GetFullPath(), error, warnings)) { + if (!g_gui.gfx.loadSpriteData(sprites_path.GetFullPath(), error, warnings)) { error = "Couldn't load sprites: " + error; g_gui.DestroyLoadBar(); UnloadVersion(); @@ -377,7 +356,7 @@ bool GUI::LoadDataFiles(wxString& error, wxArrayString& warnings) } g_gui.SetLoadDone(20, "Loading items.otb file..."); - if(!g_items.loadFromOtb(wxString("data/items/items.otb"), error, warnings)) { + if (!g_items.loadFromOtb(wxString("data/items/items.otb"), error, warnings)) { error = "Couldn't load items.otb: " + error; g_gui.DestroyLoadBar(); UnloadVersion(); @@ -385,12 +364,12 @@ bool GUI::LoadDataFiles(wxString& error, wxArrayString& warnings) } g_gui.SetLoadDone(30, "Loading items.xml ..."); - if(!g_items.loadFromGameXml(wxString("data/items/items.xml"), error, warnings)) { + if (!g_items.loadFromGameXml(wxString("data/items/items.xml"), error, warnings)) { warnings.push_back("Couldn't load items.xml: " + error); } g_gui.SetLoadDone(45, "Loading monsters.xml ..."); - if(!g_monsters.loadFromXML(wxString("data/creatures/monsters.xml"), true, error, warnings)) { + if (!g_monsters.loadFromXML(wxString("data/creatures/monsters.xml"), true, error, warnings)) { warnings.push_back("Couldn't load monsters.xml: " + error); } @@ -404,7 +383,7 @@ bool GUI::LoadDataFiles(wxString& error, wxArrayString& warnings) } g_gui.SetLoadDone(45, "Loading npcs.xml ..."); - if(!g_npcs.loadFromXML(wxString("data/creatures/npcs.xml"), true, error, warnings)) { + if (!g_npcs.loadFromXML(wxString("data/creatures/npcs.xml"), true, error, warnings)) { warnings.push_back("Couldn't load npcs.xml: " + error); } @@ -418,13 +397,13 @@ bool GUI::LoadDataFiles(wxString& error, wxArrayString& warnings) } g_gui.SetLoadDone(50, "Loading materials.xml ..."); - if(!g_materials.loadMaterials(wxString(data_path.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + "materials.xml"), error, warnings)) { + if (!g_materials.loadMaterials(wxString(data_path.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + "materials.xml"), error, warnings)) { warnings.push_back("Couldn't load materials.xml: " + error); } g_gui.SetLoadDone(70, "Loading extensions..."); - if(!g_materials.loadExtensions(extension_path, error, warnings)) { - //warnings.push_back("Couldn't load extensions: " + error); + if (!g_materials.loadExtensions(extension_path, error, warnings)) { + // warnings.push_back("Couldn't load extensions: " + error); } g_gui.SetLoadDone(70, "Finishing..."); @@ -436,8 +415,7 @@ bool GUI::LoadDataFiles(wxString& error, wxArrayString& warnings) return true; } -void GUI::UnloadVersion() -{ +void GUI::UnloadVersion() { UnnamedRenderingLock(); gfx.clear(); current_brush = nullptr; @@ -455,8 +433,8 @@ void GUI::UnloadVersion() hatch_door_brush = nullptr; window_door_brush = nullptr; - if(loaded_version != CLIENT_VERSION_NONE) { - //g_gui.UnloadVersion(); + if (loaded_version != CLIENT_VERSION_NONE) { + // g_gui.UnloadVersion(); g_materials.clear(); g_brushes.clear(); g_items.clear(); @@ -475,16 +453,15 @@ void GUI::UnloadVersion() } } -void GUI::SaveCurrentMap(FileName filename, bool showdialog) -{ +void GUI::SaveCurrentMap(FileName filename, bool showdialog) { MapTab* mapTab = GetCurrentMapTab(); - if(mapTab) { + if (mapTab) { Editor* editor = mapTab->GetEditor(); - if(editor) { + if (editor) { editor->saveMap(filename, showdialog); - const std::string& filename = editor->getMap().getFilename(); - const Position& position = mapTab->GetScreenCenterPosition(); + const std::string &filename = editor->getMap().getFilename(); + const Position &position = mapTab->GetScreenCenterPosition(); std::ostringstream stream; stream << position; g_settings.setString(Config::RECENT_EDITED_MAP_PATH, filename); @@ -497,64 +474,57 @@ void GUI::SaveCurrentMap(FileName filename, bool showdialog) root->Refresh(); } -bool GUI::IsEditorOpen() const -{ +bool GUI::IsEditorOpen() const { return tabbook != nullptr && GetCurrentMapTab(); } -double GUI::GetCurrentZoom() -{ +double GUI::GetCurrentZoom() { MapTab* tab = GetCurrentMapTab(); - if(tab) + if (tab) { return tab->GetCanvas()->GetZoom(); + } return 1.0; } -void GUI::SetCurrentZoom(double zoom) -{ +void GUI::SetCurrentZoom(double zoom) { MapTab* tab = GetCurrentMapTab(); - if(tab) + if (tab) { tab->GetCanvas()->SetZoom(zoom); + } } -void GUI::FitViewToMap() -{ - for(int index = 0; index < tabbook->GetTabCount(); ++index) { - if(auto *tab = dynamic_cast(tabbook->GetTab(index))) { +void GUI::FitViewToMap() { + for (int index = 0; index < tabbook->GetTabCount(); ++index) { + if (auto* tab = dynamic_cast(tabbook->GetTab(index))) { tab->GetView()->FitToMap(); } } } -void GUI::FitViewToMap(MapTab* mt) -{ - for(int index = 0; index < tabbook->GetTabCount(); ++index) { - if(auto *tab = dynamic_cast(tabbook->GetTab(index))) { - if(tab->HasSameReference(mt)) { +void GUI::FitViewToMap(MapTab* mt) { + for (int index = 0; index < tabbook->GetTabCount(); ++index) { + if (auto* tab = dynamic_cast(tabbook->GetTab(index))) { + if (tab->HasSameReference(mt)) { tab->GetView()->FitToMap(); } } } } -bool GUI::NewMap() -{ - FinishWelcomeDialog(); +bool GUI::NewMap() { + FinishWelcomeDialog(); Editor* editor; - try - { + try { editor = newd Editor(copybuffer); - } - catch(std::runtime_error& e) - { + } catch (std::runtime_error &e) { PopupDialog(root, "Error!", wxString(e.what(), wxConvUTF8), wxOK); return false; } - auto *mapTab = newd MapTab(tabbook, editor); + auto* mapTab = newd MapTab(tabbook, editor); mapTab->OnSwitchEditorMode(mode); - editor->clearChanges(); + editor->clearChanges(); SetStatusText("Created new map"); UpdateTitle(); @@ -564,19 +534,19 @@ bool GUI::NewMap() return true; } -void GUI::OpenMap() -{ +void GUI::OpenMap() { wxString wildcard = g_settings.getInteger(Config::USE_OTGZ) != 0 ? MAP_LOAD_FILE_WILDCARD_OTGZ : MAP_LOAD_FILE_WILDCARD; wxFileDialog dialog(root, "Open map file", wxEmptyString, wxEmptyString, wildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST); - if (dialog.ShowModal() == wxID_OK) + if (dialog.ShowModal() == wxID_OK) { LoadMap(dialog.GetPath()); + } } -void GUI::SaveMap() -{ - if (!IsEditorOpen()) +void GUI::SaveMap() { + if (!IsEditorOpen()) { return; + } if (GetCurrentMap().hasFile()) { SaveCurrentMap(true); @@ -584,15 +554,16 @@ void GUI::SaveMap() wxString wildcard = g_settings.getInteger(Config::USE_OTGZ) != 0 ? MAP_SAVE_FILE_WILDCARD_OTGZ : MAP_SAVE_FILE_WILDCARD; wxFileDialog dialog(root, "Save...", wxEmptyString, wxEmptyString, wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT); - if (dialog.ShowModal() == wxID_OK) + if (dialog.ShowModal() == wxID_OK) { SaveCurrentMap(dialog.GetPath(), true); + } } } -void GUI::SaveMapAs() -{ - if (!IsEditorOpen()) +void GUI::SaveMapAs() { + if (!IsEditorOpen()) { return; + } wxString wildcard = g_settings.getInteger(Config::USE_OTGZ) != 0 ? MAP_SAVE_FILE_WILDCARD_OTGZ : MAP_SAVE_FILE_WILDCARD; wxFileDialog dialog(root, "Save As...", "", "", wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT); @@ -605,25 +576,22 @@ void GUI::SaveMapAs() } } -bool GUI::LoadMap(const FileName& fileName) -{ - FinishWelcomeDialog(); +bool GUI::LoadMap(const FileName &fileName) { + FinishWelcomeDialog(); - if(GetCurrentEditor() && !GetCurrentMap().hasChanged() && !GetCurrentMap().hasFile()) + if (GetCurrentEditor() && !GetCurrentMap().hasChanged() && !GetCurrentMap().hasFile()) { g_gui.CloseCurrentEditor(); + } Editor* editor; - try - { + try { editor = newd Editor(copybuffer, fileName); - } - catch(std::runtime_error& e) - { + } catch (std::runtime_error &e) { PopupDialog(root, "Error!", wxString(e.what(), wxConvUTF8), wxOK); return false; } - auto *mapTab = newd MapTab(tabbook, editor); + auto* mapTab = newd MapTab(tabbook, editor); mapTab->OnSwitchEditorMode(mode); root->AddRecentFile(fileName); @@ -638,9 +606,9 @@ bool GUI::LoadMap(const FileName& fileName) root->UpdateMenubar(); std::string path = g_settings.getString(Config::RECENT_EDITED_MAP_PATH); - if(!path.empty()) { + if (!path.empty()) { FileName file(path); - if(file == fileName) { + if (file == fileName) { std::istringstream stream(g_settings.getString(Config::RECENT_EDITED_MAP_POSITION)); Position position; stream >> position; @@ -650,93 +618,85 @@ bool GUI::LoadMap(const FileName& fileName) return true; } -Editor* GUI::GetCurrentEditor() -{ +Editor* GUI::GetCurrentEditor() { MapTab* mapTab = GetCurrentMapTab(); - if(mapTab) + if (mapTab) { return mapTab->GetEditor(); + } return nullptr; } -EditorTab* GUI::GetTab(int idx) -{ +EditorTab* GUI::GetTab(int idx) { return tabbook->GetTab(idx); } -int GUI::GetTabCount() const -{ +int GUI::GetTabCount() const { return tabbook->GetTabCount(); } -EditorTab* GUI::GetCurrentTab() -{ +EditorTab* GUI::GetCurrentTab() { return tabbook->GetCurrentTab(); } -MapTab* GUI::GetCurrentMapTab() const -{ - if(tabbook && tabbook->GetTabCount() > 0) { +MapTab* GUI::GetCurrentMapTab() const { + if (tabbook && tabbook->GetTabCount() > 0) { EditorTab* editorTab = tabbook->GetCurrentTab(); - auto *mapTab = dynamic_cast(editorTab); + auto* mapTab = dynamic_cast(editorTab); return mapTab; } return nullptr; } -Map& GUI::GetCurrentMap() -{ +Map &GUI::GetCurrentMap() { Editor* editor = GetCurrentEditor(); ASSERT(editor); return editor->getMap(); } -int GUI::GetOpenMapCount() -{ +int GUI::GetOpenMapCount() { std::set open_maps; - for(int i = 0; i < tabbook->GetTabCount(); ++i) { - auto *tab = dynamic_cast(tabbook->GetTab(i)); - if(tab) + for (int i = 0; i < tabbook->GetTabCount(); ++i) { + auto* tab = dynamic_cast(tabbook->GetTab(i)); + if (tab) { open_maps.insert(open_maps.begin(), tab->GetMap()); - + } } return static_cast(open_maps.size()); } -bool GUI::ShouldSave() -{ +bool GUI::ShouldSave() { Editor* editor = GetCurrentEditor(); ASSERT(editor); return editor->hasChanges(); } -void GUI::AddPendingCanvasEvent(wxEvent& event) -{ +void GUI::AddPendingCanvasEvent(wxEvent &event) { MapTab* mapTab = GetCurrentMapTab(); - if(mapTab) + if (mapTab) { mapTab->GetCanvas()->GetEventHandler()->AddPendingEvent(event); + } } -void GUI::CloseCurrentEditor() -{ +void GUI::CloseCurrentEditor() { RefreshPalettes(); tabbook->DeleteTab(tabbook->GetSelection()); root->UpdateMenubar(); } -bool GUI::CloseLiveEditors(LiveSocket* sock) -{ - for(int i = 0; i < tabbook->GetTabCount(); ++i) { - auto *mapTab = dynamic_cast(tabbook->GetTab(i)); - if(mapTab) { +bool GUI::CloseLiveEditors(LiveSocket* sock) { + for (int i = 0; i < tabbook->GetTabCount(); ++i) { + auto* mapTab = dynamic_cast(tabbook->GetTab(i)); + if (mapTab) { Editor* editor = mapTab->GetEditor(); - if(editor->GetLiveClient() == sock) + if (editor->GetLiveClient() == sock) { tabbook->DeleteTab(i--); + } } - auto *liveLogTab = dynamic_cast(tabbook->GetTab(i)); - if(liveLogTab) { - if(liveLogTab->GetSocket() == sock) { + auto* liveLogTab = dynamic_cast(tabbook->GetTab(i)); + if (liveLogTab) { + if (liveLogTab->GetSocket() == sock) { liveLogTab->Disconnect(); tabbook->DeleteTab(i--); } @@ -746,15 +706,13 @@ bool GUI::CloseLiveEditors(LiveSocket* sock) return true; } - -bool GUI::CloseAllEditors() -{ - for(int i = 0; i < tabbook->GetTabCount(); ++i) { - auto *mapTab = dynamic_cast(tabbook->GetTab(i)); - if(mapTab) { - if(mapTab->IsUniqueReference() && mapTab->GetMap() && mapTab->GetMap()->hasChanged()) { +bool GUI::CloseAllEditors() { + for (int i = 0; i < tabbook->GetTabCount(); ++i) { + auto* mapTab = dynamic_cast(tabbook->GetTab(i)); + if (mapTab) { + if (mapTab->IsUniqueReference() && mapTab->GetMap() && mapTab->GetMap()->hasChanged()) { tabbook->SetFocusedTab(i); - if(!root->DoQuerySave(false)) { + if (!root->DoQuerySave(false)) { return false; } else { RefreshPalettes(); @@ -765,16 +723,16 @@ bool GUI::CloseAllEditors() } } } - if(root) + if (root) { root->UpdateMenubar(); + } return true; } -void GUI::NewMapView() -{ +void GUI::NewMapView() { MapTab* mapTab = GetCurrentMapTab(); - if(mapTab) { - auto *newMapTab = newd MapTab(mapTab); + if (mapTab) { + auto* newMapTab = newd MapTab(mapTab); newMapTab->OnSwitchEditorMode(mode); SetStatusText("Created new view"); @@ -785,10 +743,9 @@ void GUI::NewMapView() } } -void GUI::LoadPerspective() -{ - if(!IsVersionLoaded()) { - if(g_settings.getInteger(Config::WINDOW_MAXIMIZED)) { +void GUI::LoadPerspective() { + if (!IsVersionLoaded()) { + if (g_settings.getInteger(Config::WINDOW_MAXIMIZED)) { root->Maximize(); } else { root->SetSize(wxSize( @@ -801,8 +758,8 @@ void GUI::LoadPerspective() std::string layout = g_settings.getString(Config::PALETTE_LAYOUT); std::vector palette_list; - for(char c : layout) { - if(c == '|') { + for (char c : layout) { + if (c == '|') { palette_list.push_back(tmp); tmp.clear(); } else { @@ -810,95 +767,95 @@ void GUI::LoadPerspective() } } - if(!tmp.empty()) { + if (!tmp.empty()) { palette_list.push_back(tmp); } - for(const std::string& name : palette_list) { + for (const std::string &name : palette_list) { PaletteWindow* palette = CreatePalette(); - wxAuiPaneInfo& info = aui_manager->GetPane(palette); + wxAuiPaneInfo &info = aui_manager->GetPane(palette); aui_manager->LoadPaneInfo(wxstr(name), info); - if(info.IsFloatable()) { + if (info.IsFloatable()) { bool offscreen = true; - for(uint32_t index = 0; index < wxDisplay::GetCount(); ++index) { + for (uint32_t index = 0; index < wxDisplay::GetCount(); ++index) { wxDisplay display(index); wxRect rect = display.GetClientArea(); - if(rect.Contains(info.floating_pos)) { + if (rect.Contains(info.floating_pos)) { offscreen = false; break; } } - if(offscreen) { + if (offscreen) { info.Dock(); } } } - if(g_settings.getInteger(Config::MINIMAP_VISIBLE)) { - if(!minimap) { + if (g_settings.getInteger(Config::MINIMAP_VISIBLE)) { + if (!minimap) { wxAuiPaneInfo info; - const wxString& data = wxstr(g_settings.getString(Config::MINIMAP_LAYOUT)); + const wxString &data = wxstr(g_settings.getString(Config::MINIMAP_LAYOUT)); aui_manager->LoadPaneInfo(data, info); minimap = newd MinimapWindow(root); aui_manager->AddPane(minimap, info); } else { - wxAuiPaneInfo& info = aui_manager->GetPane(minimap); + wxAuiPaneInfo &info = aui_manager->GetPane(minimap); - const wxString& data = wxstr(g_settings.getString(Config::MINIMAP_LAYOUT)); + const wxString &data = wxstr(g_settings.getString(Config::MINIMAP_LAYOUT)); aui_manager->LoadPaneInfo(data, info); } - wxAuiPaneInfo& info = aui_manager->GetPane(minimap); - if(info.IsFloatable()) { + wxAuiPaneInfo &info = aui_manager->GetPane(minimap); + if (info.IsFloatable()) { bool offscreen = true; - for(uint32_t index = 0; index < wxDisplay::GetCount(); ++index) { + for (uint32_t index = 0; index < wxDisplay::GetCount(); ++index) { wxDisplay display(index); wxRect rect = display.GetClientArea(); - if(rect.Contains(info.floating_pos)) { + if (rect.Contains(info.floating_pos)) { offscreen = false; break; } } - if(offscreen) { + if (offscreen) { info.Dock(); } } } - if(g_settings.getInteger(Config::ACTIONS_HISTORY_VISIBLE)) { - if(!actions_history_window) { + if (g_settings.getInteger(Config::ACTIONS_HISTORY_VISIBLE)) { + if (!actions_history_window) { wxAuiPaneInfo info; - const wxString& data = wxstr(g_settings.getString(Config::ACTIONS_HISTORY_LAYOUT)); + const wxString &data = wxstr(g_settings.getString(Config::ACTIONS_HISTORY_LAYOUT)); aui_manager->LoadPaneInfo(data, info); actions_history_window = new ActionsHistoryWindow(root); aui_manager->AddPane(actions_history_window, info); } else { - wxAuiPaneInfo& info = aui_manager->GetPane(actions_history_window); - const wxString& data = wxstr(g_settings.getString(Config::ACTIONS_HISTORY_LAYOUT)); + wxAuiPaneInfo &info = aui_manager->GetPane(actions_history_window); + const wxString &data = wxstr(g_settings.getString(Config::ACTIONS_HISTORY_LAYOUT)); aui_manager->LoadPaneInfo(data, info); } - wxAuiPaneInfo& info = aui_manager->GetPane(actions_history_window); - if(info.IsFloatable()) { + wxAuiPaneInfo &info = aui_manager->GetPane(actions_history_window); + if (info.IsFloatable()) { bool offscreen = true; - for(uint32_t index = 0; index < wxDisplay::GetCount(); ++index) { + for (uint32_t index = 0; index < wxDisplay::GetCount(); ++index) { wxDisplay display(index); wxRect rect = display.GetClientArea(); - if(rect.Contains(info.floating_pos)) { + if (rect.Contains(info.floating_pos)) { offscreen = false; break; } } - if(offscreen) { + if (offscreen) { info.Dock(); } } @@ -911,27 +868,27 @@ void GUI::LoadPerspective() root->GetAuiToolBar()->LoadPerspective(); } -void GUI::SavePerspective() -{ +void GUI::SavePerspective() { g_settings.setInteger(Config::WINDOW_MAXIMIZED, root->IsMaximized()); g_settings.setInteger(Config::WINDOW_WIDTH, root->GetSize().GetWidth()); g_settings.setInteger(Config::WINDOW_HEIGHT, root->GetSize().GetHeight()); - g_settings.setInteger(Config::MINIMAP_VISIBLE, minimap? 1: 0); + g_settings.setInteger(Config::MINIMAP_VISIBLE, minimap ? 1 : 0); g_settings.setInteger(Config::ACTIONS_HISTORY_VISIBLE, actions_history_window ? 1 : 0); wxString pinfo; for (auto &palette : palettes) { - if(aui_manager->GetPane(palette).IsShown()) + if (aui_manager->GetPane(palette).IsShown()) { pinfo << aui_manager->SavePaneInfo(aui_manager->GetPane(palette)) << "|"; + } } g_settings.setString(Config::PALETTE_LAYOUT, nstr(pinfo)); - if(minimap) { + if (minimap) { wxString s = aui_manager->SavePaneInfo(aui_manager->GetPane(minimap)); g_settings.setString(Config::MINIMAP_LAYOUT, nstr(s)); } - if(actions_history_window) { + if (actions_history_window) { wxString info = aui_manager->SavePaneInfo(aui_manager->GetPane(actions_history_window)); g_settings.setString(Config::ACTIONS_HISTORY_LAYOUT, nstr(info)); } @@ -939,17 +896,15 @@ void GUI::SavePerspective() root->GetAuiToolBar()->SavePerspective(); } -void GUI::HideSearchWindow() -{ - if(search_result_window) { +void GUI::HideSearchWindow() { + if (search_result_window) { aui_manager->GetPane(search_result_window).Show(false); aui_manager->Update(); } } -SearchResultWindow* GUI::ShowSearchWindow() -{ - if(search_result_window == nullptr) { +SearchResultWindow* GUI::ShowSearchWindow() { + if (search_result_window == nullptr) { search_result_window = newd SearchResultWindow(root); aui_manager->AddPane(search_result_window, wxAuiPaneInfo().Caption("Search Results")); } else { @@ -959,9 +914,8 @@ SearchResultWindow* GUI::ShowSearchWindow() return search_result_window; } -ActionsHistoryWindow* GUI::ShowActionsWindow() -{ - if(!actions_history_window) { +ActionsHistoryWindow* GUI::ShowActionsWindow() { + if (!actions_history_window) { actions_history_window = new ActionsHistoryWindow(root); aui_manager->AddPane(actions_history_window, wxAuiPaneInfo().Caption("Actions History")); } else { @@ -973,9 +927,8 @@ ActionsHistoryWindow* GUI::ShowActionsWindow() return actions_history_window; } -void GUI::HideActionsWindow() -{ - if(actions_history_window) { +void GUI::HideActionsWindow() { + if (actions_history_window) { aui_manager->GetPane(actions_history_window).Show(false); aui_manager->Update(); } @@ -984,43 +937,41 @@ void GUI::HideActionsWindow() //============================================================================= // Palette Window Interface implementation -PaletteWindow* GUI::GetPalette() -{ - if(palettes.empty()) +PaletteWindow* GUI::GetPalette() { + if (palettes.empty()) { return nullptr; + } return palettes.front(); } -PaletteWindow* GUI::NewPalette() -{ +PaletteWindow* GUI::NewPalette() { return CreatePalette(); } -void GUI::RefreshPalettes(Map* m, bool usedefault) -{ +void GUI::RefreshPalettes(Map* m, bool usedefault) { for (auto &palette : palettes) { - palette->OnUpdate(m? m : (usedefault? (IsEditorOpen()? &GetCurrentMap() : nullptr): nullptr)); + palette->OnUpdate(m ? m : (usedefault ? (IsEditorOpen() ? &GetCurrentMap() : nullptr) : nullptr)); } SelectBrush(); RefreshActions(); } -void GUI::RefreshOtherPalettes(PaletteWindow* p) -{ +void GUI::RefreshOtherPalettes(PaletteWindow* p) { for (auto &palette : palettes) { - if(palette != p) - palette->OnUpdate(IsEditorOpen()? &GetCurrentMap() : nullptr); + if (palette != p) { + palette->OnUpdate(IsEditorOpen() ? &GetCurrentMap() : nullptr); + } } SelectBrush(); } -PaletteWindow* GUI::CreatePalette() -{ - if(!IsVersionLoaded()) +PaletteWindow* GUI::CreatePalette() { + if (!IsVersionLoaded()) { return nullptr; + } - auto *palette = newd PaletteWindow(root, g_materials.tilesets); + auto* palette = newd PaletteWindow(root, g_materials.tilesets); aui_manager->AddPane(palette, wxAuiPaneInfo().Caption("Palette").TopDockable(false).BottomDockable(false)); aui_manager->Update(); @@ -1032,14 +983,12 @@ PaletteWindow* GUI::CreatePalette() return palette; } -void GUI::ActivatePalette(PaletteWindow* p) -{ +void GUI::ActivatePalette(PaletteWindow* p) { palettes.erase(std::find(palettes.begin(), palettes.end(), p)); palettes.push_front(p); } -void GUI::DestroyPalettes() -{ +void GUI::DestroyPalettes() { for (auto palette : palettes) { aui_manager->DetachPane(palette); palette->Destroy(); @@ -1049,38 +998,39 @@ void GUI::DestroyPalettes() aui_manager->Update(); } -void GUI::RebuildPalettes() -{ +void GUI::RebuildPalettes() { // Palette lits might be modified due to active palette changes // Use a temporary list for iterating PaletteList tmp = palettes; for (auto &piter : tmp) { - piter->ReloadSettings(IsEditorOpen()? &GetCurrentMap() : nullptr); + piter->ReloadSettings(IsEditorOpen() ? &GetCurrentMap() : nullptr); } aui_manager->Update(); } -void GUI::ShowPalette() -{ - if(palettes.empty()) +void GUI::ShowPalette() { + if (palettes.empty()) { return; + } for (auto &palette : palettes) { - if(aui_manager->GetPane(palette).IsShown()) + if (aui_manager->GetPane(palette).IsShown()) { return; + } } aui_manager->GetPane(palettes.front()).Show(true); aui_manager->Update(); } -void GUI::SelectPalettePage(PaletteType pt) -{ - if(palettes.empty()) +void GUI::SelectPalettePage(PaletteType pt) { + if (palettes.empty()) { CreatePalette(); + } PaletteWindow* p = GetPalette(); - if(!p) + if (!p) { return; + } ShowPalette(); p->SelectPage(pt); @@ -1091,12 +1041,12 @@ void GUI::SelectPalettePage(PaletteType pt) //============================================================================= // Minimap Window Interface Implementation -void GUI::CreateMinimap() -{ - if(!IsVersionLoaded()) +void GUI::CreateMinimap() { + if (!IsVersionLoaded()) { return; + } - if(minimap) { + if (minimap) { aui_manager->GetPane(minimap).Show(true); } else { minimap = newd MinimapWindow(root); @@ -1106,17 +1056,15 @@ void GUI::CreateMinimap() aui_manager->Update(); } -void GUI::HideMinimap() -{ - if(minimap) { +void GUI::HideMinimap() { + if (minimap) { aui_manager->GetPane(minimap).Show(false); aui_manager->Update(); } } -void GUI::DestroyMinimap() -{ - if(minimap) { +void GUI::DestroyMinimap() { + if (minimap) { aui_manager->DetachPane(minimap); aui_manager->Update(); minimap->Destroy(); @@ -1124,10 +1072,9 @@ void GUI::DestroyMinimap() } } -void GUI::UpdateMinimap(bool immediate) -{ - if(IsMinimapVisible()) { - if(immediate) { +void GUI::UpdateMinimap(bool immediate) { + if (IsMinimapVisible()) { + if (immediate) { minimap->Refresh(); } else { minimap->DelayedUpdate(); @@ -1135,11 +1082,10 @@ void GUI::UpdateMinimap(bool immediate) } } -bool GUI::IsMinimapVisible() const -{ - if(minimap) { - const wxAuiPaneInfo& pi = aui_manager->GetPane(minimap); - if(pi.IsShown()) { +bool GUI::IsMinimapVisible() const { + if (minimap) { + const wxAuiPaneInfo &pi = aui_manager->GetPane(minimap); + if (pi.IsShown()) { return true; } } @@ -1148,69 +1094,64 @@ bool GUI::IsMinimapVisible() const //============================================================================= -void GUI::RefreshView() -{ +void GUI::RefreshView() { EditorTab* editorTab = GetCurrentTab(); - if(!editorTab) { + if (!editorTab) { return; } - if(!dynamic_cast(editorTab)) { + if (!dynamic_cast(editorTab)) { editorTab->GetWindow()->Refresh(); return; } std::vector editorTabs; - for(int32_t index = 0; index < tabbook->GetTabCount(); ++index) { - auto * mapTab = dynamic_cast(tabbook->GetTab(index)); - if(mapTab) { + for (int32_t index = 0; index < tabbook->GetTabCount(); ++index) { + auto* mapTab = dynamic_cast(tabbook->GetTab(index)); + if (mapTab) { editorTabs.push_back(mapTab); } } - for(EditorTab* editorTab : editorTabs) { + for (EditorTab* editorTab : editorTabs) { editorTab->GetWindow()->Refresh(); } } -void GUI::CreateLoadBar(wxString message, bool canCancel /* = false */ ) -{ +void GUI::CreateLoadBar(wxString message, bool canCancel /* = false */) { progressText = message; progressFrom = 0; progressTo = 100; currentProgress = -1; - progressBar = newd wxGenericProgressDialog("Loading", progressText + " (0%)", 100, root, - wxPD_APP_MODAL | wxPD_SMOOTH | (canCancel ? wxPD_CAN_ABORT : 0) - ); + progressBar = newd wxGenericProgressDialog("Loading", progressText + " (0%)", 100, root, wxPD_APP_MODAL | wxPD_SMOOTH | (canCancel ? wxPD_CAN_ABORT : 0)); progressBar->SetSize(280, -1); progressBar->Show(true); - for(int idx = 0; idx < tabbook->GetTabCount(); ++idx) { - auto * mt = dynamic_cast(tabbook->GetTab(idx)); - if(mt && mt->GetEditor()->IsLiveServer()) + for (int idx = 0; idx < tabbook->GetTabCount(); ++idx) { + auto* mt = dynamic_cast(tabbook->GetTab(idx)); + if (mt && mt->GetEditor()->IsLiveServer()) { mt->GetEditor()->GetLiveServer()->startOperation(progressText); + } } progressBar->Update(0); } -void GUI::SetLoadScale(int32_t from, int32_t to) -{ +void GUI::SetLoadScale(int32_t from, int32_t to) { progressFrom = from; progressTo = to; } -bool GUI::SetLoadDone(int32_t done, const wxString& newMessage) -{ - if(done == 100) { +bool GUI::SetLoadDone(int32_t done, const wxString &newMessage) { + if (done == 100) { DestroyLoadBar(); return true; - } else if(done == currentProgress) { + } else if (done == currentProgress) { return true; } - if(!newMessage.empty()) { + if (!newMessage.empty()) { progressText = newMessage; } @@ -1218,7 +1159,7 @@ bool GUI::SetLoadDone(int32_t done, const wxString& newMessage) newProgress = std::max(0, std::min(100, newProgress)); bool skip = false; - if(progressBar) { + if (progressBar) { progressBar->Update( newProgress, wxString::Format("%s (%d%%)", progressText, newProgress), @@ -1227,11 +1168,11 @@ bool GUI::SetLoadDone(int32_t done, const wxString& newMessage) currentProgress = newProgress; } - for(int32_t index = 0; index < tabbook->GetTabCount(); ++index) { - auto * mapTab = dynamic_cast(tabbook->GetTab(index)); - if(mapTab && mapTab->GetEditor()) { + for (int32_t index = 0; index < tabbook->GetTabCount(); ++index) { + auto* mapTab = dynamic_cast(tabbook->GetTab(index)); + if (mapTab && mapTab->GetEditor()) { LiveServer* server = mapTab->GetEditor()->GetLiveServer(); - if(server) { + if (server) { server->updateOperation(newProgress); } } @@ -1240,16 +1181,15 @@ bool GUI::SetLoadDone(int32_t done, const wxString& newMessage) return skip; } -void GUI::DestroyLoadBar() -{ - if(progressBar) { +void GUI::DestroyLoadBar() { + if (progressBar) { progressBar->Show(false); currentProgress = -1; progressBar->Destroy(); progressBar = nullptr; - if(root->IsActive()) { + if (root->IsActive()) { root->Raise(); } else { root->RequestUserAttention(); @@ -1258,95 +1198,93 @@ void GUI::DestroyLoadBar() } void GUI::ShowWelcomeDialog(const wxBitmap &icon) { - std::vector recent_files = root->GetRecentFiles(); - welcomeDialog = newd WelcomeDialog(__W_RME_APPLICATION_NAME__, "Version " + __W_RME_VERSION__, FROM_DIP(root, wxSize(800, 480)), icon, recent_files); - welcomeDialog->Bind(wxEVT_CLOSE_WINDOW, &GUI::OnWelcomeDialogClosed, this); - welcomeDialog->Bind(WELCOME_DIALOG_ACTION, &GUI::OnWelcomeDialogAction, this); - welcomeDialog->Show(); - UpdateMenubar(); + std::vector recent_files = root->GetRecentFiles(); + welcomeDialog = newd WelcomeDialog(__W_RME_APPLICATION_NAME__, "Version " + __W_RME_VERSION__, FROM_DIP(root, wxSize(800, 480)), icon, recent_files); + welcomeDialog->Bind(wxEVT_CLOSE_WINDOW, &GUI::OnWelcomeDialogClosed, this); + welcomeDialog->Bind(WELCOME_DIALOG_ACTION, &GUI::OnWelcomeDialogAction, this); + welcomeDialog->Show(); + UpdateMenubar(); } void GUI::FinishWelcomeDialog() { - if (welcomeDialog != nullptr) { - welcomeDialog->Hide(); + if (welcomeDialog != nullptr) { + welcomeDialog->Hide(); root->Show(); - welcomeDialog->Destroy(); - welcomeDialog = nullptr; - } + welcomeDialog->Destroy(); + welcomeDialog = nullptr; + } } bool GUI::IsWelcomeDialogShown() { - return welcomeDialog != nullptr && welcomeDialog->IsShown(); + return welcomeDialog != nullptr && welcomeDialog->IsShown(); } -void GUI::OnWelcomeDialogClosed(wxCloseEvent &event) -{ - welcomeDialog->Destroy(); - root->Close(); +void GUI::OnWelcomeDialogClosed(wxCloseEvent &event) { + welcomeDialog->Destroy(); + root->Close(); } -void GUI::OnWelcomeDialogAction(wxCommandEvent &event) -{ - if (event.GetId() == wxID_NEW) { - NewMap(); - } else if (event.GetId() == wxID_OPEN) { - LoadMap(FileName(event.GetString())); - } +void GUI::OnWelcomeDialogAction(wxCommandEvent &event) { + if (event.GetId() == wxID_NEW) { + NewMap(); + } else if (event.GetId() == wxID_OPEN) { + LoadMap(FileName(event.GetString())); + } } -void GUI::UpdateMenubar() -{ +void GUI::UpdateMenubar() { root->UpdateMenubar(); } -void GUI::SetScreenCenterPosition(const Position& position, bool showIndicator) -{ +void GUI::SetScreenCenterPosition(const Position &position, bool showIndicator) { MapTab* mapTab = GetCurrentMapTab(); - if(mapTab) + if (mapTab) { mapTab->SetScreenCenterPosition(position, showIndicator); + } } -void GUI::DoCut() -{ - if (!IsSelectionMode()) +void GUI::DoCut() { + if (!IsSelectionMode()) { return; + } Editor* editor = GetCurrentEditor(); - if (!editor) + if (!editor) { return; + } editor->copybuffer.cut(*editor, GetCurrentFloor()); RefreshView(); root->UpdateMenubar(); } -void GUI::DoCopy() -{ - if (!IsSelectionMode()) +void GUI::DoCopy() { + if (!IsSelectionMode()) { return; + } Editor* editor = GetCurrentEditor(); - if (!editor) + if (!editor) { return; + } editor->copybuffer.copy(*editor, GetCurrentFloor()); RefreshView(); root->UpdateMenubar(); } -void GUI::DoPaste() -{ +void GUI::DoPaste() { MapTab* mapTab = GetCurrentMapTab(); - if(mapTab) + if (mapTab) { copybuffer.paste(*mapTab->GetEditor(), mapTab->GetCanvas()->GetCursorPosition()); + } } -void GUI::PreparePaste() -{ +void GUI::PreparePaste() { Editor* editor = GetCurrentEditor(); if (editor) { SetSelectionMode(); - Selection& selection = editor->getSelection(); + Selection &selection = editor->getSelection(); selection.start(); selection.clear(); selection.finish(); @@ -1355,41 +1293,37 @@ void GUI::PreparePaste() } } -void GUI::StartPasting() -{ - if(GetCurrentEditor()) { +void GUI::StartPasting() { + if (GetCurrentEditor()) { pasting = true; secondary_map = ©buffer.getBufferMap(); } } -void GUI::EndPasting() -{ - if(pasting) { +void GUI::EndPasting() { + if (pasting) { pasting = false; secondary_map = nullptr; } } -bool GUI::CanUndo() -{ +bool GUI::CanUndo() { Editor* editor = GetCurrentEditor(); return (editor && editor->canUndo()); } -bool GUI::CanRedo() -{ +bool GUI::CanRedo() { Editor* editor = GetCurrentEditor(); return (editor && editor->canRedo()); } -bool GUI::DoUndo() -{ +bool GUI::DoUndo() { Editor* editor = GetCurrentEditor(); - if(editor && editor->canUndo()) { + if (editor && editor->canUndo()) { editor->undo(); - if(editor->hasSelection()) + if (editor->hasSelection()) { SetSelectionMode(); + } SetStatusText("Undo action"); UpdateMinimap(); root->UpdateMenubar(); @@ -1399,13 +1333,13 @@ bool GUI::DoUndo() return false; } -bool GUI::DoRedo() -{ +bool GUI::DoRedo() { Editor* editor = GetCurrentEditor(); - if(editor && editor->canRedo()) { + if (editor && editor->canRedo()) { editor->redo(); - if(editor->hasSelection()) + if (editor->hasSelection()) { SetSelectionMode(); + } SetStatusText("Redo action"); UpdateMinimap(); root->UpdateMenubar(); @@ -1415,51 +1349,50 @@ bool GUI::DoRedo() return false; } -int GUI::GetCurrentFloor() -{ +int GUI::GetCurrentFloor() { MapTab* tab = GetCurrentMapTab(); ASSERT(tab); return tab->GetCanvas()->GetFloor(); } -void GUI::ChangeFloor(int new_floor) -{ +void GUI::ChangeFloor(int new_floor) { MapTab* tab = GetCurrentMapTab(); - if(tab) { + if (tab) { int old_floor = GetCurrentFloor(); - if(new_floor < rme::MapMinLayer || new_floor > rme::MapMaxLayer) + if (new_floor < rme::MapMinLayer || new_floor > rme::MapMaxLayer) { return; + } - if(old_floor != new_floor) + if (old_floor != new_floor) { tab->GetCanvas()->ChangeFloor(new_floor); + } } } -void GUI::SetStatusText(wxString text) -{ +void GUI::SetStatusText(wxString text) { g_gui.root->SetStatusText(text, 0); } -void GUI::SetTitle(wxString title) -{ - if(g_gui.root == nullptr) +void GUI::SetTitle(wxString title) { + if (g_gui.root == nullptr) { return; + } #ifdef NIGHTLY_BUILD -# ifdef SVN_BUILD -# define TITLE_APPEND (wxString(" (Nightly Build #") << i2ws(SVN_BUILD) << ")") -# else -# define TITLE_APPEND (wxString(" (Nightly Build)")) -# endif + #ifdef SVN_BUILD + #define TITLE_APPEND (wxString(" (Nightly Build #") << i2ws(SVN_BUILD) << ")") + #else + #define TITLE_APPEND (wxString(" (Nightly Build)")) + #endif #else -# ifdef SVN_BUILD -# define TITLE_APPEND (wxString(" (Build #") << i2ws(SVN_BUILD) << ")") -# else -# define TITLE_APPEND (wxString("")) -# endif + #ifdef SVN_BUILD + #define TITLE_APPEND (wxString(" (Build #") << i2ws(SVN_BUILD) << ")") + #else + #define TITLE_APPEND (wxString("")) + #endif #endif #ifdef __EXPERIMENTAL__ - if(title != "") { + if (title != "") { g_gui.root->SetTitle(title << " - Remere's Map Editor BETA" << TITLE_APPEND); } else { g_gui.root->SetTitle(wxString("Remere's Map Editor BETA") << TITLE_APPEND); @@ -1467,12 +1400,11 @@ void GUI::SetTitle(wxString title) #elif __SNAPSHOT__ if (title != "") { g_gui.root->SetTitle(title << " - Remere's Map Editor - SNAPSHOT" << TITLE_APPEND); - } - else { + } else { g_gui.root->SetTitle(wxString("Remere's Map Editor - SNAPSHOT") << TITLE_APPEND); } #else - if(!title.empty()) { + if (!title.empty()) { g_gui.root->SetTitle(title << " - Remere's Map Editor" << TITLE_APPEND); } else { g_gui.root->SetTitle(wxString("Remere's Map Editor") << TITLE_APPEND); @@ -1480,58 +1412,55 @@ void GUI::SetTitle(wxString title) #endif } -void GUI::UpdateTitle() -{ - if(tabbook->GetTabCount() > 0) { +void GUI::UpdateTitle() { + if (tabbook->GetTabCount() > 0) { SetTitle(tabbook->GetCurrentTab()->GetTitle()); - for(int idx = 0; idx < tabbook->GetTabCount(); ++idx) { - if(tabbook->GetTab(idx)) + for (int idx = 0; idx < tabbook->GetTabCount(); ++idx) { + if (tabbook->GetTab(idx)) { tabbook->SetTabLabel(idx, tabbook->GetTab(idx)->GetTitle()); + } } } else { SetTitle(""); } } -void GUI::UpdateMenus() -{ +void GUI::UpdateMenus() { wxCommandEvent evt(EVT_UPDATE_MENUS); g_gui.root->AddPendingEvent(evt); } -void GUI::UpdateActions() -{ +void GUI::UpdateActions() { wxCommandEvent evt(EVT_UPDATE_ACTIONS); g_gui.root->AddPendingEvent(evt); } -void GUI::RefreshActions() -{ - if(actions_history_window) +void GUI::RefreshActions() { + if (actions_history_window) { actions_history_window->RefreshActions(); + } } -void GUI::ShowToolbar(ToolBarID id, bool show) -{ - if (root && root->GetAuiToolBar()) +void GUI::ShowToolbar(ToolBarID id, bool show) { + if (root && root->GetAuiToolBar()) { root->GetAuiToolBar()->Show(id, show); + } } -void GUI::SwitchMode() -{ - if(mode == DRAWING_MODE) { +void GUI::SwitchMode() { + if (mode == DRAWING_MODE) { SetSelectionMode(); } else { SetDrawingMode(); } } -void GUI::SetSelectionMode() -{ - if(mode == SELECTION_MODE) +void GUI::SetSelectionMode() { + if (mode == SELECTION_MODE) { return; + } - if(current_brush && current_brush->isDoodad()) { + if (current_brush && current_brush->isDoodad()) { secondary_map = nullptr; } @@ -1539,20 +1468,21 @@ void GUI::SetSelectionMode() mode = SELECTION_MODE; } -void GUI::SetDrawingMode() -{ - if(mode == DRAWING_MODE) +void GUI::SetDrawingMode() { + if (mode == DRAWING_MODE) { return; + } std::set al; - for(int idx = 0; idx < tabbook->GetTabCount(); ++idx) { + for (int idx = 0; idx < tabbook->GetTabCount(); ++idx) { EditorTab* editorTab = tabbook->GetTab(idx); - if(MapTab* mapTab = dynamic_cast(editorTab)) { - if(al.find(mapTab) != al.end()) + if (MapTab* mapTab = dynamic_cast(editorTab)) { + if (al.find(mapTab) != al.end()) { continue; + } Editor* editor = mapTab->GetEditor(); - Selection& selection = editor->getSelection(); + Selection &selection = editor->getSelection(); selection.start(Selection::NONE, ACTION_UNSELECT); selection.clear(); selection.finish(); @@ -1561,7 +1491,7 @@ void GUI::SetDrawingMode() } } - if(current_brush && current_brush->isDoodad()) { + if (current_brush && current_brush->isDoodad()) { secondary_map = doodad_buffer_map; } else { secondary_map = nullptr; @@ -1571,9 +1501,8 @@ void GUI::SetDrawingMode() mode = DRAWING_MODE; } -void GUI::SetBrushSizeInternal(int nz) -{ - if(nz != brush_size && current_brush && current_brush->isDoodad() && !current_brush->oneSizeFitsAll()) { +void GUI::SetBrushSizeInternal(int nz) { + if (nz != brush_size && current_brush && current_brush->isDoodad() && !current_brush->oneSizeFitsAll()) { brush_size = nz; FillDoodadPreviewBuffer(); secondary_map = doodad_buffer_map; @@ -1582,8 +1511,7 @@ void GUI::SetBrushSizeInternal(int nz) } } -void GUI::SetBrushSize(int nz) -{ +void GUI::SetBrushSize(int nz) { SetBrushSizeInternal(nz); for (auto &palette : palettes) { @@ -1593,9 +1521,8 @@ void GUI::SetBrushSize(int nz) root->GetAuiToolBar()->UpdateBrushSize(brush_shape, brush_size); } -void GUI::SetBrushVariation(int nz) -{ - if(nz != brush_variation && current_brush && current_brush->isDoodad()) { +void GUI::SetBrushVariation(int nz) { + if (nz != brush_variation && current_brush && current_brush->isDoodad()) { // Monkey! brush_variation = nz; FillDoodadPreviewBuffer(); @@ -1603,9 +1530,8 @@ void GUI::SetBrushVariation(int nz) } } -void GUI::SetBrushShape(BrushShape bs) -{ - if(bs != brush_shape && current_brush && current_brush->isDoodad() && !current_brush->oneSizeFitsAll()) { +void GUI::SetBrushShape(BrushShape bs) { + if (bs != brush_shape && current_brush && current_brush->isDoodad() && !current_brush->oneSizeFitsAll()) { // Donkey! brush_shape = bs; FillDoodadPreviewBuffer(); @@ -1620,37 +1546,34 @@ void GUI::SetBrushShape(BrushShape bs) root->GetAuiToolBar()->UpdateBrushSize(brush_shape, brush_size); } -void GUI::SetBrushThickness(bool on, int x, int y) -{ +void GUI::SetBrushThickness(bool on, int x, int y) { use_custom_thickness = on; - if(x != -1 || y != -1) { + if (x != -1 || y != -1) { custom_thickness_mod = std::max(x, 1.f) / std::max(y, 1.f); } - if(current_brush && current_brush->isDoodad()) { + if (current_brush && current_brush->isDoodad()) { FillDoodadPreviewBuffer(); } RefreshView(); } -void GUI::SetBrushThickness(int low, int ceil) -{ +void GUI::SetBrushThickness(int low, int ceil) { custom_thickness_mod = std::max(low, 1.f) / std::max(ceil, 1.f); - if(use_custom_thickness && current_brush && current_brush->isDoodad()) { + if (use_custom_thickness && current_brush && current_brush->isDoodad()) { FillDoodadPreviewBuffer(); } RefreshView(); } -void GUI::DecreaseBrushSize(bool wrap) -{ - switch(brush_size) { +void GUI::DecreaseBrushSize(bool wrap) { + switch (brush_size) { case 0: { - if(wrap) { + if (wrap) { SetBrushSize(11); } break; @@ -1688,9 +1611,8 @@ void GUI::DecreaseBrushSize(bool wrap) } } -void GUI::IncreaseBrushSize(bool wrap) -{ - switch(brush_size) { +void GUI::IncreaseBrushSize(bool wrap) { + switch (brush_size) { case 0: { SetBrushSize(1); break; @@ -1722,7 +1644,7 @@ void GUI::IncreaseBrushSize(bool wrap) } case 11: default: { - if(wrap) { + if (wrap) { SetBrushSize(0); } break; @@ -1730,137 +1652,138 @@ void GUI::IncreaseBrushSize(bool wrap) } } -Brush* GUI::GetCurrentBrush() const -{ +Brush* GUI::GetCurrentBrush() const { return current_brush; } -BrushShape GUI::GetBrushShape() const -{ - if(current_brush == spawn_brush) +BrushShape GUI::GetBrushShape() const { + if (current_brush == spawn_brush) { return BRUSHSHAPE_SQUARE; + } - if(current_brush == spawn_npc_brush) + if (current_brush == spawn_npc_brush) { return BRUSHSHAPE_SQUARE; + } return brush_shape; } -int GUI::GetBrushSize() const -{ +int GUI::GetBrushSize() const { return brush_size; } -int GUI::GetBrushVariation() const -{ +int GUI::GetBrushVariation() const { return brush_variation; } -int GUI::GetSpawnMonsterTime() const -{ +int GUI::GetSpawnMonsterTime() const { return monster_spawntime; } -int GUI::GetSpawnNpcTime() const -{ +int GUI::GetSpawnNpcTime() const { return npc_spawntime; } -void GUI::SelectBrush() -{ - if(palettes.empty()) +void GUI::SelectBrush() { + if (palettes.empty()) { return; + } SelectBrushInternal(palettes.front()->GetSelectedBrush()); RefreshView(); } -bool GUI::SelectBrush(const Brush* whatbrush, PaletteType primary) -{ - if(palettes.empty()) - if(!CreatePalette()) +bool GUI::SelectBrush(const Brush* whatbrush, PaletteType primary) { + if (palettes.empty()) { + if (!CreatePalette()) { return false; + } + } - if(!palettes.front()->OnSelectBrush(whatbrush, primary)) + if (!palettes.front()->OnSelectBrush(whatbrush, primary)) { return false; + } SelectBrushInternal(const_cast(whatbrush)); root->GetAuiToolBar()->UpdateBrushButtons(); return true; } -void GUI::SelectBrushInternal(Brush* brush) -{ +void GUI::SelectBrushInternal(Brush* brush) { // Fear no evil don't you say no evil - if(current_brush != brush && brush) + if (current_brush != brush && brush) { previous_brush = current_brush; + } current_brush = brush; - if(!current_brush) + if (!current_brush) { return; + } brush_variation = std::min(brush_variation, brush->getMaxVariation()); FillDoodadPreviewBuffer(); - if(brush->isDoodad()) + if (brush->isDoodad()) { secondary_map = doodad_buffer_map; + } SetDrawingMode(); RefreshView(); } -void GUI::SelectPreviousBrush() -{ - if(previous_brush) +void GUI::SelectPreviousBrush() { + if (previous_brush) { SelectBrush(previous_brush); + } } -void GUI::FillDoodadPreviewBuffer() -{ - if(!current_brush || !current_brush->isDoodad()) +void GUI::FillDoodadPreviewBuffer() { + if (!current_brush || !current_brush->isDoodad()) { return; + } doodad_buffer_map->clear(); DoodadBrush* brush = current_brush->asDoodad(); - if(brush->isEmpty(GetBrushVariation())) + if (brush->isEmpty(GetBrushVariation())) { return; + } int object_count = 0; int area; - if(GetBrushShape() == BRUSHSHAPE_SQUARE) { - area = 2*GetBrushSize(); - area = area*area + 1; + if (GetBrushShape() == BRUSHSHAPE_SQUARE) { + area = 2 * GetBrushSize(); + area = area * area + 1; } else { - if(GetBrushSize() == 1) { + if (GetBrushSize() == 1) { // There is a huge deviation here with the other formula. area = 5; } else { area = int(0.5 + GetBrushSize() * GetBrushSize() * rme::PI); } } - const int object_range = (use_custom_thickness ? int(area*custom_thickness_mod) : brush->getThickness() * area / std::max(1, brush->getThicknessCeiling())); + const int object_range = (use_custom_thickness ? int(area * custom_thickness_mod) : brush->getThickness() * area / std::max(1, brush->getThicknessCeiling())); const int final_object_count = std::max(1, object_range + random(object_range)); Position center_pos(0x8000, 0x8000, 0x8); - if(brush_size > 0 && !brush->oneSizeFitsAll()) { - while(object_count < final_object_count) { + if (brush_size > 0 && !brush->oneSizeFitsAll()) { + while (object_count < final_object_count) { int retries = 0; bool exit = false; // Try to place objects 5 times - while(retries < 5 && !exit) { + while (retries < 5 && !exit) { int pos_retries = 0; int xpos = 0, ypos = 0; bool found_pos = false; - if(GetBrushShape() == BRUSHSHAPE_CIRCLE) { - while(pos_retries < 5 && !found_pos) { + if (GetBrushShape() == BRUSHSHAPE_CIRCLE) { + while (pos_retries < 5 && !found_pos) { xpos = random(-brush_size, brush_size); ypos = random(-brush_size, brush_size); - float distance = sqrt(float(xpos*xpos) + float(ypos*ypos)); - if(distance < g_gui.GetBrushSize() + 0.005) { + float distance = sqrt(float(xpos * xpos) + float(ypos * ypos)); + if (distance < g_gui.GetBrushSize() + 0.005) { found_pos = true; } else { ++pos_retries; @@ -1872,28 +1795,28 @@ void GUI::FillDoodadPreviewBuffer() ypos = random(-brush_size, brush_size); } - if(!found_pos) { + if (!found_pos) { ++retries; continue; } // Decide whether the zone should have a composite or several single objects. bool fail = false; - if(random(brush->getTotalChance(GetBrushVariation())) <= brush->getCompositeChance(GetBrushVariation())) { + if (random(brush->getTotalChance(GetBrushVariation())) <= brush->getCompositeChance(GetBrushVariation())) { // Composite - const CompositeTileList& composites = brush->getComposite(GetBrushVariation()); + const CompositeTileList &composites = brush->getComposite(GetBrushVariation()); // Figure out if the placement is valid for (const auto &composite : composites) { Position pos = center_pos + composite.first + Position(xpos, ypos, 0); - if(Tile* tile = doodad_buffer_map->getTile(pos)) { - if(!tile->empty()) { + if (Tile* tile = doodad_buffer_map->getTile(pos)) { + if (!tile->empty()) { fail = true; break; } } } - if(fail) { + if (fail) { ++retries; break; } @@ -1901,11 +1824,12 @@ void GUI::FillDoodadPreviewBuffer() // Transfer items to the stack for (const auto &composite : composites) { Position pos = center_pos + composite.first + Position(xpos, ypos, 0); - const ItemVector& items = composite.second; + const ItemVector &items = composite.second; Tile* tile = doodad_buffer_map->getTile(pos); - if(!tile) + if (!tile) { tile = doodad_buffer_map->allocator(doodad_buffer_map->createTileL(pos)); + } for (auto item : items) { tile->addItem(item->deepCopy()); @@ -1913,11 +1837,11 @@ void GUI::FillDoodadPreviewBuffer() doodad_buffer_map->setTile(tile->getPosition(), tile); } exit = true; - } else if(brush->hasSingleObjects(GetBrushVariation())) { + } else if (brush->hasSingleObjects(GetBrushVariation())) { Position pos = center_pos + Position(xpos, ypos, 0); Tile* tile = doodad_buffer_map->getTile(pos); - if(tile) { - if(!tile->empty()) { + if (tile) { + if (!tile->empty()) { fail = true; break; } @@ -1926,11 +1850,11 @@ void GUI::FillDoodadPreviewBuffer() } int variation = GetBrushVariation(); brush->draw(doodad_buffer_map, tile, &variation); - //std::cout << "\tpos: " << tile->getPosition() << std::endl; + // std::cout << "\tpos: " << tile->getPosition() << std::endl; doodad_buffer_map->setTile(tile->getPosition(), tile); exit = true; } - if(fail) { + if (fail) { ++retries; break; } @@ -1938,26 +1862,25 @@ void GUI::FillDoodadPreviewBuffer() ++object_count; } } else { - if(brush->hasCompositeObjects(GetBrushVariation()) && - random(brush->getTotalChance(GetBrushVariation())) <= brush->getCompositeChance(GetBrushVariation())) { + if (brush->hasCompositeObjects(GetBrushVariation()) && random(brush->getTotalChance(GetBrushVariation())) <= brush->getCompositeChance(GetBrushVariation())) { // Composite - const CompositeTileList& composites = brush->getComposite(GetBrushVariation()); + const CompositeTileList &composites = brush->getComposite(GetBrushVariation()); // All placement is valid... // Transfer items to the buffer for (const auto &composite : composites) { Position pos = center_pos + composite.first; - const ItemVector& items = composite.second; + const ItemVector &items = composite.second; Tile* tile = doodad_buffer_map->allocator(doodad_buffer_map->createTileL(pos)); - //std::cout << pos << " = " << center_pos << " + " << buffer_tile->getPosition() << std::endl; + // std::cout << pos << " = " << center_pos << " + " << buffer_tile->getPosition() << std::endl; for (auto item : items) { tile->addItem(item->deepCopy()); } doodad_buffer_map->setTile(tile->getPosition(), tile); } - } else if(brush->hasSingleObjects(GetBrushVariation())) { + } else if (brush->hasSingleObjects(GetBrushVariation())) { Tile* tile = doodad_buffer_map->allocator(doodad_buffer_map->createTileL(center_pos)); int variation = GetBrushVariation(); brush->draw(doodad_buffer_map, tile, &variation); @@ -1966,24 +1889,23 @@ void GUI::FillDoodadPreviewBuffer() } } -long GUI::PopupDialog(wxWindow* parent, wxString title, wxString text, long style, wxString confisavename, uint32_t configsavevalue) -{ - if(text.empty()) +long GUI::PopupDialog(wxWindow* parent, wxString title, wxString text, long style, wxString confisavename, uint32_t configsavevalue) { + if (text.empty()) { return wxID_ANY; + } wxMessageDialog dlg(parent, text, title, style); return dlg.ShowModal(); } -long GUI::PopupDialog(wxString title, wxString text, long style, wxString configsavename, uint32_t configsavevalue) -{ +long GUI::PopupDialog(wxString title, wxString text, long style, wxString configsavename, uint32_t configsavevalue) { return g_gui.PopupDialog(g_gui.root, title, text, style, configsavename, configsavevalue); } -void GUI::ListDialog(wxWindow* parent, wxString title, const wxArrayString& param_items) -{ - if(param_items.empty()) +void GUI::ListDialog(wxWindow* parent, wxString title, const wxArrayString ¶m_items) { + if (param_items.empty()) { return; + } wxArrayString list_items(param_items); @@ -1994,13 +1916,13 @@ void GUI::ListDialog(wxWindow* parent, wxString title, const wxArrayString& para wxListBox* item_list = newd wxListBox(dlg, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_SINGLE); item_list->SetMinSize(wxSize(500, 300)); - for(size_t i = 0; i != list_items.GetCount();) { + for (size_t i = 0; i != list_items.GetCount();) { wxString str = list_items[i]; size_t pos = str.find("\n"); - if(pos != wxString::npos) { + if (pos != wxString::npos) { // Split string! item_list->Append(str.substr(0, pos)); - list_items[i] = str.substr(pos+1); + list_items[i] = str.substr(pos + 1); continue; } item_list->Append(list_items[i]); @@ -2019,8 +1941,7 @@ void GUI::ListDialog(wxWindow* parent, wxString title, const wxArrayString& para delete dlg; } -void GUI::ShowTextBox(wxWindow* parent, wxString title, wxString content) -{ +void GUI::ShowTextBox(wxWindow* parent, wxString title, wxString content) { wxDialog* dlg = newd wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX); wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); wxTextCtrl* text_field = newd wxTextCtrl(dlg, wxID_ANY, content, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY); @@ -2035,21 +1956,18 @@ void GUI::ShowTextBox(wxWindow* parent, wxString title, wxString content) dlg->ShowModal(); } -void GUI::SetHotkey(int index, Hotkey& hotkey) -{ +void GUI::SetHotkey(int index, Hotkey &hotkey) { ASSERT(index >= 0 && index <= 9); hotkeys[index] = hotkey; SetStatusText("Set hotkey " + i2ws(index) + "."); } -const Hotkey& GUI::GetHotkey(int index) const -{ +const Hotkey &GUI::GetHotkey(int index) const { ASSERT(index >= 0 && index <= 9); return hotkeys[index]; } -void GUI::SaveHotkeys() const -{ +void GUI::SaveHotkeys() const { std::ostringstream os; for (const auto &hotkey : hotkeys) { os << hotkey << '\n'; @@ -2057,14 +1975,13 @@ void GUI::SaveHotkeys() const g_settings.setString(Config::NUMERICAL_HOTKEYS, os.str()); } -void GUI::LoadHotkeys() -{ +void GUI::LoadHotkeys() { std::istringstream is; is.str(g_settings.getString(Config::NUMERICAL_HOTKEYS)); std::string line; int index = 0; - while(getline(is, line)) { + while (getline(is, line)) { std::istringstream line_is; line_is.str(line); line_is >> hotkeys[index]; @@ -2074,40 +1991,36 @@ void GUI::LoadHotkeys() } Hotkey::Hotkey() : - type(NONE) -{ + type(NONE) { //// } -Hotkey::Hotkey(Position _pos) : type(POSITION), pos(_pos) -{ +Hotkey::Hotkey(Position _pos) : + type(POSITION), pos(_pos) { //// } -Hotkey::Hotkey(Brush* brush) : type(BRUSH), brushname(brush->getName()) -{ +Hotkey::Hotkey(Brush* brush) : + type(BRUSH), brushname(brush->getName()) { //// } -Hotkey::Hotkey(std::string _name) : type(BRUSH), brushname(_name) -{ +Hotkey::Hotkey(std::string _name) : + type(BRUSH), brushname(_name) { //// } -Hotkey::~Hotkey() -{ +Hotkey::~Hotkey() { //// } -std::ostream& operator<<(std::ostream& os, const Hotkey& hotkey) -{ - switch(hotkey.type) { +std::ostream &operator<<(std::ostream &os, const Hotkey &hotkey) { + switch (hotkey.type) { case Hotkey::POSITION: { os << "pos:{" << hotkey.pos << "}"; } break; case Hotkey::BRUSH: { - if(hotkey.brushname.find('{') != std::string::npos || - hotkey.brushname.find('}') != std::string::npos) { + if (hotkey.brushname.find('{') != std::string::npos || hotkey.brushname.find('}') != std::string::npos) { break; } os << "brush:{" << hotkey.brushname << "}"; @@ -2119,19 +2032,18 @@ std::ostream& operator<<(std::ostream& os, const Hotkey& hotkey) return os; } -std::istream& operator>>(std::istream& is, Hotkey& hotkey) -{ +std::istream &operator>>(std::istream &is, Hotkey &hotkey) { std::string type; getline(is, type, ':'); - if(type == "none") { + if (type == "none") { is.ignore(2); // ignore "{}" - } else if(type == "pos") { + } else if (type == "pos") { is.ignore(1); // ignore "{" Position pos; is >> pos; hotkey = Hotkey(pos); is.ignore(1); // ignore "}" - } else if(type == "brush") { + } else if (type == "brush") { is.ignore(1); // ignore "{" std::string brushname; getline(is, brushname, '}'); @@ -2143,13 +2055,11 @@ std::istream& operator>>(std::istream& is, Hotkey& hotkey) return is; } -void SetWindowToolTip(wxWindow* a, const wxString& tip) -{ +void SetWindowToolTip(wxWindow* a, const wxString &tip) { a->SetToolTip(tip); } -void SetWindowToolTip(wxWindow* a, wxWindow* b, const wxString& tip) -{ +void SetWindowToolTip(wxWindow* a, wxWindow* b, const wxString &tip) { a->SetToolTip(tip); b->SetToolTip(tip); } diff --git a/source/gui.h b/source/gui.h index 7490fd83..fdb32570 100644 --- a/source/gui.h +++ b/source/gui.h @@ -63,22 +63,21 @@ class LiveSocket; extern const wxEventType EVT_UPDATE_MENUS; extern const wxEventType EVT_UPDATE_ACTIONS; -#define EVT_ON_UPDATE_MENUS(id, fn) \ - DECLARE_EVENT_TABLE_ENTRY( \ - EVT_UPDATE_MENUS, id, wxID_ANY, \ - (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent(wxCommandEventFunction, &fn), \ - (wxObject*) nullptr \ - ), - -#define EVT_ON_UPDATE_ACTIONS(id, fn) \ - DECLARE_EVENT_TABLE_ENTRY( \ - EVT_UPDATE_ACTIONS, id, wxID_ANY, \ - (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent(wxCommandEventFunction, &fn), \ - (wxObject*) nullptr \ - ), - -class Hotkey -{ +#define EVT_ON_UPDATE_MENUS(id, fn) \ + DECLARE_EVENT_TABLE_ENTRY( \ + EVT_UPDATE_MENUS, id, wxID_ANY, \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCommandEventFunction, &fn), \ + (wxObject*)nullptr \ + ), + +#define EVT_ON_UPDATE_ACTIONS(id, fn) \ + DECLARE_EVENT_TABLE_ENTRY( \ + EVT_UPDATE_ACTIONS, id, wxID_ANY, \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCommandEventFunction, &fn), \ + (wxObject*)nullptr \ + ), + +class Hotkey { public: Hotkey(); Hotkey(Position pos); @@ -86,14 +85,23 @@ class Hotkey Hotkey(std::string _brushname); ~Hotkey(); - bool IsPosition() const {return type == POSITION;} - bool IsBrush() const {return type == BRUSH;} - Position GetPosition() const {ASSERT(IsPosition()); return pos;} - std::string GetBrushname() const {ASSERT(IsBrush()); return brushname;} + bool IsPosition() const { + return type == POSITION; + } + bool IsBrush() const { + return type == BRUSH; + } + Position GetPosition() const { + ASSERT(IsPosition()); + return pos; + } + std::string GetBrushname() const { + ASSERT(IsBrush()); + return brushname; + } private: - enum - { + enum { NONE, POSITION, BRUSH, @@ -102,23 +110,22 @@ class Hotkey Position pos; std::string brushname; - friend std::ostream& operator<<(std::ostream& os, const Hotkey& hotkey); - friend std::istream& operator>>(std::istream& os, Hotkey& hotkey); + friend std::ostream &operator<<(std::ostream &os, const Hotkey &hotkey); + friend std::istream &operator>>(std::istream &os, Hotkey &hotkey); }; -std::ostream& operator<<(std::ostream& os, const Hotkey& hotkey); -std::istream& operator>>(std::istream& os, Hotkey& hotkey); +std::ostream &operator<<(std::ostream &os, const Hotkey &hotkey); +std::istream &operator>>(std::istream &os, Hotkey &hotkey); -class GUI -{ +class GUI { public: // dtor and ctor GUI(); ~GUI(); private: - GUI(const GUI& g_gui); // Don't copy me - GUI& operator=(const GUI& g_gui); // Don't assign me - bool operator==(const GUI& g_gui); // Don't compare me + GUI(const GUI &g_gui); // Don't copy me + GUI &operator=(const GUI &g_gui); // Don't assign me + bool operator==(const GUI &g_gui); // Don't compare me public: /** @@ -144,7 +151,7 @@ class GUI * If this returns false, the user has hit the quit button and you should * abort the loading. */ - bool SetLoadDone(int32_t done, const wxString& newMessage = ""); + bool SetLoadDone(int32_t done, const wxString &newMessage = ""); /** * Sets the scale of the loading bar. @@ -155,7 +162,7 @@ class GUI void ShowWelcomeDialog(const wxBitmap &icon); void FinishWelcomeDialog(); - bool IsWelcomeDialogShown(); + bool IsWelcomeDialogShown(); /** * Destroys (hides) the current loading bar. @@ -164,21 +171,27 @@ class GUI void UpdateMenubar(); - bool IsRenderingEnabled() const {return disabled_counter == 0;} + bool IsRenderingEnabled() const { + return disabled_counter == 0; + } void EnableHotkeys(); void DisableHotkeys(); bool AreHotkeysEnabled() const; // This sends the event to the main window (redirecting from other controls) - void AddPendingCanvasEvent(wxEvent& event); + void AddPendingCanvasEvent(wxEvent &event); - void OnWelcomeDialogClosed(wxCloseEvent &event); - void OnWelcomeDialogAction(wxCommandEvent &event); + void OnWelcomeDialogClosed(wxCloseEvent &event); + void OnWelcomeDialogAction(wxCommandEvent &event); protected: - void DisableRendering() {++disabled_counter;} - void EnableRendering() {--disabled_counter;} + void DisableRendering() { + ++disabled_counter; + } + void EnableRendering() { + --disabled_counter; + } public: void SetTitle(wxString newtitle); @@ -192,11 +205,15 @@ class GUI long PopupDialog(wxWindow* parent, wxString title, wxString text, long style, wxString configsavename = wxEmptyString, uint32_t configsavevalue = 0); long PopupDialog(wxString title, wxString text, long style, wxString configsavename = wxEmptyString, uint32_t configsavevalue = 0); - void ListDialog(wxWindow* parent, wxString title, const wxArrayString& vec); - void ListDialog(const wxString& title, const wxArrayString& vec) { ListDialog(nullptr, title, vec); } + void ListDialog(wxWindow* parent, wxString title, const wxArrayString &vec); + void ListDialog(const wxString &title, const wxArrayString &vec) { + ListDialog(nullptr, title, vec); + } void ShowTextBox(wxWindow* parent, wxString title, wxString contents); - void ShowTextBox(const wxString& title, const wxString& contents) {ShowTextBox(nullptr, title, contents);} + void ShowTextBox(const wxString &title, const wxString &contents) { + ShowTextBox(nullptr, title, contents); + } // Get the current GL context // Param is required if the context is to be created. @@ -225,11 +242,15 @@ class GUI void SwitchMode(); void SetSelectionMode(); void SetDrawingMode(); - bool IsSelectionMode() const {return mode == SELECTION_MODE;} - bool IsDrawingMode() const {return mode == DRAWING_MODE;} + bool IsSelectionMode() const { + return mode == SELECTION_MODE; + } + bool IsDrawingMode() const { + return mode == DRAWING_MODE; + } - void SetHotkey(int index, Hotkey& hotkey); - const Hotkey& GetHotkey(int index) const; + void SetHotkey(int index, Hotkey &hotkey); + const Hotkey &GetHotkey(int index) const; void SaveHotkeys() const; void LoadHotkeys(); @@ -253,8 +274,12 @@ class GUI int GetSpawnNpcTime() const; // Additional brush parameters - void SetSpawnMonsterTime(int time) {monster_spawntime = time;} - void SetSpawnNpcTime(int time) {npc_spawntime = time;} + void SetSpawnMonsterTime(int time) { + monster_spawntime = time; + } + void SetSpawnNpcTime(int time) { + npc_spawntime = time; + } void SetBrushSize(int nz); void SetBrushSizeInternal(int nz); void SetBrushShape(BrushShape bs); @@ -265,7 +290,6 @@ class GUI void DecreaseBrushSize(bool wrap = false); void IncreaseBrushSize(bool wrap = false); - // Fetch different useful directories static wxString GetExecDirectory(); static wxString GetDataDirectory(); @@ -273,20 +297,24 @@ class GUI static wxString GetLocalDirectory(); static wxString GetExtensionsDirectory(); - void discoverDataDirectory(const wxString& existentFile); - wxString getFoundDataDirectory() { return m_dataDirectory; } + void discoverDataDirectory(const wxString &existentFile); + wxString getFoundDataDirectory() { + return m_dataDirectory; + } // Load/unload a client version (takes care of dialogs aswell) void UnloadVersion(); - bool LoadVersion(ClientVersionID ver, wxString& error, wxArrayString& warnings, bool force = false); + bool LoadVersion(ClientVersionID ver, wxString &error, wxArrayString &warnings, bool force = false); // The current version loaded (returns CLIENT_VERSION_NONE if no version is loaded) - const ClientVersion& GetCurrentVersion() const; + const ClientVersion &GetCurrentVersion() const; ClientVersionID GetCurrentVersionID() const; // If any version is loaded at all - bool IsVersionLoaded() const {return loaded_version != CLIENT_VERSION_NONE;} + bool IsVersionLoaded() const { + return loaded_version != CLIENT_VERSION_NONE; + } // Centers current view on position - void SetScreenCenterPosition(const Position& position, bool showIndicator = true); + void SetScreenCenterPosition(const Position &position, bool showIndicator = true); // Refresh the view canvas void RefreshView(); // Fit all/specified current map view to map dimensions @@ -299,7 +327,9 @@ class GUI void PreparePaste(); void StartPasting(); void EndPasting(); - bool IsPasting() const { return pasting; } + bool IsPasting() const { + return pasting; + } bool CanUndo(); bool CanRedo(); @@ -307,7 +337,9 @@ class GUI bool DoRedo(); // Editor interface - wxAuiManager* GetAuiManager() const { return aui_manager; } + wxAuiManager* GetAuiManager() const { + return aui_manager; + } EditorTab* GetCurrentTab(); EditorTab* GetTab(int idx); int GetTabCount() const; @@ -322,19 +354,21 @@ class GUI void NewMapView(); // Map - Map& GetCurrentMap(); + Map &GetCurrentMap(); int GetOpenMapCount(); bool ShouldSave(); void SaveCurrentMap(FileName filename, bool showdialog); // "" means default filename - void SaveCurrentMap(bool showdialog = true) {SaveCurrentMap(wxString(""), showdialog);} + void SaveCurrentMap(bool showdialog = true) { + SaveCurrentMap(wxString(""), showdialog); + } bool NewMap(); void OpenMap(); void SaveMap(); void SaveMapAs(); - bool LoadMap(const FileName& fileName); + bool LoadMap(const FileName &fileName); protected: - bool LoadDataFiles(wxString& error, wxArrayString& warnings); + bool LoadDataFiles(wxString &error, wxArrayString &warnings); ClientVersion* getLoadedVersion() const { return loaded_version == CLIENT_VERSION_NONE ? nullptr : ClientVersion::get(loaded_version); } @@ -361,7 +395,7 @@ class GUI // Returns primary palette PaletteWindow* GetPalette(); // Returns list of all palette, first in the list is primary - const std::list& GetPalettes(); + const std::list &GetPalettes(); // Hidden from public view protected: @@ -411,7 +445,6 @@ class GUI FlagBrush* pvp_brush; protected: - //========================================================================= // Global GUI state //========================================================================= @@ -462,20 +495,18 @@ class GUI extern GUI g_gui; -class RenderingLock -{ +class RenderingLock { bool acquired; + public: - RenderingLock() : acquired(true) - { + RenderingLock() : + acquired(true) { g_gui.DisableRendering(); } - ~RenderingLock() - { + ~RenderingLock() { release(); } - void release() - { + void release() { g_gui.EnableRendering(); acquired = false; } @@ -486,32 +517,27 @@ class RenderingLock * which will the be popped when it destructs. * Look in the GUI class for documentation of what the methods mean. */ -class ScopedLoadingBar -{ +class ScopedLoadingBar { public: - ScopedLoadingBar(wxString message, bool canCancel = false) - { + ScopedLoadingBar(wxString message, bool canCancel = false) { g_gui.CreateLoadBar(message, canCancel); } - ~ScopedLoadingBar() - { + ~ScopedLoadingBar() { g_gui.DestroyLoadBar(); } - void SetLoadDone(int32_t done, const wxString& newmessage = wxEmptyString) - { + void SetLoadDone(int32_t done, const wxString &newmessage = wxEmptyString) { g_gui.SetLoadDone(done, newmessage); } - void SetLoadScale(int32_t from, int32_t to) - { + void SetLoadScale(int32_t from, int32_t to) { g_gui.SetLoadScale(from, to); } }; #define UnnamedRenderingLock() RenderingLock __unnamed_rendering_lock_##__LINE__ -void SetWindowToolTip(wxWindow* a, const wxString& tip); -void SetWindowToolTip(wxWindow* a, wxWindow* b, const wxString& tip); +void SetWindowToolTip(wxWindow* a, const wxString &tip); +void SetWindowToolTip(wxWindow* a, wxWindow* b, const wxString &tip); #endif diff --git a/source/gui_ids.h b/source/gui_ids.h index 64566514..141a27aa 100644 --- a/source/gui_ids.h +++ b/source/gui_ids.h @@ -37,8 +37,7 @@ enum EditorMode { }; // Window IDs -enum EditorActionID -{ +enum EditorActionID { MAIN_FRAME_MENU = wxID_HIGHEST + 1, MAP_WINDOW_HSCROLL = MAIN_FRAME_MENU + 1000, diff --git a/source/house.cpp b/source/house.cpp index 32961530..761b122c 100644 --- a/source/house.cpp +++ b/source/house.cpp @@ -22,65 +22,62 @@ #include "tile.h" #include "map.h" -Houses::Houses(Map& map) : +Houses::Houses(Map &map) : map(map), - max_house_id(0) -{ + max_house_id(0) { //// } -Houses::~Houses() -{ - for(auto it = houses.begin(); it != houses.end(); ++it) +Houses::~Houses() { + for (auto it = houses.begin(); it != houses.end(); ++it) { delete it->second; + } houses.clear(); } -uint32_t Houses::getEmptyID() -{ +uint32_t Houses::getEmptyID() { return ++max_house_id; } -void Houses::addHouse(House* new_house) -{ +void Houses::addHouse(House* new_house) { ASSERT(new_house); HouseMap::iterator it = houses.find(new_house->id); ASSERT(it == houses.end()); new_house->map = ↦ - if(new_house->id > max_house_id) + if (new_house->id > max_house_id) { max_house_id = new_house->id; + } houses[new_house->id] = new_house; } -void Houses::removeHouse(House* house_to_remove) -{ +void Houses::removeHouse(House* house_to_remove) { HouseMap::iterator it = houses.find(house_to_remove->id); - if(it != houses.end()) + if (it != houses.end()) { houses.erase(it); + } house_to_remove->clean(); delete house_to_remove; } -House* Houses::getHouse(uint32_t houseid) -{ +House* Houses::getHouse(uint32_t houseid) { HouseMap::iterator it = houses.find(houseid); - if(it != houses.end()) { + if (it != houses.end()) { return it->second; } return nullptr; } -const House* Houses::getHouse(uint32_t houseid) const -{ +const House* Houses::getHouse(uint32_t houseid) const { HouseMap::const_iterator it = houses.find(houseid); - if(it != houses.end()) + if (it != houses.end()) { return it->second; + } return nullptr; } -House::House(Map& map) : +House::House(Map &map) : id(0), rent(0), townid(0), @@ -88,48 +85,46 @@ House::House(Map& map) : clientid(0), beds(0), map(&map), - exit(0,0,0) -{ + exit(0, 0, 0) { //// } -void House::clean() -{ - for(PositionList::const_iterator pos_iter = tiles.begin(); pos_iter != tiles.end(); ++pos_iter) { +void House::clean() { + for (PositionList::const_iterator pos_iter = tiles.begin(); pos_iter != tiles.end(); ++pos_iter) { Tile* tile = map->getTile(*pos_iter); - if(tile) + if (tile) { tile->setHouse(nullptr); + } } Tile* tile = map->getTile(exit); - if(tile) + if (tile) { tile->removeHouseExit(this); + } } -size_t House::size() const -{ +size_t House::size() const { size_t count = 0; - for(PositionList::const_iterator pos_iter = tiles.begin(); pos_iter != tiles.end(); ++pos_iter) { + for (PositionList::const_iterator pos_iter = tiles.begin(); pos_iter != tiles.end(); ++pos_iter) { auto tile = map->getTile(*pos_iter); auto topItem = tile->getTopItem(); - if(tile && (!tile->getWall() || tile->getTable() || topItem->isDoor())) + if (tile && (!tile->getWall() || tile->getTable() || topItem->isDoor())) { ++count; + } } return count; } -void House::addTile(Tile* tile) -{ +void House::addTile(Tile* tile) { ASSERT(tile); tile->setHouse(this); tiles.push_back(tile->getPosition()); } -void House::removeTile(Tile* tile) -{ +void House::removeTile(Tile* tile) { ASSERT(tile); - for(PositionList::iterator tile_iter = tiles.begin(); tile_iter != tiles.end(); ++tile_iter) { - if(*tile_iter == tile->getPosition()) { + for (PositionList::iterator tile_iter = tiles.begin(); tile_iter != tiles.end(); ++tile_iter) { + if (*tile_iter == tile->getPosition()) { tiles.erase(tile_iter); tile->setHouse(nullptr); return; @@ -137,21 +132,21 @@ void House::removeTile(Tile* tile) } } -uint8_t House::getEmptyDoorID() const -{ +uint8_t House::getEmptyDoorID() const { std::set taken; - for(PositionList::const_iterator tile_iter = tiles.begin(); tile_iter != tiles.end(); ++tile_iter) { - if(const Tile* tile = map->getTile(*tile_iter)) { - for(ItemVector::const_iterator item_iter = tile->items.begin(); item_iter != tile->items.end(); ++item_iter) { - if(Door* door = dynamic_cast(*item_iter)) + for (PositionList::const_iterator tile_iter = tiles.begin(); tile_iter != tiles.end(); ++tile_iter) { + if (const Tile* tile = map->getTile(*tile_iter)) { + for (ItemVector::const_iterator item_iter = tile->items.begin(); item_iter != tile->items.end(); ++item_iter) { + if (Door* door = dynamic_cast(*item_iter)) { taken.insert(door->getDoorID()); + } } } } - for(int i = 1; i < 256; ++i) { + for (int i = 1; i < 256; ++i) { std::set::iterator it = taken.find(uint8_t(i)); - if(it == taken.end()) { + if (it == taken.end()) { // Free ID! return i; } @@ -159,13 +154,12 @@ uint8_t House::getEmptyDoorID() const return 255; } -Position House::getDoorPositionByID(uint8_t id) const -{ - for(PositionList::const_iterator tile_iter = tiles.begin(); tile_iter != tiles.end(); ++tile_iter) { - if(const Tile* tile = map->getTile(*tile_iter)) { - for(ItemVector::const_iterator item_iter = tile->items.begin(); item_iter != tile->items.end(); ++item_iter) { - if(Door* door = dynamic_cast(*item_iter)) { - if(door->getDoorID() == id) { +Position House::getDoorPositionByID(uint8_t id) const { + for (PositionList::const_iterator tile_iter = tiles.begin(); tile_iter != tiles.end(); ++tile_iter) { + if (const Tile* tile = map->getTile(*tile_iter)) { + for (ItemVector::const_iterator item_iter = tile->items.begin(); item_iter != tile->items.end(); ++item_iter) { + if (Door* door = dynamic_cast(*item_iter)) { + if (door->getDoorID() == id) { return *tile_iter; } } @@ -175,28 +169,28 @@ Position House::getDoorPositionByID(uint8_t id) const return Position(); } -std::string House::getDescription() -{ +std::string House::getDescription() { std::ostringstream os; os << name; os << " (ID:" << id << "; Rent: " << rent << "; Max Beds: " << beds << ")"; return os.str(); } -void House::setExit(Map* targetmap, const Position& pos) -{ +void House::setExit(Map* targetmap, const Position &pos) { // This might fail when the user decides to put an exit at 0,0,0, let's just hope noone does (Noone SHOULD, so there is no problem? Hm?) - if(pos == exit || !pos.isValid()) + if (pos == exit || !pos.isValid()) { return; + } - if(exit.isValid()) { + if (exit.isValid()) { Tile* oldexit = targetmap->getTile(exit); - if(oldexit) + if (oldexit) { oldexit->removeHouseExit(this); + } } Tile* newexit = targetmap->getTile(pos); - if(!newexit) { + if (!newexit) { newexit = targetmap->allocator(targetmap->createTileL(pos)); targetmap->setTile(pos, newexit); } @@ -205,7 +199,6 @@ void House::setExit(Map* targetmap, const Position& pos) exit = pos; } -void House::setExit(const Position& pos) -{ +void House::setExit(const Position &pos) { setExit(map, pos); } diff --git a/source/house.h b/source/house.h index fe3d3783..35664aec 100644 --- a/source/house.h +++ b/source/house.h @@ -26,10 +26,9 @@ class Door; class Houses; -class House -{ +class House { public: - House(Map& map); + House(Map &map); void clean(); void addTile(Tile* tile); @@ -41,14 +40,16 @@ class House int rent; int clientid; int beds; - //HouseDoorList doorList; + // HouseDoorList doorList; std::string name; uint32_t townid; bool guildhall; - void setExit(const Position& pos); - void setExit(Map* map, const Position& pos); - const Position& getExit() const noexcept { return exit; } + void setExit(const Position &pos); + void setExit(Map* map, const Position &pos); + const Position &getExit() const noexcept { + return exit; + } uint8_t getEmptyDoorID() const; Position getDoorPositionByID(uint8_t id) const; @@ -64,29 +65,46 @@ typedef std::map HouseMap; class Houses { public: - Houses(Map& map); + Houses(Map &map); ~Houses(); - uint32_t count() const {return houses.size();} - - HouseMap::iterator begin() {return houses.begin();} - HouseMap::iterator end() {return houses.end();} - HouseMap::const_iterator begin() const {return houses.begin();} - HouseMap::const_iterator end() const {return houses.end();} + uint32_t count() const { + return houses.size(); + } + + HouseMap::iterator begin() { + return houses.begin(); + } + HouseMap::iterator end() { + return houses.end(); + } + HouseMap::const_iterator begin() const { + return houses.begin(); + } + HouseMap::const_iterator end() const { + return houses.end(); + } #ifdef __VISUALC__ // C++0x compliance to some degree :) - HouseMap::iterator erase(HouseMap::iterator iter) {return houses.erase(iter);} + HouseMap::iterator erase(HouseMap::iterator iter) { + return houses.erase(iter); + } #else - void erase(HouseMap::iterator iter) { houses.erase(iter); } + void erase(HouseMap::iterator iter) { + houses.erase(iter); + } #endif - HouseMap::iterator find(uint32_t val) {return houses.find(val);} + HouseMap::iterator find(uint32_t val) { + return houses.find(val); + } void removeHouse(House* house_to_remove); void addHouse(House* new_house); House* getHouse(uint32_t houseid); const House* getHouse(uint32_t houseid) const; uint32_t getEmptyID(); + protected: - Map& map; + Map ↦ uint32_t max_house_id; HouseMap houses; }; diff --git a/source/house_brush.cpp b/source/house_brush.cpp index e76ff721..c90299e9 100644 --- a/source/house_brush.cpp +++ b/source/house_brush.cpp @@ -27,61 +27,54 @@ HouseBrush::HouseBrush() : Brush(), - draw_house(nullptr) -{ + draw_house(nullptr) { //// } -HouseBrush::~HouseBrush() -{ +HouseBrush::~HouseBrush() { //// } -void HouseBrush::setHouse(House* house) -{ +void HouseBrush::setHouse(House* house) { draw_house = house; } -uint32_t HouseBrush::getHouseID() const -{ - if(draw_house) +uint32_t HouseBrush::getHouseID() const { + if (draw_house) { return draw_house->id; + } return 0; } -void HouseBrush::undraw(BaseMap* map, Tile* tile) -{ - if(tile->isHouseTile()) { +void HouseBrush::undraw(BaseMap* map, Tile* tile) { + if (tile->isHouseTile()) { tile->setPZ(false); } tile->setHouse(nullptr); - if(g_settings.getInteger(Config::AUTO_ASSIGN_DOORID)) { + if (g_settings.getInteger(Config::AUTO_ASSIGN_DOORID)) { // Is there a door? If so, remove any door id it has - for(ItemVector::iterator it = tile->items.begin(); - it != tile->items.end(); - ++it) - { - if(Door* door = dynamic_cast(*it)) { + for (ItemVector::iterator it = tile->items.begin(); + it != tile->items.end(); + ++it) { + if (Door* door = dynamic_cast(*it)) { door->setDoorID(0); } } } } -void HouseBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void HouseBrush::draw(BaseMap* map, Tile* tile, void* parameter) { ASSERT(draw_house); uint32_t old_house_id = tile->getHouseID(); tile->setHouse(draw_house); tile->setPZ(true); - if(g_settings.getInteger(Config::HOUSE_BRUSH_REMOVE_ITEMS)) { + if (g_settings.getInteger(Config::HOUSE_BRUSH_REMOVE_ITEMS)) { // Remove loose items - for(ItemVector::iterator it = tile->items.begin(); - it != tile->items.end(); - /*..*/) - { + for (ItemVector::iterator it = tile->items.begin(); + it != tile->items.end(); + /*..*/) { Item* item = *it; - if(item->isNotMoveable() == 0) { + if (item->isNotMoveable() == 0) { delete item; it = tile->items.erase(it); } else { @@ -89,16 +82,15 @@ void HouseBrush::draw(BaseMap* map, Tile* tile, void* parameter) } } } - if(g_settings.getInteger(Config::AUTO_ASSIGN_DOORID)) { + if (g_settings.getInteger(Config::AUTO_ASSIGN_DOORID)) { // Is there a door? If so, find an empty ID and assign it (if the door doesn't already have an id. - for(ItemVector::iterator it = tile->items.begin(); - it != tile->items.end(); - ++it) - { - if(Door* door = dynamic_cast(*it)) { - if(door->getDoorID() == 0 || old_house_id != 0) { + for (ItemVector::iterator it = tile->items.begin(); + it != tile->items.end(); + ++it) { + if (Door* door = dynamic_cast(*it)) { + if (door->getDoorID() == 0 || old_house_id != 0) { Map* real_map = dynamic_cast(map); - if(real_map) { + if (real_map) { door->setDoorID(draw_house->getEmptyDoorID()); } } @@ -106,6 +98,5 @@ void HouseBrush::draw(BaseMap* map, Tile* tile, void* parameter) } } // The tile will automagically be added to the house via the Action functions - //draw_house->addTile(tile); + // draw_house->addTile(tile); } - diff --git a/source/house_brush.h b/source/house_brush.h index ca6e30a0..64c2aba1 100644 --- a/source/house_brush.h +++ b/source/house_brush.h @@ -26,32 +26,45 @@ // Should be deleted by the owning palette // Forward declaration -class HouseBrush : public Brush -{ +class HouseBrush : public Brush { public: HouseBrush(); virtual ~HouseBrush(); - bool isHouse() const { return true; } - HouseBrush* asHouse() { return static_cast(this); } + bool isHouse() const { + return true; + } + HouseBrush* asHouse() { + return static_cast(this); + } // Not used - virtual bool load(pugi::xml_node node, wxArrayString& warnings) {return true;} + virtual bool load(pugi::xml_node node, wxArrayString &warnings) { + return true; + } // You can always draw house tiles! - virtual bool canDraw(BaseMap* map, const Position& position) const {return true;} + virtual bool canDraw(BaseMap* map, const Position &position) const { + return true; + } // Draw the shit! virtual void draw(BaseMap* map, Tile* tile, void* parameter); // Undraw the shit! virtual void undraw(BaseMap* map, Tile* tile); - virtual bool canDrag() const {return true;} + virtual bool canDrag() const { + return true; + } void setHouse(House* house); uint32_t getHouseID() const; - virtual int getLookID() const { return 0; } // We don't have a graphic - virtual std::string getName() const { return "House Brush"; } + virtual int getLookID() const { + return 0; + } // We don't have a graphic + virtual std::string getName() const { + return "House Brush"; + } protected: House* draw_house; diff --git a/source/house_exit_brush.cpp b/source/house_exit_brush.cpp index 900e7777..b3a2c79a 100644 --- a/source/house_exit_brush.cpp +++ b/source/house_exit_brush.cpp @@ -26,47 +26,39 @@ HouseExitBrush::HouseExitBrush() : Brush(), - draw_house(0) -{ + draw_house(0) { //// } -HouseExitBrush::~HouseExitBrush() -{ +HouseExitBrush::~HouseExitBrush() { //// } -void HouseExitBrush::setHouse(House* house) -{ +void HouseExitBrush::setHouse(House* house) { draw_house = house->id; } -uint32_t HouseExitBrush::getHouseID() const -{ +uint32_t HouseExitBrush::getHouseID() const { return draw_house; } - -bool HouseExitBrush::canDraw(BaseMap* map, const Position& position) const -{ +bool HouseExitBrush::canDraw(BaseMap* map, const Position &position) const { Tile* tile = map->getTile(position); - if(!tile || !tile->hasGround()) { + if (!tile || !tile->hasGround()) { return false; } - if(tile->isHouseTile() || tile->isBlocking()) { + if (tile->isHouseTile() || tile->isBlocking()) { return false; } return true; } -void HouseExitBrush::undraw(BaseMap* map, Tile* tile) -{ +void HouseExitBrush::undraw(BaseMap* map, Tile* tile) { // Never called ASSERT(false); } -void HouseExitBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void HouseExitBrush::draw(BaseMap* map, Tile* tile, void* parameter) { // Never called ASSERT(false); } diff --git a/source/house_exit_brush.h b/source/house_exit_brush.h index c62f6915..b52adbf3 100644 --- a/source/house_exit_brush.h +++ b/source/house_exit_brush.h @@ -25,32 +25,47 @@ // This doesn't actually draw anything, and the draw/undraw functions will ASSERT if // you try to call them, so I strongly advice against it -class HouseExitBrush : public Brush -{ +class HouseExitBrush : public Brush { public: HouseExitBrush(); virtual ~HouseExitBrush(); - bool isHouseExit() const { return true; } - HouseExitBrush* asHouseExit() { return static_cast(this); } + bool isHouseExit() const { + return true; + } + HouseExitBrush* asHouseExit() { + return static_cast(this); + } // Not used - virtual bool load(pugi::xml_node node, wxArrayString& warnings) { return true; } + virtual bool load(pugi::xml_node node, wxArrayString &warnings) { + return true; + } - virtual bool canDraw(BaseMap* map, const Position& position) const; + virtual bool canDraw(BaseMap* map, const Position &position) const; // Will ASSERT virtual void draw(BaseMap* map, Tile* tile, void* parameter); virtual void undraw(BaseMap* map, Tile* tile); - virtual bool canDrag() const { return false; } - virtual bool canSmear() const { return false; } - virtual bool oneSizeFitsAll() const { return true; } + virtual bool canDrag() const { + return false; + } + virtual bool canSmear() const { + return false; + } + virtual bool oneSizeFitsAll() const { + return true; + } void setHouse(House* house); uint32_t getHouseID() const; - virtual int getLookID() const { return 0; } // We don't have a graphic - virtual std::string getName() const { return "House Exit Brush"; } // We don't have a name + virtual int getLookID() const { + return 0; + } // We don't have a graphic + virtual std::string getName() const { + return "House Exit Brush"; + } // We don't have a name protected: uint32_t draw_house; diff --git a/source/iomap.cpp b/source/iomap.cpp index 344cd80a..2e96ded7 100644 --- a/source/iomap.cpp +++ b/source/iomap.cpp @@ -18,16 +18,14 @@ #include "main.h" #include "gui.h" -void IOMap::error(const wxString format, ...) -{ +void IOMap::error(const wxString format, ...) { va_list argp; va_start(argp, format); errorstr.PrintfV(format, argp); va_end(argp); }; -void IOMap::warning(const wxString format, ...) -{ +void IOMap::warning(const wxString format, ...) { wxString s; va_list argp; va_start(argp, format); @@ -36,7 +34,6 @@ void IOMap::warning(const wxString format, ...) warnings.push_back(s); }; -bool IOMap::queryUser(const wxString& title, const wxString& text) -{ +bool IOMap::queryUser(const wxString &title, const wxString &text) { return g_gui.PopupDialog(title, text, wxYES | wxNO) == wxID_YES; } diff --git a/source/iomap.h b/source/iomap.h index 186e1e63..bccbe80e 100644 --- a/source/iomap.h +++ b/source/iomap.h @@ -20,8 +20,7 @@ #include "client_version.h" -enum ImportType -{ +enum ImportType { IMPORT_DONT, IMPORT_MERGE, IMPORT_SMART_MERGE, @@ -30,40 +29,47 @@ enum ImportType class Map; -class IOMap -{ +class IOMap { protected: wxArrayString warnings; wxString errorstr; - bool queryUser(const wxString& title, const wxString& format); + bool queryUser(const wxString &title, const wxString &format); void warning(const wxString format, ...); void error(const wxString format, ...); + public: IOMap() { version.otbm = MAP_OTBM_1; version.client = CLIENT_VERSION_NONE; } - virtual ~IOMap() {} + virtual ~IOMap() { } MapVersion version; - wxArrayString& getWarnings() {return warnings;} - wxString& getError() {return errorstr;} + wxArrayString &getWarnings() { + return warnings; + } + wxString &getError() { + return errorstr; + } - virtual bool loadMap(Map& map, const FileName& identifier) = 0; - virtual bool saveMap(Map& map, const FileName& identifier) = 0; + virtual bool loadMap(Map &map, const FileName &identifier) = 0; + virtual bool saveMap(Map &map, const FileName &identifier) = 0; }; - class VirtualIOMap : public IOMap { public: VirtualIOMap(MapVersion v) { version = v; } - virtual bool loadMap(Map& map, const FileName& identifier) {return false;} - virtual bool saveMap(Map& map, const FileName& identifier) {return false;} + virtual bool loadMap(Map &map, const FileName &identifier) { + return false; + } + virtual bool saveMap(Map &map, const FileName &identifier) { + return false; + } }; #endif diff --git a/source/iomap_otbm.cpp b/source/iomap_otbm.cpp index 74d243d3..f4fed184 100644 --- a/source/iomap_otbm.cpp +++ b/source/iomap_otbm.cpp @@ -36,8 +36,7 @@ typedef uint8_t attribute_t; typedef uint32_t flags_t; // H4X -void reform(Map* map, Tile* tile, Item* item) -{ +void reform(Map* map, Tile* tile, Item* item) { /* int aid = item->getActionID(); int id = item->getID(); @@ -59,29 +58,27 @@ void reform(Map* map, Tile* tile, Item* item) // ============================================================================ // Item -Item* Item::Create_OTBM(const IOMap& maphandle, BinaryNode* stream) -{ +Item* Item::Create_OTBM(const IOMap &maphandle, BinaryNode* stream) { uint16_t id; - if(!stream->getU16(id)) { + if (!stream->getU16(id)) { return nullptr; } - const ItemType& type = g_items.getItemType(id); + const ItemType &type = g_items.getItemType(id); uint8_t count = 0; - if(maphandle.version.otbm == MAP_OTBM_1) { - if(type.stackable || type.isSplash() || type.isFluidContainer()) { + if (maphandle.version.otbm == MAP_OTBM_1) { + if (type.stackable || type.isSplash() || type.isFluidContainer()) { stream->getU8(count); } } return Item::Create(id, count); } -bool Item::readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute attr, BinaryNode* stream) -{ +bool Item::readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attr, BinaryNode* stream) { switch (attr) { case OTBM_ATTR_COUNT: { uint8_t subtype; - if(!stream->getU8(subtype)) { + if (!stream->getU8(subtype)) { return false; } setSubtype(subtype); @@ -89,7 +86,7 @@ bool Item::readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute att } case OTBM_ATTR_ACTION_ID: { uint16_t aid; - if(!stream->getU16(aid)) { + if (!stream->getU16(aid)) { return false; } setActionID(aid); @@ -97,7 +94,7 @@ bool Item::readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute att } case OTBM_ATTR_UNIQUE_ID: { uint16_t uid; - if(!stream->getU16(uid)) { + if (!stream->getU16(uid)) { return false; } setUniqueID(uid); @@ -105,7 +102,7 @@ bool Item::readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute att } case OTBM_ATTR_CHARGES: { uint16_t charges; - if(!stream->getU16(charges)) { + if (!stream->getU16(charges)) { return false; } setSubtype(charges); @@ -113,7 +110,7 @@ bool Item::readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute att } case OTBM_ATTR_TEXT: { std::string text; - if(!stream->getString(text)) { + if (!stream->getString(text)) { return false; } setText(text); @@ -121,7 +118,7 @@ bool Item::readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute att } case OTBM_ATTR_DESC: { std::string text; - if(!stream->getString(text)) { + if (!stream->getString(text)) { return false; } setDescription(text); @@ -129,7 +126,7 @@ bool Item::readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute att } case OTBM_ATTR_RUNE_CHARGES: { uint8_t subtype; - if(!stream->getU8(subtype)) { + if (!stream->getU8(subtype)) { return false; } setSubtype(subtype); @@ -139,83 +136,83 @@ bool Item::readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute att // The following *should* be handled in the derived classes // However, we still need to handle them here since otherwise things // will break horribly - case OTBM_ATTR_DEPOT_ID: return stream->skip(2); - case OTBM_ATTR_HOUSEDOORID: return stream->skip(1); - case OTBM_ATTR_TELE_DEST: return stream->skip(5); - default: return false; + case OTBM_ATTR_DEPOT_ID: + return stream->skip(2); + case OTBM_ATTR_HOUSEDOORID: + return stream->skip(1); + case OTBM_ATTR_TELE_DEST: + return stream->skip(5); + default: + return false; } return true; } -bool Item::unserializeAttributes_OTBM(const IOMap& maphandle, BinaryNode* stream) -{ +bool Item::unserializeAttributes_OTBM(const IOMap &maphandle, BinaryNode* stream) { uint8_t attribute; - while(stream->getU8(attribute)) { - if(attribute == OTBM_ATTR_ATTRIBUTE_MAP) { - if(!ItemAttributes::unserializeAttributeMap(maphandle, stream)) { + while (stream->getU8(attribute)) { + if (attribute == OTBM_ATTR_ATTRIBUTE_MAP) { + if (!ItemAttributes::unserializeAttributeMap(maphandle, stream)) { return false; } - } else if(!readItemAttribute_OTBM(maphandle, static_cast(attribute), stream)) { + } else if (!readItemAttribute_OTBM(maphandle, static_cast(attribute), stream)) { return false; } } return true; } -bool Item::unserializeItemNode_OTBM(const IOMap& maphandle, BinaryNode* node) -{ +bool Item::unserializeItemNode_OTBM(const IOMap &maphandle, BinaryNode* node) { return unserializeAttributes_OTBM(maphandle, node); } -void Item::serializeItemAttributes_OTBM(const IOMap& maphandle, NodeFileWriteHandle& stream) const -{ - if(maphandle.version.otbm >= MAP_OTBM_2) { - const ItemType& type = g_items.getItemType(id); - if(type.stackable || type.isSplash() || type.isFluidContainer()) { +void Item::serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &stream) const { + if (maphandle.version.otbm >= MAP_OTBM_2) { + const ItemType &type = g_items.getItemType(id); + if (type.stackable || type.isSplash() || type.isFluidContainer()) { stream.addU8(OTBM_ATTR_COUNT); stream.addU8(getSubtype()); } } - if(maphandle.version.otbm >= MAP_OTBM_4) { - if(attributes && !attributes->empty()) { + if (maphandle.version.otbm >= MAP_OTBM_4) { + if (attributes && !attributes->empty()) { stream.addU8(OTBM_ATTR_ATTRIBUTE_MAP); serializeAttributeMap(maphandle, stream); } } else { - if(g_items.MinorVersion >= CLIENT_VERSION_820 && isCharged()) { + if (g_items.MinorVersion >= CLIENT_VERSION_820 && isCharged()) { stream.addU8(OTBM_ATTR_CHARGES); stream.addU16(getSubtype()); } uint16_t actionId = getActionID(); - if(actionId > 0) { + if (actionId > 0) { stream.addU8(OTBM_ATTR_ACTION_ID); stream.addU16(actionId); } uint16_t uniqueId = getUniqueID(); - if(uniqueId > 0) { + if (uniqueId > 0) { stream.addU8(OTBM_ATTR_UNIQUE_ID); stream.addU16(uniqueId); } - const std::string& text = getText(); - if(!text.empty()) { + const std::string &text = getText(); + if (!text.empty()) { stream.addU8(OTBM_ATTR_TEXT); stream.addString(text); } - const std::string& description = getDescription(); - if(!description.empty()) { + const std::string &description = getDescription(); + if (!description.empty()) { stream.addU8(OTBM_ATTR_DESC); stream.addString(description); } } } -void Item::serializeItemCompact_OTBM(const IOMap& maphandle, NodeFileWriteHandle& stream) const -{ +void Item::serializeItemCompact_OTBM(const IOMap &maphandle, NodeFileWriteHandle &stream) const { stream.addU16(id); /* This is impossible @@ -227,13 +224,12 @@ void Item::serializeItemCompact_OTBM(const IOMap& maphandle, NodeFileWriteHandle */ } -bool Item::serializeItemNode_OTBM(const IOMap& maphandle, NodeFileWriteHandle& file) const -{ +bool Item::serializeItemNode_OTBM(const IOMap &maphandle, NodeFileWriteHandle &file) const { file.addNode(OTBM_ITEM); file.addU16(id); - if(maphandle.version.otbm == MAP_OTBM_1) { - const ItemType& type = g_items.getItemType(id); - if(type.stackable || type.isSplash() || type.isFluidContainer()) { + if (maphandle.version.otbm == MAP_OTBM_1) { + const ItemType &type = g_items.getItemType(id); + if (type.stackable || type.isSplash() || type.isFluidContainer()) { file.addU8(getSubtype()); } } @@ -245,12 +241,11 @@ bool Item::serializeItemNode_OTBM(const IOMap& maphandle, NodeFileWriteHandle& f // ============================================================================ // Teleport -bool Teleport::readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute attribute, BinaryNode* stream) -{ - if(OTBM_ATTR_TELE_DEST == attribute) { +bool Teleport::readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attribute, BinaryNode* stream) { + if (OTBM_ATTR_TELE_DEST == attribute) { uint16_t x, y; uint8_t z; - if(!stream->getU16(x) || !stream->getU16(y) || !stream->getU8(z)) { + if (!stream->getU16(x) || !stream->getU16(y) || !stream->getU8(z)) { return false; } destination = Position(x, y, z); @@ -260,8 +255,7 @@ bool Teleport::readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute } } -void Teleport::serializeItemAttributes_OTBM(const IOMap& maphandle, NodeFileWriteHandle& stream) const -{ +void Teleport::serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &stream) const { Item::serializeItemAttributes_OTBM(maphandle, stream); stream.addByte(OTBM_ATTR_TELE_DEST); @@ -273,11 +267,10 @@ void Teleport::serializeItemAttributes_OTBM(const IOMap& maphandle, NodeFileWrit // ============================================================================ // Door -bool Door::readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute attribute, BinaryNode* stream) -{ - if(OTBM_ATTR_HOUSEDOORID == attribute) { +bool Door::readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attribute, BinaryNode* stream) { + if (OTBM_ATTR_HOUSEDOORID == attribute) { uint8_t id = 0; - if(!stream->getU8(id)) { + if (!stream->getU8(id)) { return false; } doorId = id; @@ -287,10 +280,9 @@ bool Door::readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute att } } -void Door::serializeItemAttributes_OTBM(const IOMap& maphandle, NodeFileWriteHandle& stream) const -{ +void Door::serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &stream) const { Item::serializeItemAttributes_OTBM(maphandle, stream); - if(doorId) { + if (doorId) { stream.addByte(OTBM_ATTR_HOUSEDOORID); stream.addU8(doorId); } @@ -299,11 +291,10 @@ void Door::serializeItemAttributes_OTBM(const IOMap& maphandle, NodeFileWriteHan // ============================================================================ // Depots -bool Depot::readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute attribute, BinaryNode* stream) -{ - if(OTBM_ATTR_DEPOT_ID == attribute) { +bool Depot::readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attribute, BinaryNode* stream) { + if (OTBM_ATTR_DEPOT_ID == attribute) { uint16_t id = 0; - if(!stream->getU16(id)) { + if (!stream->getU16(id)) { return false; } depotId = id; @@ -313,10 +304,9 @@ bool Depot::readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute at } } -void Depot::serializeItemAttributes_OTBM(const IOMap& maphandle, NodeFileWriteHandle& stream) const -{ +void Depot::serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &stream) const { Item::serializeItemAttributes_OTBM(maphandle, stream); - if(depotId) { + if (depotId) { stream.addByte(OTBM_ATTR_DEPOT_ID); stream.addU16(depotId); } @@ -325,54 +315,52 @@ void Depot::serializeItemAttributes_OTBM(const IOMap& maphandle, NodeFileWriteHa // ============================================================================ // Container -bool Container::unserializeItemNode_OTBM(const IOMap& maphandle, BinaryNode* node) -{ - if(!Item::unserializeAttributes_OTBM(maphandle, node)) { +bool Container::unserializeItemNode_OTBM(const IOMap &maphandle, BinaryNode* node) { + if (!Item::unserializeAttributes_OTBM(maphandle, node)) { return false; } BinaryNode* child = node->getChild(); - if(child) { + if (child) { do { uint8_t type; - if(!child->getByte(type)) { + if (!child->getByte(type)) { return false; } - if(type != OTBM_ITEM) { + if (type != OTBM_ITEM) { return false; } Item* item = Item::Create_OTBM(maphandle, child); - if(!item) { + if (!item) { return false; } - if(!item->unserializeItemNode_OTBM(maphandle, child)) { + if (!item->unserializeItemNode_OTBM(maphandle, child)) { delete item; return false; } contents.push_back(item); - } while(child->advance()); + } while (child->advance()); } return true; } -bool Container::serializeItemNode_OTBM(const IOMap& maphandle, NodeFileWriteHandle& file) const -{ +bool Container::serializeItemNode_OTBM(const IOMap &maphandle, NodeFileWriteHandle &file) const { file.addNode(OTBM_ITEM); file.addU16(id); - if(maphandle.version.otbm == MAP_OTBM_1) { + if (maphandle.version.otbm == MAP_OTBM_1) { // In the ludicrous event that an item is a container AND stackable, we have to do this. :p - const ItemType& type = g_items.getItemType(id); - if(type.stackable || type.isSplash() || type.isFluidContainer()) { + const ItemType &type = g_items.getItemType(id); + if (type.stackable || type.isSplash() || type.isFluidContainer()) { file.addU8(getSubtype()); } } serializeItemAttributes_OTBM(maphandle, file); - for(Item* item : contents) { + for (Item* item : contents) { item->serializeItemNode_OTBM(maphandle, file); } @@ -401,23 +389,23 @@ bool Container::serializeItemNode_OTBM(const IOMap& maphandle, NodeFileWriteHand |--- OTBM_ITEM_DEF (not implemented) */ -bool IOMapOTBM::getVersionInfo(const FileName& filename, MapVersion& out_ver) -{ +bool IOMapOTBM::getVersionInfo(const FileName &filename, MapVersion &out_ver) { #if OTGZ_SUPPORT > 0 - if(filename.GetExt() == "otgz") { + if (filename.GetExt() == "otgz") { // Open the archive std::shared_ptr a(archive_read_new(), archive_read_free); archive_read_support_filter_all(a.get()); archive_read_support_format_all(a.get()); - if(archive_read_open_filename(a.get(), nstr(filename.GetFullPath()).c_str(), 10240) != ARCHIVE_OK) - return false; + if (archive_read_open_filename(a.get(), nstr(filename.GetFullPath()).c_str(), 10240) != ARCHIVE_OK) { + return false; + } // Loop over the archive entries until we find the otbm file struct archive_entry* entry; - while(archive_read_next_header(a.get(), &entry) == ARCHIVE_OK) { + while (archive_read_next_header(a.get(), &entry) == ARCHIVE_OK) { std::string entryName = archive_entry_pathname(entry); - if(entryName == "world/map.otbm") { + if (entryName == "world/map.otbm") { // Read the OTBM header into temporary memory uint8_t buffer[8096]; memset(buffer, 0, 8096); @@ -426,8 +414,9 @@ bool IOMapOTBM::getVersionInfo(const FileName& filename, MapVersion& out_ver) int read_bytes = archive_read_data(a.get(), buffer, 8096); // Check so it at least contains the 4-byte file id - if(read_bytes < 4) + if (read_bytes < 4) { return false; + } // Create a read handle on it std::shared_ptr f(new MemoryNodeFileReadHandle(buffer + 4, read_bytes - 4)); @@ -444,48 +433,50 @@ bool IOMapOTBM::getVersionInfo(const FileName& filename, MapVersion& out_ver) // Just open a disk-based read handle DiskNodeFileReadHandle f(nstr(filename.GetFullPath()), StringVector(1, "OTBM")); - if(!f.isOk()) + if (!f.isOk()) { return false; + } return getVersionInfo(&f, out_ver); } -bool IOMapOTBM::getVersionInfo(NodeFileReadHandle* f, MapVersion& out_ver) -{ +bool IOMapOTBM::getVersionInfo(NodeFileReadHandle* f, MapVersion &out_ver) { BinaryNode* root = f->getRootNode(); - if(!root) + if (!root) { return false; + } root->skip(1); // Skip the type byte uint16_t u16; uint32_t u32; - if(!root->getU32(u32)) // Version + if (!root->getU32(u32)) { // Version return false; + } out_ver.otbm = (MapVersionID)u32; - root->getU16(u16); root->getU16(u16); root->getU32(u32); - if(!root->getU32(u32)) // OTB minor version + if (!root->getU32(u32)) { // OTB minor version return false; + } out_ver.client = ClientVersionID(u32); return true; } -bool IOMapOTBM::loadMap(Map& map, const FileName& filename) -{ +bool IOMapOTBM::loadMap(Map &map, const FileName &filename) { #if OTGZ_SUPPORT > 0 - if(filename.GetExt() == "otgz") { + if (filename.GetExt() == "otgz") { // Open the archive std::shared_ptr a(archive_read_new(), archive_read_free); archive_read_support_filter_all(a.get()); archive_read_support_format_all(a.get()); - if(archive_read_open_filename(a.get(), nstr(filename.GetFullPath()).c_str(), 10240) != ARCHIVE_OK) - return false; + if (archive_read_open_filename(a.get(), nstr(filename.GetFullPath()).c_str(), 10240) != ARCHIVE_OK) { + return false; + } // Memory buffers for the houses & monsters & npcs std::shared_ptr house_buffer; @@ -501,10 +492,10 @@ bool IOMapOTBM::loadMap(Map& map, const FileName& filename) // Loop over the archive entries until we find the otbm file g_gui.SetLoadDone(0, "Decompressing archive..."); struct archive_entry* entry; - while(archive_read_next_header(a.get(), &entry) == ARCHIVE_OK) { + while (archive_read_next_header(a.get(), &entry) == ARCHIVE_OK) { std::string entryName = archive_entry_pathname(entry); - if(entryName == "world/map.otbm") { + if (entryName == "world/map.otbm") { // Read the entire OTBM file into a memory region size_t otbm_size = archive_entry_size(entry); std::shared_ptr otbm_buffer(new uint8_t[otbm_size], [](uint8_t* p) { delete[] p; }); @@ -513,10 +504,11 @@ bool IOMapOTBM::loadMap(Map& map, const FileName& filename) size_t read_bytes = archive_read_data(a.get(), otbm_buffer.get(), otbm_size); // Check so it at least contains the 4-byte file id - if(read_bytes < 4) + if (read_bytes < 4) { return false; + } - if(read_bytes < otbm_size) { + if (read_bytes < otbm_size) { error("Could not read file."); return false; } @@ -525,16 +517,17 @@ bool IOMapOTBM::loadMap(Map& map, const FileName& filename) // Create a read handle on it std::shared_ptr f( - new MemoryNodeFileReadHandle(otbm_buffer.get() + 4, otbm_size - 4)); + new MemoryNodeFileReadHandle(otbm_buffer.get() + 4, otbm_size - 4) + ); // Read the version info - if(!loadMap(map, *f.get())) { + if (!loadMap(map, *f.get())) { error("Could not load OTBM file inside archive"); return false; } otbm_loaded = true; - } else if(entryName == "world/houses.xml") { + } else if (entryName == "world/houses.xml") { house_buffer_size = archive_entry_size(entry); house_buffer.reset(new uint8_t[house_buffer_size]); @@ -542,12 +535,12 @@ bool IOMapOTBM::loadMap(Map& map, const FileName& filename) size_t read_bytes = archive_read_data(a.get(), house_buffer.get(), house_buffer_size); // Check so it at least contains the 4-byte file id - if(read_bytes < house_buffer_size) { + if (read_bytes < house_buffer_size) { house_buffer.reset(); house_buffer_size = 0; warning("Failed to decompress houses."); } - } else if(entryName == "world/monsters.xml") { + } else if (entryName == "world/monsters.xml") { spawn_monster_buffer_size = archive_entry_size(entry); spawn_monster_buffer.reset(new uint8_t[spawn_monster_buffer_size]); @@ -555,12 +548,12 @@ bool IOMapOTBM::loadMap(Map& map, const FileName& filename) size_t read_bytes = archive_read_data(a.get(), spawn_monster_buffer.get(), spawn_monster_buffer_size); // Check so it at least contains the 4-byte file id - if(read_bytes < spawn_monster_buffer_size) { + if (read_bytes < spawn_monster_buffer_size) { spawn_monster_buffer.reset(); spawn_monster_buffer_size = 0; warning("Failed to decompress monsters spawns."); } - } else if(entryName == "world/npcs.xml") { + } else if (entryName == "world/npcs.xml") { spawn_npc_buffer_size = archive_entry_size(entry); spawn_npc_buffer.reset(new uint8_t[spawn_npc_buffer_size]); @@ -568,7 +561,7 @@ bool IOMapOTBM::loadMap(Map& map, const FileName& filename) size_t read_bytes = archive_read_data(a.get(), spawn_npc_buffer.get(), spawn_npc_buffer_size); // Check so it at least contains the 4-byte file id - if(read_bytes < spawn_npc_buffer_size) { + if (read_bytes < spawn_npc_buffer_size) { spawn_npc_buffer.reset(); spawn_npc_buffer_size = 0; warning("Failed to decompress npcs spawns."); @@ -576,17 +569,17 @@ bool IOMapOTBM::loadMap(Map& map, const FileName& filename) } } - if(!otbm_loaded) { + if (!otbm_loaded) { error("OTBM file not found inside archive."); return false; } // Load the houses from the stored buffer - if(house_buffer.get() && house_buffer_size > 0) { + if (house_buffer.get() && house_buffer_size > 0) { pugi::xml_document doc; pugi::xml_parse_result result = doc.load_buffer(house_buffer.get(), house_buffer_size); - if(result) { - if(!loadHouses(map, doc)) { + if (result) { + if (!loadHouses(map, doc)) { warning("Failed to load houses."); } } else { @@ -595,11 +588,11 @@ bool IOMapOTBM::loadMap(Map& map, const FileName& filename) } // Load the monster spawns from the stored buffer - if(spawn_monster_buffer.get() && spawn_monster_buffer_size > 0) { + if (spawn_monster_buffer.get() && spawn_monster_buffer_size > 0) { pugi::xml_document doc; pugi::xml_parse_result result = doc.load_buffer(spawn_monster_buffer.get(), spawn_monster_buffer_size); - if(result) { - if(!loadSpawnsMonster(map, doc)) { + if (result) { + if (!loadSpawnsMonster(map, doc)) { warning("Failed to load monsters spawns."); } } else { @@ -608,11 +601,11 @@ bool IOMapOTBM::loadMap(Map& map, const FileName& filename) } // Load the npcs from the stored buffer - if(spawn_npc_buffer.get() && spawn_npc_buffer_size > 0) { + if (spawn_npc_buffer.get() && spawn_npc_buffer_size > 0) { pugi::xml_document doc; pugi::xml_parse_result result = doc.load_buffer(spawn_npc_buffer.get(), spawn_npc_buffer_size); - if(result) { - if(!loadSpawnsNpc(map, doc)) { + if (result) { + if (!loadSpawnsNpc(map, doc)) { warning("Failed to load npcs spawns."); } } else { @@ -625,34 +618,34 @@ bool IOMapOTBM::loadMap(Map& map, const FileName& filename) #endif DiskNodeFileReadHandle f(nstr(filename.GetFullPath()), StringVector(1, "OTBM")); - if(!f.isOk()) { + if (!f.isOk()) { error(("Couldn't open file for reading\nThe error reported was: " + wxstr(f.getErrorMessage())).wc_str()); return false; } - if(!loadMap(map, f)) + if (!loadMap(map, f)) { return false; + } // Read auxilliary files - if(!loadHouses(map, filename)) { + if (!loadHouses(map, filename)) { warning("Failed to load houses."); map.housefile = nstr(filename.GetName()) + "-house.xml"; } - if(!loadSpawnsMonster(map, filename)) { + if (!loadSpawnsMonster(map, filename)) { warning("Failed to load monsters spawns."); map.spawnmonsterfile = nstr(filename.GetName()) + "-monster.xml"; } - if(!loadSpawnsNpc(map, filename)) { + if (!loadSpawnsNpc(map, filename)) { warning("Failed to load npcs spawns."); map.spawnnpcfile = nstr(filename.GetName()) + "-npc.xml"; } return true; } -bool IOMapOTBM::loadMap(Map& map, NodeFileReadHandle& f) -{ +bool IOMapOTBM::loadMap(Map &map, NodeFileReadHandle &f) { BinaryNode* root = f.getRootNode(); - if(!root) { + if (!root) { error("Could not read root node."); return false; } @@ -662,17 +655,18 @@ bool IOMapOTBM::loadMap(Map& map, NodeFileReadHandle& f) uint16_t u16; uint32_t u32; - if(!root->getU32(u32)) + if (!root->getU32(u32)) { return false; + } - version.otbm = (MapVersionID) u32; + version.otbm = (MapVersionID)u32; - if(version.otbm > MAP_OTBM_4) { + if (version.otbm > MAP_OTBM_4) { // Failed to read version - if(g_gui.PopupDialog("Map error", - "The loaded map appears to be a OTBM format that is not supported by the editor." - "Do you still want to attempt to load the map?", wxYES | wxNO) == wxID_YES) - { + if (g_gui.PopupDialog("Map error", "The loaded map appears to be a OTBM format that is not supported by the editor." + "Do you still want to attempt to load the map?", + wxYES | wxNO) + == wxID_YES) { warning("Unsupported or damaged map version"); } else { error("Unsupported OTBM version, could not load map"); @@ -680,20 +674,22 @@ bool IOMapOTBM::loadMap(Map& map, NodeFileReadHandle& f) } } - if(!root->getU16(u16)) + if (!root->getU16(u16)) { return false; + } map.width = u16; - if(!root->getU16(u16)) + if (!root->getU16(u16)) { return false; + } map.height = u16; - if(!root->getU32(u32) || u32 > (unsigned long)g_items.MajorVersion) { // OTB major version - if(g_gui.PopupDialog("Map error", - "The loaded map appears to be a items.otb format that deviates from the " - "items.otb loaded by the editor. Do you still want to attempt to load the map?", wxYES | wxNO) == wxID_YES) - { + if (!root->getU32(u32) || u32 > (unsigned long)g_items.MajorVersion) { // OTB major version + if (g_gui.PopupDialog("Map error", "The loaded map appears to be a items.otb format that deviates from the " + "items.otb loaded by the editor. Do you still want to attempt to load the map?", + wxYES | wxNO) + == wxID_YES) { warning("Unsupported or damaged map version"); } else { error("Outdated items.otb, could not load map"); @@ -701,41 +697,41 @@ bool IOMapOTBM::loadMap(Map& map, NodeFileReadHandle& f) } } - if(!root->getU32(u32) || u32 > (unsigned long)g_items.MinorVersion) { // OTB minor version + if (!root->getU32(u32) || u32 > (unsigned long)g_items.MinorVersion) { // OTB minor version warning("This editor needs an updated items.otb version"); } version.client = (ClientVersionID)u32; BinaryNode* mapHeaderNode = root->getChild(); - if(mapHeaderNode == nullptr || !mapHeaderNode->getByte(u8) || u8 != OTBM_MAP_DATA) { + if (mapHeaderNode == nullptr || !mapHeaderNode->getByte(u8) || u8 != OTBM_MAP_DATA) { error("Could not get root child node. Cannot recover from fatal error!"); return false; } uint8_t attribute; - while(mapHeaderNode->getU8(attribute)) { - switch(attribute) { + while (mapHeaderNode->getU8(attribute)) { + switch (attribute) { case OTBM_ATTR_DESCRIPTION: { - if(!mapHeaderNode->getString(map.description)) { + if (!mapHeaderNode->getString(map.description)) { warning("Invalid map description tag"); } - //std::cout << "Map description: " << mapDescription << std::endl; + // std::cout << "Map description: " << mapDescription << std::endl; break; } case OTBM_ATTR_EXT_SPAWN_MONSTER_FILE: { - if(!mapHeaderNode->getString(map.spawnmonsterfile)) { + if (!mapHeaderNode->getString(map.spawnmonsterfile)) { warning("Invalid map spawnmonsterfile tag"); } break; } case OTBM_ATTR_EXT_HOUSE_FILE: { - if(!mapHeaderNode->getString(map.housefile)) { + if (!mapHeaderNode->getString(map.housefile)) { warning("Invalid map housefile tag"); } break; } case OTBM_ATTR_EXT_SPAWN_NPC_FILE: { - if(!mapHeaderNode->getString(map.spawnnpcfile)) { + if (!mapHeaderNode->getString(map.spawnnpcfile)) { warning("Invalid map spawnnpcfile tag"); } break; @@ -749,57 +745,57 @@ bool IOMapOTBM::loadMap(Map& map, NodeFileReadHandle& f) int nodes_loaded = 0; - for(BinaryNode* mapNode = mapHeaderNode->getChild(); mapNode != nullptr; mapNode = mapNode->advance()) { + for (BinaryNode* mapNode = mapHeaderNode->getChild(); mapNode != nullptr; mapNode = mapNode->advance()) { ++nodes_loaded; - if(nodes_loaded % 15 == 0) { + if (nodes_loaded % 15 == 0) { g_gui.SetLoadDone(static_cast(100.0 * f.tell() / f.size())); } uint8_t node_type; - if(!mapNode->getByte(node_type)) { + if (!mapNode->getByte(node_type)) { warning("Invalid map node"); continue; } - if(node_type == OTBM_TILE_AREA) { + if (node_type == OTBM_TILE_AREA) { uint16_t base_x, base_y; uint8_t base_z; - if(!mapNode->getU16(base_x) || !mapNode->getU16(base_y) || !mapNode->getU8(base_z)) { + if (!mapNode->getU16(base_x) || !mapNode->getU16(base_y) || !mapNode->getU8(base_z)) { warning("Invalid map node, no base coordinate"); continue; } - for(BinaryNode* tileNode = mapNode->getChild(); tileNode != nullptr; tileNode = tileNode->advance()) { + for (BinaryNode* tileNode = mapNode->getChild(); tileNode != nullptr; tileNode = tileNode->advance()) { Tile* tile = nullptr; uint8_t tile_type; - if(!tileNode->getByte(tile_type)) { + if (!tileNode->getByte(tile_type)) { warning("Invalid tile type"); continue; } - if(tile_type == OTBM_TILE || tile_type == OTBM_HOUSETILE) { - //printf("Start\n"); + if (tile_type == OTBM_TILE || tile_type == OTBM_HOUSETILE) { + // printf("Start\n"); uint8_t x_offset, y_offset; - if(!tileNode->getU8(x_offset) || !tileNode->getU8(y_offset)) { + if (!tileNode->getU8(x_offset) || !tileNode->getU8(y_offset)) { warning("Could not read position of tile"); continue; } const Position pos(base_x + x_offset, base_y + y_offset, base_z); - if(map.getTile(pos)) { + if (map.getTile(pos)) { warning("Duplicate tile at %d:%d:%d, discarding duplicate", pos.x, pos.y, pos.z); continue; } tile = map.allocator(map.createTileL(pos)); House* house = nullptr; - if(tile_type == OTBM_HOUSETILE) { + if (tile_type == OTBM_HOUSETILE) { uint32_t house_id; - if(!tileNode->getU32(house_id)) { + if (!tileNode->getU32(house_id)) { warning("House tile without house data, discarding tile"); continue; } - if(house_id) { + if (house_id) { house = map.houses.getHouse(house_id); - if(!house) { + if (!house) { house = newd House(map); house->id = house_id; map.houses.addHouse(house); @@ -809,14 +805,14 @@ bool IOMapOTBM::loadMap(Map& map, NodeFileReadHandle& f) } } - //printf("So far so good\n"); + // printf("So far so good\n"); uint8_t attribute; - while(tileNode->getU8(attribute)) { - switch(attribute) { + while (tileNode->getU8(attribute)) { + switch (attribute) { case OTBM_ATTR_TILE_FLAGS: { uint32_t flags = 0; - if(!tileNode->getU32(flags)) { + if (!tileNode->getU32(flags)) { warning("Invalid tile flags of tile on %d:%d:%d", pos.x, pos.y, pos.z); } tile->setMapFlags(flags); @@ -824,8 +820,7 @@ bool IOMapOTBM::loadMap(Map& map, NodeFileReadHandle& f) } case OTBM_ATTR_ITEM: { Item* item = Item::Create_OTBM(*this, tileNode); - if(item == nullptr) - { + if (item == nullptr) { warning("Invalid item at tile %d:%d:%d", pos.x, pos.y, pos.z); } tile->addItem(item); @@ -838,22 +833,22 @@ bool IOMapOTBM::loadMap(Map& map, NodeFileReadHandle& f) } } - //printf("Didn't die in loop\n"); + // printf("Didn't die in loop\n"); - for(BinaryNode* itemNode = tileNode->getChild(); itemNode != nullptr; itemNode = itemNode->advance()) { + for (BinaryNode* itemNode = tileNode->getChild(); itemNode != nullptr; itemNode = itemNode->advance()) { Item* item = nullptr; uint8_t item_type; - if(!itemNode->getByte(item_type)) { + if (!itemNode->getByte(item_type)) { warning("Unknown item type %d:%d:%d", pos.x, pos.y, pos.z); continue; } - if(item_type == OTBM_ITEM) { + if (item_type == OTBM_ITEM) { item = Item::Create_OTBM(*this, itemNode); - if(item) { - if(!item->unserializeItemNode_OTBM(*this, itemNode)) { + if (item) { + if (!item->unserializeItemNode_OTBM(*this, itemNode)) { warning("Couldn't unserialize item attributes at %d:%d:%d", pos.x, pos.y, pos.z); } - //reform(&map, tile, item); + // reform(&map, tile, item); tile->addItem(item); } } else { @@ -862,45 +857,46 @@ bool IOMapOTBM::loadMap(Map& map, NodeFileReadHandle& f) } tile->update(); - if(house) + if (house) { house->addTile(tile); + } map.setTile(pos.x, pos.y, pos.z, tile); } else { warning("Unknown type of tile node"); } } - } else if(node_type == OTBM_TOWNS) { - for(BinaryNode* townNode = mapNode->getChild(); townNode != nullptr; townNode = townNode->advance()) { + } else if (node_type == OTBM_TOWNS) { + for (BinaryNode* townNode = mapNode->getChild(); townNode != nullptr; townNode = townNode->advance()) { Town* town = nullptr; uint8_t town_type; - if(!townNode->getByte(town_type)) { + if (!townNode->getByte(town_type)) { warning("Invalid town type (1)"); continue; } - if(town_type != OTBM_TOWN) { + if (town_type != OTBM_TOWN) { warning("Invalid town type (2)"); continue; } uint32_t town_id; - if(!townNode->getU32(town_id)) { + if (!townNode->getU32(town_id)) { warning("Invalid town id"); continue; } town = map.towns.getTown(town_id); - if(town) { + if (town) { warning("Duplicate town id %d, discarding duplicate", town_id); continue; } else { town = newd Town(town_id); - if(!map.towns.addTown(town)) { + if (!map.towns.addTown(town)) { delete town; continue; } } std::string town_name; - if(!townNode->getString(town_name)) { + if (!townNode->getString(town_name)) { warning("Invalid town name"); continue; } @@ -909,7 +905,7 @@ bool IOMapOTBM::loadMap(Map& map, NodeFileReadHandle& f) uint16_t x; uint16_t y; uint8_t z; - if(!townNode->getU16(x) || !townNode->getU16(y) || !townNode->getU8(z)) { + if (!townNode->getU16(x) || !townNode->getU16(y) || !townNode->getU8(z)) { warning("Invalid town temple position"); continue; } @@ -918,28 +914,28 @@ bool IOMapOTBM::loadMap(Map& map, NodeFileReadHandle& f) pos.z = z; town->setTemplePosition(pos); } - } else if(node_type == OTBM_WAYPOINTS) { - for(BinaryNode* waypointNode = mapNode->getChild(); waypointNode != nullptr; waypointNode = waypointNode->advance()) { + } else if (node_type == OTBM_WAYPOINTS) { + for (BinaryNode* waypointNode = mapNode->getChild(); waypointNode != nullptr; waypointNode = waypointNode->advance()) { uint8_t waypoint_type; - if(!waypointNode->getByte(waypoint_type)) { + if (!waypointNode->getByte(waypoint_type)) { warning("Invalid waypoint type (1)"); continue; } - if(waypoint_type != OTBM_WAYPOINT) { + if (waypoint_type != OTBM_WAYPOINT) { warning("Invalid waypoint type (2)"); continue; } Waypoint wp; - if(!waypointNode->getString(wp.name)) { + if (!waypointNode->getString(wp.name)) { warning("Invalid waypoint name"); continue; } uint16_t x; uint16_t y; uint8_t z; - if(!waypointNode->getU16(x) || !waypointNode->getU16(y) || !waypointNode->getU8(z)) { + if (!waypointNode->getU16(x) || !waypointNode->getU16(y) || !waypointNode->getU8(z)) { warning("Invalid waypoint position"); continue; } @@ -952,38 +948,38 @@ bool IOMapOTBM::loadMap(Map& map, NodeFileReadHandle& f) } } - if(!f.isOk()) + if (!f.isOk()) { warning(wxstr(f.getErrorMessage()).wc_str()); + } return true; } -bool IOMapOTBM::loadSpawnsMonster(Map& map, const FileName& dir) -{ +bool IOMapOTBM::loadSpawnsMonster(Map &map, const FileName &dir) { std::string fn = (const char*)(dir.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME).mb_str(wxConvUTF8)); fn += map.spawnmonsterfile; FileName filename(wxstr(fn)); - if(!filename.FileExists()) + if (!filename.FileExists()) { return false; + } pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(fn.c_str()); - if(!result) { + if (!result) { return false; } return loadSpawnsMonster(map, doc); } -bool IOMapOTBM::loadSpawnsMonster(Map& map, pugi::xml_document& doc) -{ +bool IOMapOTBM::loadSpawnsMonster(Map &map, pugi::xml_document &doc) { pugi::xml_node node = doc.child("monsters"); - if(!node) { + if (!node) { warnings.push_back("IOMapOTBM::loadSpawnsMonster: Invalid rootheader."); return false; } - for(pugi::xml_node spawnNode = node.first_child(); spawnNode; spawnNode = spawnNode.next_sibling()) { - if(as_lower_str(spawnNode.name()) != "monster") { + for (pugi::xml_node spawnNode = node.first_child(); spawnNode; spawnNode = spawnNode.next_sibling()) { + if (as_lower_str(spawnNode.name()) != "monster") { continue; } @@ -992,25 +988,25 @@ bool IOMapOTBM::loadSpawnsMonster(Map& map, pugi::xml_document& doc) spawnPosition.y = spawnNode.attribute("centery").as_int(); spawnPosition.z = spawnNode.attribute("centerz").as_int(); - if(spawnPosition.x == 0 || spawnPosition.y == 0) { + if (spawnPosition.x == 0 || spawnPosition.y == 0) { warning("Bad position data on one monster spawn, discarding..."); continue; } int32_t radius = spawnNode.attribute("radius").as_int(); - if(radius < 1) { + if (radius < 1) { warning("Couldn't read radius of monster spawn.. discarding spawn..."); continue; } Tile* tile = map.getTile(spawnPosition); - if(tile && tile->spawnMonster) { + if (tile && tile->spawnMonster) { warning("Duplicate monster spawn on position %d:%d:%d\n", tile->getX(), tile->getY(), tile->getZ()); continue; } SpawnMonster* spawnMonster = newd SpawnMonster(radius); - if(!tile) { + if (!tile) { tile = map.allocator(map.createTileL(spawnPosition)); map.setTile(spawnPosition, tile); } @@ -1018,14 +1014,14 @@ bool IOMapOTBM::loadSpawnsMonster(Map& map, pugi::xml_document& doc) tile->spawnMonster = spawnMonster; map.addSpawnMonster(tile); - for(pugi::xml_node monsterNode = spawnNode.first_child(); monsterNode; monsterNode = monsterNode.next_sibling()) { - const std::string& monsterNodeName = as_lower_str(monsterNode.name()); - if(monsterNodeName != "monster") { + for (pugi::xml_node monsterNode = spawnNode.first_child(); monsterNode; monsterNode = monsterNode.next_sibling()) { + const std::string &monsterNodeName = as_lower_str(monsterNode.name()); + if (monsterNodeName != "monster") { continue; } - const std::string& name = monsterNode.attribute("name").as_string(); - if(name.empty()) { + const std::string &name = monsterNode.attribute("name").as_string(); + if (name.empty()) { wxString err; err << "Bad monster position data, discarding monster at spawn " << spawnPosition.x << ":" << spawnPosition.y << ":" << spawnPosition.z << " due missing name."; warnings.Add(err); @@ -1033,13 +1029,13 @@ bool IOMapOTBM::loadSpawnsMonster(Map& map, pugi::xml_document& doc) } int32_t spawntime = monsterNode.attribute("spawntime").as_int(); - if(spawntime == 0) { + if (spawntime == 0) { spawntime = g_settings.getInteger(Config::DEFAULT_SPAWN_MONSTER_TIME); } Direction direction = NORTH; int dir = monsterNode.attribute("direction").as_int(-1); - if(dir >= DIRECTION_FIRST && dir <= DIRECTION_LAST) { + if (dir >= DIRECTION_FIRST && dir <= DIRECTION_LAST) { direction = (Direction)dir; } @@ -1047,7 +1043,7 @@ bool IOMapOTBM::loadSpawnsMonster(Map& map, pugi::xml_document& doc) pugi::xml_attribute xAttribute = monsterNode.attribute("x"); pugi::xml_attribute yAttribute = monsterNode.attribute("y"); - if(!xAttribute || !yAttribute) { + if (!xAttribute || !yAttribute) { wxString err; err << "Bad monster position data, discarding monster \"" << name << "\" at spawn " << monsterPosition.x << ":" << monsterPosition.y << ":" << monsterPosition.z << " due to invalid position."; warnings.Add(err); @@ -1062,20 +1058,20 @@ bool IOMapOTBM::loadSpawnsMonster(Map& map, pugi::xml_document& doc) radius = std::min(radius, g_settings.getInteger(Config::MAX_SPAWN_MONSTER_RADIUS)); Tile* monsterTile; - if(monsterPosition == spawnPosition) { + if (monsterPosition == spawnPosition) { monsterTile = tile; } else { monsterTile = map.getTile(monsterPosition); } - if(!monsterTile) { + if (!monsterTile) { wxString err; err << "Discarding monster \"" << name << "\" at " << monsterPosition.x << ":" << monsterPosition.y << ":" << monsterPosition.z << " due to invalid position."; warnings.Add(err); break; } - if(monsterTile->monster) { + if (monsterTile->monster) { wxString err; err << "Duplicate monster \"" << name << "\" at " << monsterPosition.x << ":" << monsterPosition.y << ":" << monsterPosition.z << " was discarded."; warnings.Add(err); @@ -1083,7 +1079,7 @@ bool IOMapOTBM::loadSpawnsMonster(Map& map, pugi::xml_document& doc) } MonsterType* type = g_monsters[name]; - if(!type) { + if (!type) { type = g_monsters.addMissingMonsterType(name); } @@ -1092,7 +1088,7 @@ bool IOMapOTBM::loadSpawnsMonster(Map& map, pugi::xml_document& doc) monster->setSpawnMonsterTime(spawntime); monsterTile->monster = monster; - if(monsterTile->getLocation()->getSpawnMonsterCount() == 0) { + if (monsterTile->getLocation()->getSpawnMonsterCount() == 0) { // No monster spawn, create a newd one ASSERT(monsterTile->spawnMonster == nullptr); SpawnMonster* spawnMonster = newd SpawnMonster(1); @@ -1104,45 +1100,44 @@ bool IOMapOTBM::loadSpawnsMonster(Map& map, pugi::xml_document& doc) return true; } -bool IOMapOTBM::loadHouses(Map& map, const FileName& dir) -{ +bool IOMapOTBM::loadHouses(Map &map, const FileName &dir) { std::string fn = (const char*)(dir.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME).mb_str(wxConvUTF8)); fn += map.housefile; FileName filename(wxstr(fn)); - if(!filename.FileExists()) + if (!filename.FileExists()) { return false; + } pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(fn.c_str()); - if(!result) { + if (!result) { return false; } return loadHouses(map, doc); } -bool IOMapOTBM::loadHouses(Map& map, pugi::xml_document& doc) -{ +bool IOMapOTBM::loadHouses(Map &map, pugi::xml_document &doc) { pugi::xml_node node = doc.child("houses"); - if(!node) { + if (!node) { warnings.push_back("IOMapOTBM::loadHouses: Invalid rootheader."); return false; } pugi::xml_attribute attribute; - for(pugi::xml_node houseNode = node.first_child(); houseNode; houseNode = houseNode.next_sibling()) { - if(as_lower_str(houseNode.name()) != "house") { + for (pugi::xml_node houseNode = node.first_child(); houseNode; houseNode = houseNode.next_sibling()) { + if (as_lower_str(houseNode.name()) != "house") { continue; } House* house = nullptr; - if((attribute = houseNode.attribute("houseid"))) { + if ((attribute = houseNode.attribute("houseid"))) { house = map.houses.getHouse(attribute.as_uint()); - if(!house) { + if (!house) { break; } } - if((attribute = houseNode.attribute("name"))) { + if ((attribute = houseNode.attribute("name"))) { house->name = attribute.as_string(); } else { house->name = "House #" + std::to_string(house->id); @@ -1153,63 +1148,62 @@ bool IOMapOTBM::loadHouses(Map& map, pugi::xml_document& doc) houseNode.attribute("entryy").as_int(), houseNode.attribute("entryz").as_int() ); - if(exitPosition.x != 0 && exitPosition.y != 0 && exitPosition.z != 0) { + if (exitPosition.x != 0 && exitPosition.y != 0 && exitPosition.z != 0) { house->setExit(exitPosition); } - if((attribute = houseNode.attribute("rent"))) { + if ((attribute = houseNode.attribute("rent"))) { house->rent = attribute.as_int(); } - if((attribute = houseNode.attribute("guildhall"))) { + if ((attribute = houseNode.attribute("guildhall"))) { house->guildhall = attribute.as_bool(); } - if((attribute = houseNode.attribute("townid"))) { + if ((attribute = houseNode.attribute("townid"))) { house->townid = attribute.as_uint(); } else { warning("House %d has no town! House was removed.", house->id); map.houses.removeHouse(house); } - if((attribute = houseNode.attribute("clientid"))) { + if ((attribute = houseNode.attribute("clientid"))) { house->clientid = attribute.as_uint(); } - if((attribute = houseNode.attribute("beds"))) { + if ((attribute = houseNode.attribute("beds"))) { house->beds = attribute.as_uint(); } } return true; } -bool IOMapOTBM::loadSpawnsNpc(Map& map, const FileName& dir) -{ +bool IOMapOTBM::loadSpawnsNpc(Map &map, const FileName &dir) { std::string fn = (const char*)(dir.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME).mb_str(wxConvUTF8)); fn += map.spawnnpcfile; FileName filename(wxstr(fn)); - if(!filename.FileExists()) + if (!filename.FileExists()) { return false; + } pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(fn.c_str()); - if(!result) { + if (!result) { return false; } return loadSpawnsNpc(map, doc); } -bool IOMapOTBM::loadSpawnsNpc(Map& map, pugi::xml_document& doc) -{ +bool IOMapOTBM::loadSpawnsNpc(Map &map, pugi::xml_document &doc) { pugi::xml_node node = doc.child("npcs"); - if(!node) { + if (!node) { warnings.push_back("IOMapOTBM::loadSpawnsNpc: Invalid rootheader."); return false; } - for(pugi::xml_node spawnNpcNode = node.first_child(); spawnNpcNode; spawnNpcNode = spawnNpcNode.next_sibling()) { - if(as_lower_str(spawnNpcNode.name()) != "npc") { + for (pugi::xml_node spawnNpcNode = node.first_child(); spawnNpcNode; spawnNpcNode = spawnNpcNode.next_sibling()) { + if (as_lower_str(spawnNpcNode.name()) != "npc") { continue; } @@ -1218,25 +1212,25 @@ bool IOMapOTBM::loadSpawnsNpc(Map& map, pugi::xml_document& doc) spawnPosition.y = spawnNpcNode.attribute("centery").as_int(); spawnPosition.z = spawnNpcNode.attribute("centerz").as_int(); - if(spawnPosition.x == 0 || spawnPosition.y == 0) { + if (spawnPosition.x == 0 || spawnPosition.y == 0) { warning("Bad position data on one npc spawn, discarding..."); continue; } int32_t radius = spawnNpcNode.attribute("radius").as_int(); - if(radius < 1) { + if (radius < 1) { warning("Couldn't read radius of npc spawn.. discarding spawn..."); continue; } Tile* spawnTile = map.getTile(spawnPosition); - if(spawnTile && spawnTile->spawnNpc) { + if (spawnTile && spawnTile->spawnNpc) { warning("Duplicate npc spawn on position %d:%d:%d\n", spawnTile->getX(), spawnTile->getY(), spawnTile->getZ()); continue; } SpawnNpc* spawnNpc = newd SpawnNpc(radius); - if(!spawnTile) { + if (!spawnTile) { spawnTile = map.allocator(map.createTileL(spawnPosition)); map.setTile(spawnPosition, spawnTile); } @@ -1244,14 +1238,14 @@ bool IOMapOTBM::loadSpawnsNpc(Map& map, pugi::xml_document& doc) spawnTile->spawnNpc = spawnNpc; map.addSpawnNpc(spawnTile); - for(pugi::xml_node npcNode = spawnNpcNode.first_child(); npcNode; npcNode = npcNode.next_sibling()) { - const std::string& npcNodeName = as_lower_str(npcNode.name()); - if(npcNodeName != "npc") { + for (pugi::xml_node npcNode = spawnNpcNode.first_child(); npcNode; npcNode = npcNode.next_sibling()) { + const std::string &npcNodeName = as_lower_str(npcNode.name()); + if (npcNodeName != "npc") { continue; } - const std::string& name = npcNode.attribute("name").as_string(); - if(name.empty()) { + const std::string &name = npcNode.attribute("name").as_string(); + if (name.empty()) { wxString err; err << "Bad npc position data, discarding npc at spawn " << spawnPosition.x << ":" << spawnPosition.y << ":" << spawnPosition.z << " due missing name."; warnings.Add(err); @@ -1259,13 +1253,13 @@ bool IOMapOTBM::loadSpawnsNpc(Map& map, pugi::xml_document& doc) } int32_t spawntime = npcNode.attribute("spawntime").as_int(); - if(spawntime == 0) { + if (spawntime == 0) { spawntime = g_settings.getInteger(Config::DEFAULT_SPAWN_NPC_TIME); } Direction direction = NORTH; int dir = npcNode.attribute("direction").as_int(-1); - if(dir >= DIRECTION_FIRST && dir <= DIRECTION_LAST) { + if (dir >= DIRECTION_FIRST && dir <= DIRECTION_LAST) { direction = (Direction)dir; } @@ -1273,7 +1267,7 @@ bool IOMapOTBM::loadSpawnsNpc(Map& map, pugi::xml_document& doc) pugi::xml_attribute xAttribute = npcNode.attribute("x"); pugi::xml_attribute yAttribute = npcNode.attribute("y"); - if(!xAttribute || !yAttribute) { + if (!xAttribute || !yAttribute) { wxString err; err << "Bad npc position data, discarding npc \"" << name << "\" at spawn " << npcPosition.x << ":" << npcPosition.y << ":" << npcPosition.z << " due to invalid position."; warnings.Add(err); @@ -1288,20 +1282,20 @@ bool IOMapOTBM::loadSpawnsNpc(Map& map, pugi::xml_document& doc) radius = std::min(radius, g_settings.getInteger(Config::MAX_SPAWN_NPC_RADIUS)); Tile* npcTile; - if(npcPosition == spawnPosition) { + if (npcPosition == spawnPosition) { npcTile = spawnTile; } else { npcTile = map.getTile(npcPosition); } - if(!npcTile) { + if (!npcTile) { wxString err; err << "Discarding npc \"" << name << "\" at " << npcPosition.x << ":" << npcPosition.y << ":" << npcPosition.z << " due to invalid position."; warnings.Add(err); break; } - if(npcTile->npc) { + if (npcTile->npc) { wxString err; err << "Duplicate npc \"" << name << "\" at " << npcPosition.x << ":" << npcPosition.y << ":" << npcPosition.z << " was discarded."; warnings.Add(err); @@ -1309,7 +1303,7 @@ bool IOMapOTBM::loadSpawnsNpc(Map& map, pugi::xml_document& doc) } NpcType* type = g_npcs[name]; - if(!type) { + if (!type) { type = g_npcs.addMissingNpcType(name); } @@ -1318,7 +1312,7 @@ bool IOMapOTBM::loadSpawnsNpc(Map& map, pugi::xml_document& doc) npc->setSpawnNpcTime(spawntime); npcTile->npc = npc; - if(npcTile->getLocation()->getSpawnNpcCount() == 0) { + if (npcTile->getLocation()->getSpawnNpcCount() == 0) { // No npc spawn, create a newd one ASSERT(npcTile->spawnNpc == nullptr); SpawnNpc* spawnNpc = newd SpawnNpc(1); @@ -1330,10 +1324,9 @@ bool IOMapOTBM::loadSpawnsNpc(Map& map, pugi::xml_document& doc) return true; } -bool IOMapOTBM::saveMap(Map& map, const FileName& identifier) -{ +bool IOMapOTBM::saveMap(Map &map, const FileName &identifier) { #if OTGZ_SUPPORT > 0 - if(identifier.GetExt() == "otgz") { + if (identifier.GetExt() == "otgz") { // Create the archive struct archive* a = archive_write_new(); struct archive_entry* entry = nullptr; @@ -1346,7 +1339,7 @@ bool IOMapOTBM::saveMap(Map& map, const FileName& identifier) g_gui.SetLoadDone(0, "Saving monsters..."); pugi::xml_document spawnDoc; - if(saveSpawns(map, spawnDoc)) { + if (saveSpawns(map, spawnDoc)) { // Write the data spawnDoc.save(streamData, "", pugi::format_raw, pugi::encoding_utf8); std::string xmlData = streamData.str(); @@ -1370,7 +1363,7 @@ bool IOMapOTBM::saveMap(Map& map, const FileName& identifier) g_gui.SetLoadDone(0, "Saving houses..."); pugi::xml_document houseDoc; - if(saveHouses(map, houseDoc)) { + if (saveHouses(map, houseDoc)) { // Write the data houseDoc.save(streamData, "", pugi::format_raw, pugi::encoding_utf8); std::string xmlData = streamData.str(); @@ -1394,7 +1387,7 @@ bool IOMapOTBM::saveMap(Map& map, const FileName& identifier) g_gui.SetLoadDone(0, "Saving npcs..."); pugi::xml_document npcDoc; - if(saveSpawnsNpc(map, npcDoc)) { + if (saveSpawnsNpc(map, npcDoc)) { // Write the data npcDoc.save(streamData, "", pugi::format_raw, pugi::encoding_utf8); std::string xmlData = streamData.str(); @@ -1450,15 +1443,16 @@ bool IOMapOTBM::saveMap(Map& map, const FileName& identifier) DiskNodeFileWriteHandle f( nstr(identifier.GetFullPath()), (g_settings.getInteger(Config::SAVE_WITH_OTB_MAGIC_NUMBER) ? "OTBM" : std::string(4, '\0')) - ); + ); - if(!f.isOk()) { + if (!f.isOk()) { error("Can not open file %s for writing", (const char*)identifier.GetFullPath().mb_str(wxConvUTF8)); return false; } - if(!saveMap(map, f)) + if (!saveMap(map, f)) { return false; + } g_gui.SetLoadDone(99, "Saving monster spawns..."); saveSpawns(map, identifier); @@ -1471,8 +1465,7 @@ bool IOMapOTBM::saveMap(Map& map, const FileName& identifier) return true; } -bool IOMapOTBM::saveMap(Map& map, NodeFileWriteHandle& f) -{ +bool IOMapOTBM::saveMap(Map &map, NodeFileWriteHandle &f) { /* STOP! * Before you even think about modifying this, please reconsider. * while adding stuff to the binary format may be "cool", you'll @@ -1484,7 +1477,7 @@ bool IOMapOTBM::saveMap(Map& map, NodeFileWriteHandle& f) * format. */ - const IOMapOTBM& self = *this; + const IOMapOTBM &self = *this; FileName tmpName; MapVersion mapVersion = map.getVersion(); @@ -1527,27 +1520,28 @@ bool IOMapOTBM::saveMap(Map& map, NodeFileWriteHandle& f) int local_x = -1, local_y = -1, local_z = -1; MapIterator map_iterator = map.begin(); - while(map_iterator != map.end()) { + while (map_iterator != map.end()) { // Update progressbar ++tiles_saved; - if(tiles_saved % 8192 == 0) + if (tiles_saved % 8192 == 0) { g_gui.SetLoadDone(int(tiles_saved / double(map.getTileCount()) * 100.0)); + } // Get tile Tile* save_tile = (*map_iterator)->get(); // Is it an empty tile that we can skip? (Leftovers...) - if(!save_tile || save_tile->size() == 0) { + if (!save_tile || save_tile->size() == 0) { ++map_iterator; continue; } - const Position& pos = save_tile->getPosition(); + const Position &pos = save_tile->getPosition(); // Decide if newd node should be created - if(pos.x < local_x || pos.x >= local_x + 256 || pos.y < local_y || pos.y >= local_y + 256 || pos.z != local_z) { + if (pos.x < local_x || pos.x >= local_x + 256 || pos.y < local_y || pos.y >= local_y + 256 || pos.z != local_z) { // End last node - if(!first) { + if (!first) { f.endNode(); } first = false; @@ -1556,30 +1550,30 @@ bool IOMapOTBM::saveMap(Map& map, NodeFileWriteHandle& f) f.addNode(OTBM_TILE_AREA); f.addU16(local_x = pos.x & 0xFF00); f.addU16(local_y = pos.y & 0xFF00); - f.addU8( local_z = pos.z); + f.addU8(local_z = pos.z); } - f.addNode(save_tile->isHouseTile()? OTBM_HOUSETILE : OTBM_TILE); + f.addNode(save_tile->isHouseTile() ? OTBM_HOUSETILE : OTBM_TILE); f.addU8(save_tile->getX() & 0xFF); f.addU8(save_tile->getY() & 0xFF); - if(save_tile->isHouseTile()) { + if (save_tile->isHouseTile()) { f.addU32(save_tile->getHouseID()); } - if(save_tile->getMapFlags()) { + if (save_tile->getMapFlags()) { f.addByte(OTBM_ATTR_TILE_FLAGS); f.addU32(save_tile->getMapFlags()); } - if(save_tile->ground) { + if (save_tile->ground) { Item* ground = save_tile->ground; - if(ground->isMetaItem()) { + if (ground->isMetaItem()) { // Do nothing, we don't save metaitems... - } else if(ground->hasBorderEquivalent()) { + } else if (ground->hasBorderEquivalent()) { bool found = false; - for(Item* item : save_tile->items) { - if(item->getGroundEquivalent() == ground->getID()) { + for (Item* item : save_tile->items) { + if (item->getGroundEquivalent() == ground->getID()) { // Do nothing // Found equivalent found = true; @@ -1587,10 +1581,10 @@ bool IOMapOTBM::saveMap(Map& map, NodeFileWriteHandle& f) } } - if(!found) { + if (!found) { ground->serializeItemNode_OTBM(self, f); } - } else if(ground->isComplex()) { + } else if (ground->isComplex()) { ground->serializeItemNode_OTBM(self, f); } else { f.addByte(OTBM_ATTR_ITEM); @@ -1598,8 +1592,8 @@ bool IOMapOTBM::saveMap(Map& map, NodeFileWriteHandle& f) } } - for(Item* item : save_tile->items) { - if(!item->isMetaItem()) { + for (Item* item : save_tile->items) { + if (!item->isMetaItem()) { item->serializeItemNode_OTBM(self, f); } } @@ -1609,33 +1603,33 @@ bool IOMapOTBM::saveMap(Map& map, NodeFileWriteHandle& f) } // Only close the last node if one has actually been created - if(!first) { + if (!first) { f.endNode(); } f.addNode(OTBM_TOWNS); - for(const auto& townEntry : map.towns) { + for (const auto &townEntry : map.towns) { Town* town = townEntry.second; - const Position& townPosition = town->getTemplePosition(); + const Position &townPosition = town->getTemplePosition(); f.addNode(OTBM_TOWN); - f.addU32(town->getID()); - f.addString(town->getName()); - f.addU16(townPosition.x); - f.addU16(townPosition.y); - f.addU8(townPosition.z); + f.addU32(town->getID()); + f.addString(town->getName()); + f.addU16(townPosition.x); + f.addU16(townPosition.y); + f.addU8(townPosition.z); f.endNode(); } f.endNode(); - if(version.otbm >= MAP_OTBM_3) { + if (version.otbm >= MAP_OTBM_3) { f.addNode(OTBM_WAYPOINTS); - for(const auto& waypointEntry : map.waypoints) { + for (const auto &waypointEntry : map.waypoints) { Waypoint* waypoint = waypointEntry.second; f.addNode(OTBM_WAYPOINT); - f.addString(waypoint->name); - f.addU16(waypoint->pos.x); - f.addU16(waypoint->pos.y); - f.addU8(waypoint->pos.z); + f.addString(waypoint->name); + f.addU16(waypoint->pos.x); + f.addU16(waypoint->pos.y); + f.addU8(waypoint->pos.z); f.endNode(); } f.endNode(); @@ -1647,23 +1641,21 @@ bool IOMapOTBM::saveMap(Map& map, NodeFileWriteHandle& f) return true; } -bool IOMapOTBM::saveSpawns(Map& map, const FileName& dir) -{ +bool IOMapOTBM::saveSpawns(Map &map, const FileName &dir) { wxString filepath = dir.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME); filepath += wxString(map.spawnmonsterfile.c_str(), wxConvUTF8); // Create the XML file pugi::xml_document doc; - if(saveSpawns(map, doc)) { + if (saveSpawns(map, doc)) { return doc.save_file(filepath.wc_str(), "\t", pugi::format_default, pugi::encoding_utf8); } return false; } -bool IOMapOTBM::saveSpawns(Map& map, pugi::xml_document& doc) -{ +bool IOMapOTBM::saveSpawns(Map &map, pugi::xml_document &doc) { pugi::xml_node decl = doc.prepend_child(pugi::node_declaration); - if(!decl) { + if (!decl) { return false; } @@ -1672,10 +1664,11 @@ bool IOMapOTBM::saveSpawns(Map& map, pugi::xml_document& doc) MonsterList monsterList; pugi::xml_node spawnNodes = doc.append_child("monsters"); - for(const auto& spawnPosition : map.spawnsMonster) { - Tile *tile = map.getTile(spawnPosition); - if (tile == nullptr) + for (const auto &spawnPosition : map.spawnsMonster) { + Tile* tile = map.getTile(spawnPosition); + if (tile == nullptr) { continue; + } SpawnMonster* spawnMonster = tile->spawnMonster; ASSERT(spawnMonster); @@ -1688,12 +1681,12 @@ bool IOMapOTBM::saveSpawns(Map& map, pugi::xml_document& doc) int32_t radius = spawnMonster->getSize(); spawnNode.append_attribute("radius") = radius; - for(int32_t y = -radius; y <= radius; ++y) { - for(int32_t x = -radius; x <= radius; ++x) { + for (int32_t y = -radius; y <= radius; ++y) { + for (int32_t x = -radius; x <= radius; ++x) { Tile* monster_tile = map.getTile(spawnPosition + Position(x, y, 0)); - if(monster_tile) { + if (monster_tile) { Monster* monster = monster_tile->monster; - if(monster && !monster->isSaved()) { + if (monster && !monster->isSaved()) { pugi::xml_node monsterNode = spawnNode.append_child("monster"); monsterNode.append_attribute("name") = monster->getName().c_str(); monsterNode.append_attribute("x") = x; @@ -1705,7 +1698,7 @@ bool IOMapOTBM::saveSpawns(Map& map, pugi::xml_document& doc) } monsterNode.append_attribute("spawntime") = monsterSpawnTime; - if(monster->getDirection() != NORTH) { + if (monster->getDirection() != NORTH) { monsterNode.append_attribute("direction") = monster->getDirection(); } @@ -1718,49 +1711,47 @@ bool IOMapOTBM::saveSpawns(Map& map, pugi::xml_document& doc) } } - for(Monster* monster : monsterList) { + for (Monster* monster : monsterList) { monster->reset(); } return true; } -bool IOMapOTBM::saveHouses(Map& map, const FileName& dir) -{ +bool IOMapOTBM::saveHouses(Map &map, const FileName &dir) { wxString filepath = dir.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME); filepath += wxString(map.housefile.c_str(), wxConvUTF8); // Create the XML file pugi::xml_document doc; - if(saveHouses(map, doc)) { + if (saveHouses(map, doc)) { return doc.save_file(filepath.wc_str(), "\t", pugi::format_default, pugi::encoding_utf8); } return false; } -bool IOMapOTBM::saveHouses(Map& map, pugi::xml_document& doc) -{ +bool IOMapOTBM::saveHouses(Map &map, pugi::xml_document &doc) { pugi::xml_node decl = doc.prepend_child(pugi::node_declaration); - if(!decl) { + if (!decl) { return false; } decl.append_attribute("version") = "1.0"; pugi::xml_node houseNodes = doc.append_child("houses"); - for(const auto& houseEntry : map.houses) { + for (const auto &houseEntry : map.houses) { const House* house = houseEntry.second; pugi::xml_node houseNode = houseNodes.append_child("house"); houseNode.append_attribute("name") = house->name.c_str(); houseNode.append_attribute("houseid") = house->id; - const Position& exitPosition = house->getExit(); + const Position &exitPosition = house->getExit(); houseNode.append_attribute("entryx") = exitPosition.x; houseNode.append_attribute("entryy") = exitPosition.y; houseNode.append_attribute("entryz") = exitPosition.z; houseNode.append_attribute("rent") = house->rent; - if(house->guildhall) { + if (house->guildhall) { houseNode.append_attribute("guildhall") = true; } @@ -1772,23 +1763,21 @@ bool IOMapOTBM::saveHouses(Map& map, pugi::xml_document& doc) return true; } -bool IOMapOTBM::saveSpawnsNpc(Map& map, const FileName& dir) -{ +bool IOMapOTBM::saveSpawnsNpc(Map &map, const FileName &dir) { wxString filepath = dir.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME); filepath += wxString(map.spawnnpcfile.c_str(), wxConvUTF8); // Create the XML file pugi::xml_document doc; - if(saveSpawnsNpc(map, doc)) { + if (saveSpawnsNpc(map, doc)) { return doc.save_file(filepath.wc_str(), "\t", pugi::format_default, pugi::encoding_utf8); } return false; } -bool IOMapOTBM::saveSpawnsNpc(Map& map, pugi::xml_document& doc) -{ +bool IOMapOTBM::saveSpawnsNpc(Map &map, pugi::xml_document &doc) { pugi::xml_node decl = doc.prepend_child(pugi::node_declaration); - if(!decl) { + if (!decl) { return false; } @@ -1797,10 +1786,11 @@ bool IOMapOTBM::saveSpawnsNpc(Map& map, pugi::xml_document& doc) NpcList npcList; pugi::xml_node spawnNodes = doc.append_child("npcs"); - for(const auto& spawnPosition : map.spawnsNpc) { - Tile *tile = map.getTile(spawnPosition); - if (tile == nullptr) + for (const auto &spawnPosition : map.spawnsNpc) { + Tile* tile = map.getTile(spawnPosition); + if (tile == nullptr) { continue; + } SpawnNpc* spawnNpc = tile->spawnNpc; ASSERT(spawnNpc); @@ -1813,19 +1803,19 @@ bool IOMapOTBM::saveSpawnsNpc(Map& map, pugi::xml_document& doc) int32_t radius = spawnNpc->getSize(); spawnNpcNode.append_attribute("radius") = radius; - for(int32_t y = -radius; y <= radius; ++y) { - for(int32_t x = -radius; x <= radius; ++x) { + for (int32_t y = -radius; y <= radius; ++y) { + for (int32_t x = -radius; x <= radius; ++x) { Tile* npcTile = map.getTile(spawnPosition + Position(x, y, 0)); - if(npcTile) { + if (npcTile) { Npc* npc = npcTile->npc; - if(npc && !npc->isSaved()) { + if (npc && !npc->isSaved()) { pugi::xml_node npcNode = spawnNpcNode.append_child("npc"); npcNode.append_attribute("name") = npc->getName().c_str(); npcNode.append_attribute("x") = x; npcNode.append_attribute("y") = y; npcNode.append_attribute("z") = spawnPosition.z; npcNode.append_attribute("spawntime") = npc->getSpawnNpcTime(); - if(npc->getDirection() != NORTH) { + if (npc->getDirection() != NORTH) { npcNode.append_attribute("direction") = npc->getDirection(); } @@ -1838,7 +1828,7 @@ bool IOMapOTBM::saveSpawnsNpc(Map& map, pugi::xml_document& doc) } } - for(Npc* npc : npcList) { + for (Npc* npc : npcList) { npc->reset(); } return true; diff --git a/source/iomap_otbm.h b/source/iomap_otbm.h index aeb6d332..782d7086 100644 --- a/source/iomap_otbm.h +++ b/source/iomap_otbm.h @@ -23,8 +23,7 @@ // Pragma pack is VERY important since otherwise it won't be able to load the structs correctly #pragma pack(1) -enum OTBM_ItemAttribute -{ +enum OTBM_ItemAttribute { OTBM_ATTR_DESCRIPTION = 1, OTBM_ATTR_EXT_FILE = 2, OTBM_ATTR_TILE_FLAGS = 3, @@ -52,8 +51,7 @@ enum OTBM_ItemAttribute OTBM_ATTR_ATTRIBUTE_MAP = 128 }; -enum OTBM_NodeTypes_t -{ +enum OTBM_NodeTypes_t { OTBM_ROOTV1 = 1, OTBM_MAP_DATA = 2, OTBM_ITEM_DEF = 3, @@ -74,8 +72,7 @@ enum OTBM_NodeTypes_t OTBM_SPAWNS_NPC = 18 }; -struct OTBM_root_header -{ +struct OTBM_root_header { uint32_t version; uint16_t width; uint16_t height; @@ -83,35 +80,30 @@ struct OTBM_root_header uint32_t minorVersionItems; }; -struct OTBM_TeleportDest -{ +struct OTBM_TeleportDest { uint16_t x; uint16_t y; uint8_t z; }; -struct OTBM_Tile_area_coords -{ +struct OTBM_Tile_area_coords { uint16_t x; uint16_t y; uint8_t z; }; -struct OTBM_Tile_coords -{ +struct OTBM_Tile_coords { uint8_t x; uint8_t y; }; -struct OTBM_TownTemple_coords -{ +struct OTBM_TownTemple_coords { uint16_t x; uint16_t y; uint8_t z; }; -struct OTBM_HouseTile_coords -{ +struct OTBM_HouseTile_coords { uint8_t x; uint8_t y; uint32_t houseid; @@ -119,35 +111,36 @@ struct OTBM_HouseTile_coords #pragma pack() -class IOMapOTBM : public IOMap -{ +class IOMapOTBM : public IOMap { public: - IOMapOTBM(MapVersion ver) {version = ver;} - ~IOMapOTBM() {} + IOMapOTBM(MapVersion ver) { + version = ver; + } + ~IOMapOTBM() { } - static bool getVersionInfo(const FileName& identifier, MapVersion& out_ver); + static bool getVersionInfo(const FileName &identifier, MapVersion &out_ver); - virtual bool loadMap(Map& map, const FileName& identifier); - virtual bool saveMap(Map& map, const FileName& identifier); + virtual bool loadMap(Map &map, const FileName &identifier); + virtual bool saveMap(Map &map, const FileName &identifier); protected: - static bool getVersionInfo(NodeFileReadHandle* f, MapVersion& out_ver); - - virtual bool loadMap(Map& map, NodeFileReadHandle& handle); - bool loadSpawnsMonster(Map& map, const FileName& dir); - bool loadSpawnsMonster(Map& map, pugi::xml_document& doc); - bool loadHouses(Map& map, const FileName& dir); - bool loadHouses(Map& map, pugi::xml_document& doc); - bool loadSpawnsNpc(Map& map, const FileName& dir); - bool loadSpawnsNpc(Map& map, pugi::xml_document& doc); - - virtual bool saveMap(Map& map, NodeFileWriteHandle& handle); - bool saveSpawns(Map& map, const FileName& dir); - bool saveSpawns(Map& map, pugi::xml_document& doc); - bool saveHouses(Map& map, const FileName& dir); - bool saveHouses(Map& map, pugi::xml_document& doc); - bool saveSpawnsNpc(Map& map, const FileName& dir); - bool saveSpawnsNpc(Map& map, pugi::xml_document& doc); + static bool getVersionInfo(NodeFileReadHandle* f, MapVersion &out_ver); + + virtual bool loadMap(Map &map, NodeFileReadHandle &handle); + bool loadSpawnsMonster(Map &map, const FileName &dir); + bool loadSpawnsMonster(Map &map, pugi::xml_document &doc); + bool loadHouses(Map &map, const FileName &dir); + bool loadHouses(Map &map, pugi::xml_document &doc); + bool loadSpawnsNpc(Map &map, const FileName &dir); + bool loadSpawnsNpc(Map &map, pugi::xml_document &doc); + + virtual bool saveMap(Map &map, NodeFileWriteHandle &handle); + bool saveSpawns(Map &map, const FileName &dir); + bool saveSpawns(Map &map, pugi::xml_document &doc); + bool saveHouses(Map &map, const FileName &dir); + bool saveHouses(Map &map, pugi::xml_document &doc); + bool saveSpawnsNpc(Map &map, const FileName &dir); + bool saveSpawnsNpc(Map &map, pugi::xml_document &doc); }; #endif diff --git a/source/iomap_otmm.cpp b/source/iomap_otmm.cpp index ff465caa..cf895bdb 100644 --- a/source/iomap_otmm.cpp +++ b/source/iomap_otmm.cpp @@ -28,75 +28,68 @@ // ============================================================================ // Item -Item* Item::Create_OTMM(const IOMap& maphandle, BinaryNode* stream) -{ +Item* Item::Create_OTMM(const IOMap &maphandle, BinaryNode* stream) { uint16_t _id; - if(!stream->getU16(_id)) + if (!stream->getU16(_id)) { return nullptr; + } return Item::Create(_id); } -bool Item::readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute attr, BinaryNode* stream) -{ - switch(attr) - { - case OTMM_ATTR_SUBTYPE: - { +bool Item::readItemAttribute_OTMM(const IOMap &maphandle, OTMM_ItemAttribute attr, BinaryNode* stream) { + switch (attr) { + case OTMM_ATTR_SUBTYPE: { uint16_t subtype; - if(!stream->getU16(subtype)) + if (!stream->getU16(subtype)) { return false; + } setSubtype(subtype & 0xf); } break; - case OTMM_ATTR_ACTION_ID: - { + case OTMM_ATTR_ACTION_ID: { uint16_t aid; - if(!stream->getU16(aid)) { + if (!stream->getU16(aid)) { return false; } setActionID(aid); } break; - case OTMM_ATTR_UNIQUE_ID: - { + case OTMM_ATTR_UNIQUE_ID: { uint16_t uid; - if(!stream->getU16(uid)) + if (!stream->getU16(uid)) { return false; + } setUniqueID(uid); } break; - case OTMM_ATTR_TEXT: - { + case OTMM_ATTR_TEXT: { std::string text; - if(!stream->getString(text)) + if (!stream->getString(text)) { return false; + } setText(text); } break; - case OTMM_ATTR_DESC: - { + case OTMM_ATTR_DESC: { std::string text; - if(!stream->getString(text)) + if (!stream->getString(text)) { return false; + } setDescription(text); } break; // If otb structure changes.... - case OTMM_ATTR_DEPOT_ID: - { + case OTMM_ATTR_DEPOT_ID: { return stream->skip(2); } break; - case OTMM_ATTR_DOOR_ID: - { + case OTMM_ATTR_DOOR_ID: { return stream->skip(1); } break; - case OTMM_ATTR_TELE_DEST: - { + case OTMM_ATTR_TELE_DEST: { return stream->skip(5); } break; - default: - { + default: { return false; } break; } @@ -104,55 +97,47 @@ bool Item::readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute att return true; } -bool Item::unserializeAttributes_OTMM(const IOMap& maphandle, BinaryNode* stream) -{ +bool Item::unserializeAttributes_OTMM(const IOMap &maphandle, BinaryNode* stream) { uint8_t attribute; - while(stream->getU8(attribute)) - { - if(!readItemAttribute_OTMM(maphandle, OTMM_ItemAttribute(attribute), stream)) - { + while (stream->getU8(attribute)) { + if (!readItemAttribute_OTMM(maphandle, OTMM_ItemAttribute(attribute), stream)) { return false; } } return true; } -bool Item::unserializeItemNode_OTMM(const IOMap& maphandle, BinaryNode* node) -{ +bool Item::unserializeItemNode_OTMM(const IOMap &maphandle, BinaryNode* node) { return unserializeAttributes_OTMM(maphandle, node); } -void Item::serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHandle& stream) const -{ - if(getSubtype() > 0) { +void Item::serializeItemAttributes_OTMM(const IOMap &maphandle, NodeFileWriteHandle &stream) const { + if (getSubtype() > 0) { stream.addU8(OTMM_ATTR_SUBTYPE); stream.addU16(getSubtype()); } - if(getActionID()) { + if (getActionID()) { stream.addU8(OTMM_ATTR_ACTION_ID); stream.addU16(getActionID()); } - if(getUniqueID()) { + if (getUniqueID()) { stream.addU8(OTMM_ATTR_UNIQUE_ID); stream.addU16(getUniqueID()); } - if(getText().length() > 0) { + if (getText().length() > 0) { stream.addU8(OTMM_ATTR_TEXT); stream.addString(getText()); } } -void Item::serializeItemCompact_OTMM(const IOMap& maphandle, NodeFileWriteHandle& stream) const -{ +void Item::serializeItemCompact_OTMM(const IOMap &maphandle, NodeFileWriteHandle &stream) const { stream.addU16(id); } - -bool Item::serializeItemNode_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f) const -{ +bool Item::serializeItemNode_OTMM(const IOMap &maphandle, NodeFileWriteHandle &f) const { f.addNode(OTMM_ITEM); f.addU16(id); serializeItemAttributes_OTMM(maphandle, f); @@ -164,16 +149,12 @@ bool Item::serializeItemNode_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f // ============================================================================ // Teleport -bool Teleport::readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute attribute, BinaryNode* stream) -{ - if(attribute == OTMM_ATTR_TELE_DEST) { +bool Teleport::readItemAttribute_OTMM(const IOMap &maphandle, OTMM_ItemAttribute attribute, BinaryNode* stream) { + if (attribute == OTMM_ATTR_TELE_DEST) { uint16_t x = 0; uint16_t y = 0; uint8_t z = 0; - if(!stream->getU16(x) || - !stream->getU16(y) || - !stream->getU8(z)) - { + if (!stream->getU16(x) || !stream->getU16(y) || !stream->getU8(z)) { return false; } @@ -184,8 +165,7 @@ bool Teleport::readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute } } -void Teleport::serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHandle& stream) const -{ +void Teleport::serializeItemAttributes_OTMM(const IOMap &maphandle, NodeFileWriteHandle &stream) const { Item::serializeItemAttributes_OTMM(maphandle, stream); stream.addByte(OTMM_ATTR_TELE_DEST); @@ -197,10 +177,10 @@ void Teleport::serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWrit // ============================================================================ // Door -bool Door::readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute attribute, BinaryNode* stream) { - if(attribute == OTMM_ATTR_DOOR_ID) { +bool Door::readItemAttribute_OTMM(const IOMap &maphandle, OTMM_ItemAttribute attribute, BinaryNode* stream) { + if (attribute == OTMM_ATTR_DOOR_ID) { uint8_t id = 0; - if(!stream->getU8(id)) { + if (!stream->getU8(id)) { return false; } doorid = id; @@ -210,9 +190,9 @@ bool Door::readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute att } } -void Door::serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHandle& stream) const { +void Door::serializeItemAttributes_OTMM(const IOMap &maphandle, NodeFileWriteHandle &stream) const { Item::serializeItemAttributes_OTMM(maphandle, stream); - if(doorid) { + if (doorid) { stream.addByte(OTMM_ATTR_DOOR_ID); stream.addU8(doorid); } @@ -221,11 +201,10 @@ void Door::serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHan // ============================================================================ // Depots -bool Depot::readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute attribute, BinaryNode* stream) -{ - if(attribute == OTMM_ATTR_DEPOT_ID) { +bool Depot::readItemAttribute_OTMM(const IOMap &maphandle, OTMM_ItemAttribute attribute, BinaryNode* stream) { + if (attribute == OTMM_ATTR_DEPOT_ID) { uint16_t id = 0; - if(!stream->getU16(id)) { + if (!stream->getU16(id)) { return false; } depotid = id; @@ -235,10 +214,9 @@ bool Depot::readItemAttribute_OTMM(const IOMap& maphandle, OTMM_ItemAttribute at } } -void Depot::serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHandle& stream) const -{ +void Depot::serializeItemAttributes_OTMM(const IOMap &maphandle, NodeFileWriteHandle &stream) const { Item::serializeItemAttributes_OTMM(maphandle, stream); - if(depotid) { + if (depotid) { stream.addByte(OTMM_ATTR_DEPOT_ID); stream.addU16(depotid); } @@ -247,78 +225,75 @@ void Depot::serializeItemAttributes_OTMM(const IOMap& maphandle, NodeFileWriteHa // ============================================================================ // Container -bool Container::unserializeItemNode_OTMM(const IOMap& maphandle, BinaryNode* node) -{ +bool Container::unserializeItemNode_OTMM(const IOMap &maphandle, BinaryNode* node) { bool ret = Item::unserializeAttributes_OTMM(maphandle, node); - if(ret) { + if (ret) { BinaryNode* child = node->getChild(); - if(child) do { - uint8_t type; - if(!child->getByte(type)) { - return false; - } - //load container items - if(type == OTMM_ITEM) { - Item* item = Item::Create_OTMM(maphandle, child); - if(!item) { + if (child) { + do { + uint8_t type; + if (!child->getByte(type)) { return false; } - if(!item->unserializeItemNode_OTMM(maphandle, child)) { - delete item; + // load container items + if (type == OTMM_ITEM) { + Item* item = Item::Create_OTMM(maphandle, child); + if (!item) { + return false; + } + if (!item->unserializeItemNode_OTMM(maphandle, child)) { + delete item; + return false; + } + contents.push_back(item); + } else { + // corrupted file data! return false; } - contents.push_back(item); - } else { - // corrupted file data! - return false; - } - } while(child->advance()); + } while (child->advance()); + } return true; } return false; } -bool Container::serializeItemNode_OTMM(const IOMap& maphandle, NodeFileWriteHandle& f) const -{ +bool Container::serializeItemNode_OTMM(const IOMap &maphandle, NodeFileWriteHandle &f) const { f.addNode(OTMM_ITEM); f.addU16(id); serializeItemAttributes_OTMM(maphandle, f); - for(ItemVector::const_iterator it = contents.begin(); it != contents.end(); ++it) { + for (ItemVector::const_iterator it = contents.begin(); it != contents.end(); ++it) { (*it)->serializeItemNode_OTMM(maphandle, f); } f.endNode(); return true; } - -IOMapOTMM::IOMapOTMM() -{ +IOMapOTMM::IOMapOTMM() { } -IOMapOTMM::~IOMapOTMM() -{ +IOMapOTMM::~IOMapOTMM() { } - -ClientVersionID IOMapOTMM::getVersionInfo(const FileName& filename) -{ +ClientVersionID IOMapOTMM::getVersionInfo(const FileName &filename) { wxString wpath = filename.GetFullPath(); DiskNodeFileReadHandle f((const char*)wpath.mb_str(wxConvUTF8)); - if(f.isOk() == false) { + if (f.isOk() == false) { return CLIENT_VERSION_NONE; } BinaryNode* root = f.getRootNode(); - if(!root) {return CLIENT_VERSION_NONE;} + if (!root) { + return CLIENT_VERSION_NONE; + } root->skip(1); // Skip the type byte uint16_t u16; uint32_t u32; - if(!root->getU32(u32) || u32 != 1) { // Version + if (!root->getU32(u32) || u32 != 1) { // Version return CLIENT_VERSION_NONE; } @@ -326,30 +301,34 @@ ClientVersionID IOMapOTMM::getVersionInfo(const FileName& filename) root->getU16(u16); root->getU32(u32); - if(root->getU32(u32)) { // OTB minor version + if (root->getU32(u32)) { // OTB minor version return ClientVersionID(u32); } return CLIENT_VERSION_NONE; } -bool IOMapOTMM::loadMap(Map& map, const FileName& identifier, bool showdialog) { - if(showdialog) g_gui.CreateLoadBar("Loading OTMM map..."); +bool IOMapOTMM::loadMap(Map &map, const FileName &identifier, bool showdialog) { + if (showdialog) { + g_gui.CreateLoadBar("Loading OTMM map..."); + } DiskNodeFileReadHandle f(nstr(identifier.GetFullPath())); - if(f.isOk() == false) { + if (f.isOk() == false) { error("Couldn't open file for reading\nThe error reported was: " + wxstr(f.getErrorMessage())); return false; } bool ret = loadMap(map, f, identifier, showdialog); - if(showdialog) g_gui.DestroyLoadBar(); + if (showdialog) { + g_gui.DestroyLoadBar(); + } return ret; } -bool IOMapOTMM::loadMap(Map& map, NodeFileReadHandle& f, const FileName& identifier, bool showdialog) { +bool IOMapOTMM::loadMap(Map &map, NodeFileReadHandle &f, const FileName &identifier, bool showdialog) { BinaryNode* root = f.getRootNode(); - if(!root) { + if (!root) { error("Could not read root node."); return false; } @@ -359,24 +338,24 @@ bool IOMapOTMM::loadMap(Map& map, NodeFileReadHandle& f, const FileName& identif uint16_t u16; uint32_t u32; - if(!root->getU32(u32) || u32 != 1) { // Version + if (!root->getU32(u32) || u32 != 1) { // Version error("Unsupported or damaged map version."); return false; } - if(!root->getU16(u16)) { + if (!root->getU16(u16)) { error("Could not read root header."); return false; } map.width = u16; - if(!root->getU16(u16)) { + if (!root->getU16(u16)) { error("Could not read root header."); return false; } map.height = u16; - if(!root->getU32(u32) || u32 > (unsigned long)g_items.MajorVersion) { // OTB major version - if(queryUser("Map error", "The loaded map appears to be a items.otb format that deviates from the items.otb loaded by the editor. Do you still want to attempt to load the map?")) { + if (!root->getU32(u32) || u32 > (unsigned long)g_items.MajorVersion) { // OTB major version + if (queryUser("Map error", "The loaded map appears to be a items.otb format that deviates from the items.otb loaded by the editor. Do you still want to attempt to load the map?")) { warning("Unsupported or damaged map version"); } else { error("Outdated items.otb, could not load map."); @@ -384,519 +363,518 @@ bool IOMapOTMM::loadMap(Map& map, NodeFileReadHandle& f, const FileName& identif } } - if(!root->getU32(u32) || u32 > (unsigned long)g_items.MinorVersion) { // OTB minor version + if (!root->getU32(u32) || u32 > (unsigned long)g_items.MinorVersion) { // OTB minor version warning("The editor needs an updated items.otb version."); } BinaryNode* mapHeaderNode = root->getChild(); - if(mapHeaderNode == nullptr || !mapHeaderNode->getByte(u8) || u8 != OTMM_MAP_DATA) { + if (mapHeaderNode == nullptr || !mapHeaderNode->getByte(u8) || u8 != OTMM_MAP_DATA) { error("Could not get root child node. Cannot recover from fatal error!"); return false; } - int nodes_loaded = 0; BinaryNode* mapNode = mapHeaderNode->getChild(); - if(mapNode) do { - ++nodes_loaded; - if(showdialog && nodes_loaded % 15 == 0) { - g_gui.SetLoadDone(int(100.0 * f.tell() / f.size())); - } - uint8_t node_type; - if(!mapNode->getByte(node_type)) { - warning("Invalid map node"); - continue; - } - switch(node_type) { - case OTMM_EDITOR: { - } break; - case OTMM_DESCRIPTION: { - std::string desc; - mapNode->getString(desc); - map.setMapDescription(desc); - } break; - case OTMM_TILE_DATA: { - BinaryNode* tileNode = mapNode->getChild(); - if(tileNode) do { - Tile* tile = nullptr; - uint8_t tile_type; - if(!tileNode->getByte(tile_type)) { - warning("Invalid tile type"); - continue; - } - if(tile_type != OTMM_TILE && tile_type != OTMM_HOUSETILE) { - warning("Unknown type of tile node"); - continue; - } - - uint16_t x_offset, y_offset; - uint8_t z_offset; - if(!tileNode->getU16(x_offset) || - !tileNode->getU16(y_offset) || - !tileNode->getU8(z_offset) - ) - { - warning("Could not read position of tile"); - continue; - } - const Position pos(x_offset, y_offset, z_offset); - - if(map.getTile(pos)) { - warning("Duplicate tile at %d:%d:%d, discarding duplicate", pos.x, pos.y, pos.z); - continue; - } + if (mapNode) { + do { + ++nodes_loaded; + if (showdialog && nodes_loaded % 15 == 0) { + g_gui.SetLoadDone(int(100.0 * f.tell() / f.size())); + } + uint8_t node_type; + if (!mapNode->getByte(node_type)) { + warning("Invalid map node"); + continue; + } + switch (node_type) { + case OTMM_EDITOR: { + } break; + case OTMM_DESCRIPTION: { + std::string desc; + mapNode->getString(desc); + map.setMapDescription(desc); + } break; + case OTMM_TILE_DATA: { + BinaryNode* tileNode = mapNode->getChild(); + if (tileNode) { + do { + Tile* tile = nullptr; + uint8_t tile_type; + if (!tileNode->getByte(tile_type)) { + warning("Invalid tile type"); + continue; + } + if (tile_type != OTMM_TILE && tile_type != OTMM_HOUSETILE) { + warning("Unknown type of tile node"); + continue; + } - tile = map.allocator(pos); - House* house = nullptr; - if(tile_type == OTMM_HOUSETILE) { - uint32_t house_id; - if(!tileNode->getU32(house_id)) { - warning("House tile without house data, discarding tile"); - continue; - } - if(house_id) { - house = map.houses.getHouse(house_id); - if(!house) { - house = newd House(map); - house->id = house_id; - map.houses.addHouse(house); + uint16_t x_offset, y_offset; + uint8_t z_offset; + if (!tileNode->getU16(x_offset) || !tileNode->getU16(y_offset) || !tileNode->getU8(z_offset)) { + warning("Could not read position of tile"); + continue; } - } else { - warning("Invalid house id from tile %d:%d:%d", pos.x, pos.y, pos.z); - } - } + const Position pos(x_offset, y_offset, z_offset); - uint16_t ground_id; - tileNode->getU16(ground_id); - if(ground_id != 0) { - tile->addItem(Item::Create(ground_id)); - } + if (map.getTile(pos)) { + warning("Duplicate tile at %d:%d:%d, discarding duplicate", pos.x, pos.y, pos.z); + continue; + } - uint8_t attribute; - while(tileNode->getU8(attribute)) { - switch(attribute) { - case OTMM_ATTR_TILE_FLAGS: { - uint32_t flags = 0; - if(!tileNode->getU32(flags)) { - warning("Invalid tile flags of tile on %d:%d:%d", pos.x, pos.y, pos.z); + tile = map.allocator(pos); + House* house = nullptr; + if (tile_type == OTMM_HOUSETILE) { + uint32_t house_id; + if (!tileNode->getU32(house_id)) { + warning("House tile without house data, discarding tile"); + continue; } - tile->setMapFlags(flags); - } break; - default: { - warning("Unknown tile attribute at %d:%d:%d", pos.x, pos.y, pos.z); - } break; - } - } - - BinaryNode* itemNode = tileNode->getChild(); - if(itemNode) do { - Item* item = nullptr; - uint8_t item_type; - if(!itemNode->getByte(item_type)) { - warning("Unknown item type %d:%d:%d", pos.x, pos.y, pos.z); - continue; - } - if(item_type == OTMM_ITEM) { - item = Item::Create_OTMM(*this, itemNode); - if(item) { - if(item->unserializeItemNode_OTMM(*this, itemNode) == false) { - warning("Couldn't unserialize item attributes at %d:%d:%d", pos.x, pos.y, pos.z); + if (house_id) { + house = map.houses.getHouse(house_id); + if (!house) { + house = newd House(map); + house->id = house_id; + map.houses.addHouse(house); + } + } else { + warning("Invalid house id from tile %d:%d:%d", pos.x, pos.y, pos.z); } - tile->addItem(item); } - } else { - warning("Unknown type of tile child node"); - } - } while(itemNode->advance()); - tile->update(); - if(house) { - house->addTile(tile); - } - map.setTile(pos, tile); - } while(tileNode->advance()); - } break; - case OTMM_SPAWN_MONSTER_DATA: { - BinaryNode* spawnMonsterNode = mapNode->getChild(); - if(spawnMonsterNode) do { - uint8_t spawn_monster_type; - if(!spawnMonsterNode->getByte(spawn_monster_type)) { - warning("Could not read monster spawn type."); - continue; - } - if(spawn_monster_type != OTMM_SPAWN_MONSTER_AREA) { - warning("Invalid monster spawn type."); - continue; - } + uint16_t ground_id; + tileNode->getU16(ground_id); + if (ground_id != 0) { + tile->addItem(Item::Create(ground_id)); + } - // Read position - uint16_t spawnMonster_x, spawnMonster_y; - uint8_t spawnMonster_z; - uint32_t radius; - if(!spawnMonsterNode->getU16(spawnMonster_x) || - !spawnMonsterNode->getU16(spawnMonster_y) || - !spawnMonsterNode->getU8(spawnMonster_z) - ) - { - warning("Could not read monster spawn position."); - continue; - } - const Position spawnPos(spawnMonster_x, spawnMonster_y, spawnMonster_z); + uint8_t attribute; + while (tileNode->getU8(attribute)) { + switch (attribute) { + case OTMM_ATTR_TILE_FLAGS: { + uint32_t flags = 0; + if (!tileNode->getU32(flags)) { + warning("Invalid tile flags of tile on %d:%d:%d", pos.x, pos.y, pos.z); + } + tile->setMapFlags(flags); + } break; + default: { + warning("Unknown tile attribute at %d:%d:%d", pos.x, pos.y, pos.z); + } break; + } + } - // Read radius - if(!spawnMonsterNode->getU32(radius)) { - warning("Could not read monster spawn radius."); - continue; - } - // Adjust radius - radius = min(radius, uint32_t(g_settings.getInteger(Config::MAX_SPAWN_MONSTER_RADIUS))); + BinaryNode* itemNode = tileNode->getChild(); + if (itemNode) { + do { + Item* item = nullptr; + uint8_t item_type; + if (!itemNode->getByte(item_type)) { + warning("Unknown item type %d:%d:%d", pos.x, pos.y, pos.z); + continue; + } + if (item_type == OTMM_ITEM) { + item = Item::Create_OTMM(*this, itemNode); + if (item) { + if (item->unserializeItemNode_OTMM(*this, itemNode) == false) { + warning("Couldn't unserialize item attributes at %d:%d:%d", pos.x, pos.y, pos.z); + } + tile->addItem(item); + } + } else { + warning("Unknown type of tile child node"); + } + } while (itemNode->advance()); + } - // Create and assign monster spawn - Tile* spawnMonsterTile = map.getTile(spawnPos); - if(spawnMonsterTile && spawnMonsterTile->spawnMonster) { - warning("Duplicate monster spawn on position %d:%d:%d\n", spawnMonsterTile->getX(), spawnMonsterTile->getY(), spawnMonsterTile->getZ()); - continue; + tile->update(); + if (house) { + house->addTile(tile); + } + map.setTile(pos, tile); + } while (tileNode->advance()); } + } break; + case OTMM_SPAWN_MONSTER_DATA: { + BinaryNode* spawnMonsterNode = mapNode->getChild(); + if (spawnMonsterNode) { + do { + uint8_t spawn_monster_type; + if (!spawnMonsterNode->getByte(spawn_monster_type)) { + warning("Could not read monster spawn type."); + continue; + } + if (spawn_monster_type != OTMM_SPAWN_MONSTER_AREA) { + warning("Invalid monster spawn type."); + continue; + } - SpawnMonster* spawnMonster = newd SpawnMonster(radius); - if(!spawnMonsterTile) { - spawnMonsterTile = map.allocator(spawnPos); - map.setTile(spawnPos, spawnMonsterTile); - } - spawnMonsterTile->spawnMonster = spawnMonster; - map.addSpawnMonster(spawnMonsterTile); - - // Read any monsters associated with the spawnMonster - BinaryNode* monsterNode = spawnMonsterNode->getChild(); - if(monsterNode) do { - uint8_t monster_type; - if(!monsterNode->getByte(monster_type)) { - warning("Could not read type of monster node."); - continue; - } - std::string name; - uint32_t spawntime = 0; // Only applicable for monsters + // Read position + uint16_t spawnMonster_x, spawnMonster_y; + uint8_t spawnMonster_z; + uint32_t radius; + if (!spawnMonsterNode->getU16(spawnMonster_x) || !spawnMonsterNode->getU16(spawnMonster_y) || !spawnMonsterNode->getU8(spawnMonster_z)) { + warning("Could not read monster spawn position."); + continue; + } + const Position spawnPos(spawnMonster_x, spawnMonster_y, spawnMonster_z); - if(monster_type == OTMM_MONSTER) { - if(!monsterNode->getString(name)) { - warning("Could not read name of monster."); - return false; + // Read radius + if (!spawnMonsterNode->getU32(radius)) { + warning("Could not read monster spawn radius."); + continue; } - if(!monsterNode->getU32(spawntime)) { - warning("Could not read spawntime of monster."); - return false; + // Adjust radius + radius = min(radius, uint32_t(g_settings.getInteger(Config::MAX_SPAWN_MONSTER_RADIUS))); + + // Create and assign monster spawn + Tile* spawnMonsterTile = map.getTile(spawnPos); + if (spawnMonsterTile && spawnMonsterTile->spawnMonster) { + warning("Duplicate monster spawn on position %d:%d:%d\n", spawnMonsterTile->getX(), spawnMonsterTile->getY(), spawnMonsterTile->getZ()); + continue; } - } else { - warning("Unknown monster node type (0x%.2x).", monster_type); - return false; - } - - // Read monster position - uint16_t monster_x, monster_y; - uint8_t monster_z; - if(!monsterNode->getU16(monster_x) || - !monsterNode->getU16(monster_y) || - !monsterNode->getU8(monster_z) ) { - warning("Could not read monster position."); - continue; - } - const Position monsterPos(monster_x, monster_y, monster_z); - // Check radius - if(uint32_t(abs(monsterPos.x - spawnPos.x)) > radius || uint32_t(abs(monsterPos.y - spawnPos.y)) > radius) { - // Outside of the monster spawn... - } + SpawnMonster* spawnMonster = newd SpawnMonster(radius); + if (!spawnMonsterTile) { + spawnMonsterTile = map.allocator(spawnPos); + map.setTile(spawnPos, spawnMonsterTile); + } + spawnMonsterTile->spawnMonster = spawnMonster; + map.addSpawnMonster(spawnMonsterTile); + + // Read any monsters associated with the spawnMonster + BinaryNode* monsterNode = spawnMonsterNode->getChild(); + if (monsterNode) { + do { + uint8_t monster_type; + if (!monsterNode->getByte(monster_type)) { + warning("Could not read type of monster node."); + continue; + } + std::string name; + uint32_t spawntime = 0; // Only applicable for monsters + + if (monster_type == OTMM_MONSTER) { + if (!monsterNode->getString(name)) { + warning("Could not read name of monster."); + return false; + } + if (!monsterNode->getU32(spawntime)) { + warning("Could not read spawntime of monster."); + return false; + } + } else { + warning("Unknown monster node type (0x%.2x).", monster_type); + return false; + } - // Create monster and put on map - Tile* monster_tile; - if(monsterPos == spawnPos) { - monster_tile = spawnMonsterTile; - } else { - monster_tile = map.getTile(monsterPos); - } - if(!monster_tile) { - warning("Discarding monster \"%s\" at %d:%d:%d due to invalid position", name.c_str(), monsterPos.x, monsterPos.y, monsterPos.z); - break; - } - if(monster_tile->monster) { - warning("Duplicate monster \"%s\" at %d:%d:%d, discarding", name.c_str(), monsterPos.x, monsterPos.y, monsterPos.z); - break; - } - MonsterType* type = g_monsters[name]; - if(!type) { - type = g_monsters.addMissingMonsterType(name); - } - Monster* monster = newd Monster(type); - monster->setSpawnMonsterTime(spawntime); - monster_tile->monster = monster; - if(monster_tile->spawn_monster_count == 0) { - // No monster spawn, create a newd one (this happends if the radius of the monster spawn has been decreased due to g_settings) - ASSERT(monster_tile->spawnMonster == nullptr); - SpawnMonster* spawnMonster = newd SpawnMonster(5); - monster_tile->spawnMonster = spawnMonster; - map.addSpawnMonster(monster_tile); - } - } while(monsterNode->advance()); - } while(spawnMonsterNode->advance()); - } break; - case OTMM_SPAWN_NPC_DATA: { - BinaryNode* spawnNpcNode = mapNode->getChild(); - if(spawnNpcNode) do { - uint8_t spawnNpcType; - if(!spawnNpcNode->getByte(spawnNpcType)) { - warning("Could not read spawnNpc type."); - continue; - } - if(spawnNpcType != OTMM_SPAWN_NPC_AREA) { - warning("Invalid spawnNpc type."); - continue; - } + // Read monster position + uint16_t monster_x, monster_y; + uint8_t monster_z; + if (!monsterNode->getU16(monster_x) || !monsterNode->getU16(monster_y) || !monsterNode->getU8(monster_z)) { + warning("Could not read monster position."); + continue; + } + const Position monsterPos(monster_x, monster_y, monster_z); - // Read position - uint16_t spawnNpc_x, spawnNpc_y; - uint8_t spawnNpc_z; - uint32_t radius; - if(!spawnNpcNode->getU16(spawnNpc_x) || - !spawnNpcNode->getU16(spawnNpc_y) || - !spawnNpcNode->getU8(spawnNpc_z) - ) - { - warning("Could not read spawnNpc position."); - continue; - } - const Position spawnNpcPos(spawnNpc_x, spawnNpc_y, spawnNpc_z); + // Check radius + if (uint32_t(abs(monsterPos.x - spawnPos.x)) > radius || uint32_t(abs(monsterPos.y - spawnPos.y)) > radius) { + // Outside of the monster spawn... + } - // Read radius - if(!spawnNpcNode->getU32(radius)) { - warning("Could not read spawnNpc radius."); - continue; + // Create monster and put on map + Tile* monster_tile; + if (monsterPos == spawnPos) { + monster_tile = spawnMonsterTile; + } else { + monster_tile = map.getTile(monsterPos); + } + if (!monster_tile) { + warning("Discarding monster \"%s\" at %d:%d:%d due to invalid position", name.c_str(), monsterPos.x, monsterPos.y, monsterPos.z); + break; + } + if (monster_tile->monster) { + warning("Duplicate monster \"%s\" at %d:%d:%d, discarding", name.c_str(), monsterPos.x, monsterPos.y, monsterPos.z); + break; + } + MonsterType* type = g_monsters[name]; + if (!type) { + type = g_monsters.addMissingMonsterType(name); + } + Monster* monster = newd Monster(type); + monster->setSpawnMonsterTime(spawntime); + monster_tile->monster = monster; + if (monster_tile->spawn_monster_count == 0) { + // No monster spawn, create a newd one (this happends if the radius of the monster spawn has been decreased due to g_settings) + ASSERT(monster_tile->spawnMonster == nullptr); + SpawnMonster* spawnMonster = newd SpawnMonster(5); + monster_tile->spawnMonster = spawnMonster; + map.addSpawnMonster(monster_tile); + } + } while (monsterNode->advance()); + } + } while (spawnMonsterNode->advance()); } - // Adjust radius - radius = min(radius, uint32_t(g_settings.getInteger(Config::MAX_SPAWN_NPC_RADIUS))); + } break; + case OTMM_SPAWN_NPC_DATA: { + BinaryNode* spawnNpcNode = mapNode->getChild(); + if (spawnNpcNode) { + do { + uint8_t spawnNpcType; + if (!spawnNpcNode->getByte(spawnNpcType)) { + warning("Could not read spawnNpc type."); + continue; + } + if (spawnNpcType != OTMM_SPAWN_NPC_AREA) { + warning("Invalid spawnNpc type."); + continue; + } - // Create and assign spawnNpc - Tile* spawnNpcTile = map.getTile(spawnNpcPos); - if(spawnNpcTile && spawnNpcTile->spawnNpc) { - warning("Duplicate spawnNpc on position %d:%d:%d\n", spawnNpcTile->getX(), spawnNpcTile->getY(), spawnNpcTile->getZ()); - continue; - } + // Read position + uint16_t spawnNpc_x, spawnNpc_y; + uint8_t spawnNpc_z; + uint32_t radius; + if (!spawnNpcNode->getU16(spawnNpc_x) || !spawnNpcNode->getU16(spawnNpc_y) || !spawnNpcNode->getU8(spawnNpc_z)) { + warning("Could not read spawnNpc position."); + continue; + } + const Position spawnNpcPos(spawnNpc_x, spawnNpc_y, spawnNpc_z); - SpawnNpc* spawnNpc = newd SpawnNpc(radius); - if(!spawnNpcTile) { - spawnNpcTile = map.allocator(spawnNpcPos); - map.setTile(spawnNpcPos, spawnNpcTile); - } - spawnNpcTile->spawnNpc = spawnNpc; - map.addSpawnNpc(spawnNpcTile); - - // Read any npc associated with the npc spawn - BinaryNode* npcNode = spawnNpcNode->getChild(); - if(npcNode) do { - uint8_t npcType; - if(!npcNode->getByte(npcType)) { - warning("Could not read type of npc node."); - continue; - } - std::string name; - uint32_t spawntime = 0; + // Read radius + if (!spawnNpcNode->getU32(radius)) { + warning("Could not read spawnNpc radius."); + continue; + } + // Adjust radius + radius = min(radius, uint32_t(g_settings.getInteger(Config::MAX_SPAWN_NPC_RADIUS))); + + // Create and assign spawnNpc + Tile* spawnNpcTile = map.getTile(spawnNpcPos); + if (spawnNpcTile && spawnNpcTile->spawnNpc) { + warning("Duplicate spawnNpc on position %d:%d:%d\n", spawnNpcTile->getX(), spawnNpcTile->getY(), spawnNpcTile->getZ()); + continue; + } - if(npcType == OTMM_NPC) { - if(!npcNode->getString(name)) { - warning("Could not read name of NPC."); - return false; + SpawnNpc* spawnNpc = newd SpawnNpc(radius); + if (!spawnNpcTile) { + spawnNpcTile = map.allocator(spawnNpcPos); + map.setTile(spawnNpcPos, spawnNpcTile); } - } else { - warning("Unknown npc node type (0x%.2x).", npcType); - return false; - } + spawnNpcTile->spawnNpc = spawnNpc; + map.addSpawnNpc(spawnNpcTile); + + // Read any npc associated with the npc spawn + BinaryNode* npcNode = spawnNpcNode->getChild(); + if (npcNode) { + do { + uint8_t npcType; + if (!npcNode->getByte(npcType)) { + warning("Could not read type of npc node."); + continue; + } + std::string name; + uint32_t spawntime = 0; + + if (npcType == OTMM_NPC) { + if (!npcNode->getString(name)) { + warning("Could not read name of NPC."); + return false; + } + } else { + warning("Unknown npc node type (0x%.2x).", npcType); + return false; + } - // Read npc position - uint16_t npc_x, npc_y; - uint8_t npc_z; - if(!npcNode->getU16(npc_x) || - !npcNode->getU16(npc_y) || - !npcNode->getU8(npc_z) ) { - warning("Could not read npc position."); - continue; - } - const Position npcPos(npc_x, npc_y, npc_z); + // Read npc position + uint16_t npc_x, npc_y; + uint8_t npc_z; + if (!npcNode->getU16(npc_x) || !npcNode->getU16(npc_y) || !npcNode->getU8(npc_z)) { + warning("Could not read npc position."); + continue; + } + const Position npcPos(npc_x, npc_y, npc_z); - // Check radius - if(uint32_t(abs(npcPos.x - spawnNpcPos.x)) > radius || uint32_t(abs(npcPos.y - spawnNpcPos.y)) > radius) { - // Outside of the spawnNpc... - } + // Check radius + if (uint32_t(abs(npcPos.x - spawnNpcPos.x)) > radius || uint32_t(abs(npcPos.y - spawnNpcPos.y)) > radius) { + // Outside of the spawnNpc... + } - // Create npc and put on map - Tile* npcTile; - if(npcPos == spawnNpcPos) { - npcTile = spawnNpcTile; - } else { - npcTile = map.getTile(npcPos); - } - if(!npcTile) { - warning("Discarding npc \"%s\" at %d:%d:%d due to invalid position", name.c_str(), npcPos.x, npcPos.y, npcPos.z); - break; - } - if(npcTile->npc) { - warning("Duplicate npc \"%s\" at %d:%d:%d, discarding", name.c_str(), npcPos.x, npcPos.y, npcPos.z); - break; - } - NpcType* type = g_npcs[name]; - if(!type) { - type = g_npcs.addMissingNpcType(name); - } - Npc* npc = newd Npc(type); - npc->setSpawnNpcTime(spawntime); - npcTile->npc = npc; - if(npcTile->spawn_npc_count == 0) { - // No npc spawn, create a newd one (this happends if the radius of the npc spawn has been decreased due to g_settings) - ASSERT(npcTile->spawnNpc == nullptr); - SpawnNpc* spawnNpc = newd SpawnNpc(1); - npcTile->spawnNpc = spawnNpc; - map.addSpawnNpc(npcTile); - } - } while(npcNode->advance()); - } while(spawnNpcNode->advance()); - } break; - case OTMM_TOWN_DATA: { - BinaryNode* townNode = mapNode->getChild(); - if(townNode) do { - uint8_t town_type; - if(!townNode->getByte(town_type)) { - warning("Could not read town type"); - continue; - } - if(town_type != OTMM_TOWN) { - warning("Unknown town type"); - continue; - } - uint32_t town_id; - if(!townNode->getU32(town_id)) { - warning("Invalid town id"); - continue; + // Create npc and put on map + Tile* npcTile; + if (npcPos == spawnNpcPos) { + npcTile = spawnNpcTile; + } else { + npcTile = map.getTile(npcPos); + } + if (!npcTile) { + warning("Discarding npc \"%s\" at %d:%d:%d due to invalid position", name.c_str(), npcPos.x, npcPos.y, npcPos.z); + break; + } + if (npcTile->npc) { + warning("Duplicate npc \"%s\" at %d:%d:%d, discarding", name.c_str(), npcPos.x, npcPos.y, npcPos.z); + break; + } + NpcType* type = g_npcs[name]; + if (!type) { + type = g_npcs.addMissingNpcType(name); + } + Npc* npc = newd Npc(type); + npc->setSpawnNpcTime(spawntime); + npcTile->npc = npc; + if (npcTile->spawn_npc_count == 0) { + // No npc spawn, create a newd one (this happends if the radius of the npc spawn has been decreased due to g_settings) + ASSERT(npcTile->spawnNpc == nullptr); + SpawnNpc* spawnNpc = newd SpawnNpc(1); + npcTile->spawnNpc = spawnNpc; + map.addSpawnNpc(npcTile); + } + } while (npcNode->advance()); + } + } while (spawnNpcNode->advance()); } + } break; + case OTMM_TOWN_DATA: { + BinaryNode* townNode = mapNode->getChild(); + if (townNode) { + do { + uint8_t town_type; + if (!townNode->getByte(town_type)) { + warning("Could not read town type"); + continue; + } + if (town_type != OTMM_TOWN) { + warning("Unknown town type"); + continue; + } + uint32_t town_id; + if (!townNode->getU32(town_id)) { + warning("Invalid town id"); + continue; + } - Town* town = map.towns.getTown(town_id); - if(town) { - warning("Duplicate town id %d, discarding duplicate", town_id); - continue; - } else { - town = newd Town(town_id); - if(!map.towns.addTown(town)) { - delete town; - continue; - } - } - std::string town_name; - if(!townNode->getString(town_name)) { - warning("Invalid town name"); - continue; - } - town->setName(town_name); - Position pos; - uint16_t x; - uint16_t y; - uint8_t z; - if(!townNode->getU16(x) || - !townNode->getU16(y) || - !townNode->getU8(z)) - { - warning("Invalid town temple position"); - continue; - } - pos.x = x; - pos.y = y; - pos.z = z; - town->setTemplePosition(pos); - } while(townNode->advance()); - } break; - case OTMM_HOUSE_DATA: { - BinaryNode* houseNode = mapNode->getChild(); - if(houseNode) do { - uint8_t house_type; - if(!houseNode->getByte(house_type)) { - warning("Could not read house type"); - continue; - } - if(house_type != OTMM_HOUSE) { - warning("Unknown house type."); - continue; - } - uint32_t house_id; - if(!houseNode->getU32(house_id)) { - warning("Could not read house id."); - continue; + Town* town = map.towns.getTown(town_id); + if (town) { + warning("Duplicate town id %d, discarding duplicate", town_id); + continue; + } else { + town = newd Town(town_id); + if (!map.towns.addTown(town)) { + delete town; + continue; + } + } + std::string town_name; + if (!townNode->getString(town_name)) { + warning("Invalid town name"); + continue; + } + town->setName(town_name); + Position pos; + uint16_t x; + uint16_t y; + uint8_t z; + if (!townNode->getU16(x) || !townNode->getU16(y) || !townNode->getU8(z)) { + warning("Invalid town temple position"); + continue; + } + pos.x = x; + pos.y = y; + pos.z = z; + town->setTemplePosition(pos); + } while (townNode->advance()); } + } break; + case OTMM_HOUSE_DATA: { + BinaryNode* houseNode = mapNode->getChild(); + if (houseNode) { + do { + uint8_t house_type; + if (!houseNode->getByte(house_type)) { + warning("Could not read house type"); + continue; + } + if (house_type != OTMM_HOUSE) { + warning("Unknown house type."); + continue; + } + uint32_t house_id; + if (!houseNode->getU32(house_id)) { + warning("Could not read house id."); + continue; + } - House* house = map.houses.getHouse(house_id); - if(!house) { - continue; - } + House* house = map.houses.getHouse(house_id); + if (!house) { + continue; + } - std::string house_name; - if(!houseNode->getString(house_name)) { - warning("Could not read house name."); - continue; - } + std::string house_name; + if (!houseNode->getString(house_name)) { + warning("Could not read house name."); + continue; + } - uint32_t town_id; - if(!houseNode->getU32(town_id)) { - warning("Could not read house town id."); - continue; - } + uint32_t town_id; + if (!houseNode->getU32(town_id)) { + warning("Could not read house town id."); + continue; + } - uint32_t rent; - if(!houseNode->getU32(rent)) { - warning("Could not read house rent."); - continue; - } + uint32_t rent; + if (!houseNode->getU32(rent)) { + warning("Could not read house rent."); + continue; + } - uint32_t beds; - if(!houseNode->getU32(beds)) { - warning("Could not read house max beds."); - continue; - } + uint32_t beds; + if (!houseNode->getU32(beds)) { + warning("Could not read house max beds."); + continue; + } - house->name = house_name; - house->townid = town_id; - house->rent = rent; - house->beds = beds; - - uint16_t x; - uint16_t y; - uint8_t z; - if(!houseNode->getU16(x) || - !houseNode->getU16(y) || - !houseNode->getU8(z)) - { - warning("Invalid town temple position"); - continue; + house->name = house_name; + house->townid = town_id; + house->rent = rent; + house->beds = beds; + + uint16_t x; + uint16_t y; + uint8_t z; + if (!houseNode->getU16(x) || !houseNode->getU16(y) || !houseNode->getU8(z)) { + warning("Invalid town temple position"); + continue; + } + house->setExit(Position(x, y, z)); + } while (houseNode->advance()); } - house->setExit(Position(x, y, z)); - } while(houseNode->advance()); - } break; - } - } while(mapNode->advance()); + } break; + } + } while (mapNode->advance()); + } return true; } -bool IOMapOTMM::saveMap(Map& map, const FileName& identifier, bool showdialog) { +bool IOMapOTMM::saveMap(Map &map, const FileName &identifier, bool showdialog) { DiskNodeFileWriteHandle f(std::string(identifier.GetFullPath().mb_str(wxConvUTF8))); - if(f.isOk() == false){ + if (f.isOk() == false) { error("Can not open file %s for writing", (const char*)identifier.GetFullPath().mb_str(wxConvUTF8)); return false; } - if(showdialog) g_gui.CreateLoadBar("Saving OTMM map..."); + if (showdialog) { + g_gui.CreateLoadBar("Saving OTMM map..."); + } bool ret = saveMap(map, f, identifier, showdialog); - if(showdialog) g_gui.DestroyLoadBar(); + if (showdialog) { + g_gui.DestroyLoadBar(); + } return ret; } -bool IOMapOTMM::saveMap(Map& map, NodeFileWriteHandle& f, const FileName& identifier, bool showdialog) { +bool IOMapOTMM::saveMap(Map &map, NodeFileWriteHandle &f, const FileName &identifier, bool showdialog) { /* STOP! * Before you even think about modifying this, please reconsider. * while adding stuff to the binary format may be "cool", you'll @@ -908,78 +886,86 @@ bool IOMapOTMM::saveMap(Map& map, NodeFileWriteHandle& f, const FileName& identi * format. */ - f.addNode(0); { + f.addNode(0); + { f.addU32(1); // Version f.addU16(map.getWidth()); f.addU16(map.getHeight()); f.addU32(g_items.MajorVersion); f.addU32(g_items.MinorVersion); - f.addNode(OTMM_MAP_DATA); { - f.addNode(OTMM_EDITOR); { + f.addNode(OTMM_MAP_DATA); + { + f.addNode(OTMM_EDITOR); + { f.addString("Saved with Remere's Map Editor " + __RME_VERSION__); - } f.endNode(); // OTMM_DESCRIPTION - f.addNode(OTMM_DESCRIPTION); { + } + f.endNode(); // OTMM_DESCRIPTION + f.addNode(OTMM_DESCRIPTION); + { f.addString(map.getMapDescription()); - } f.endNode(); // OTMM_DESCRIPTION + } + f.endNode(); // OTMM_DESCRIPTION // Start writing tiles uint tiles_saved = 0; MapIterator map_iterator = map.begin(); - f.addNode(OTMM_TILE_DATA); { - while(map_iterator != map.end()) { + f.addNode(OTMM_TILE_DATA); + { + while (map_iterator != map.end()) { // Update progressbar ++tiles_saved; - if(showdialog && tiles_saved % 8192 == 0) { + if (showdialog && tiles_saved % 8192 == 0) { g_gui.SetLoadDone(int(tiles_saved / double(map.getTileCount()) * 100.0)); } // Get tile const Tile* save_tile = *map_iterator; - const Position& pos = save_tile->getPosition(); + const Position &pos = save_tile->getPosition(); // Is it an empty tile that we can skip? (Leftovers...) - if(save_tile->size() == 0) { + if (save_tile->size() == 0) { ++map_iterator; continue; } - f.addNode(save_tile->isHouseTile()? OTMM_HOUSETILE : OTMM_TILE); { + f.addNode(save_tile->isHouseTile() ? OTMM_HOUSETILE : OTMM_TILE); + { f.addU16(save_tile->getX()); f.addU16(save_tile->getY()); f.addU8(save_tile->getZ() & 0xf); - if(save_tile->isHouseTile()) { + if (save_tile->isHouseTile()) { f.addU32(save_tile->getHouseID()); } - if(save_tile->getMapFlags()) { + if (save_tile->getMapFlags()) { f.addByte(OTMM_ATTR_TILE_FLAGS); f.addU32(save_tile->getMapFlags()); } - if(save_tile->ground) { + if (save_tile->ground) { const Item* ground = save_tile->ground; - if(ground->isMetaItem()) { + if (ground->isMetaItem()) { // Do nothing, we don't save metaitems... f.addU16(0); - } else if(ground->hasBorderEquivalent()) { + } else if (ground->hasBorderEquivalent()) { bool found = false; - for(ItemVector::const_iterator it = save_tile->items.begin(); it != save_tile->items.end(); ++it) { - if((*it)->getGroundEquivalent() == ground->getID()) { + for (ItemVector::const_iterator it = save_tile->items.begin(); it != save_tile->items.end(); ++it) { + if ((*it)->getGroundEquivalent() == ground->getID()) { // Do nothing // Found equivalent found = true; break; } } - if(found == false) { + if (found == false) { f.addU16(ground->getID()); } else { f.addU16(0); } - } else if(ground->isComplex() || ground->hasSubtype()) { + } else if (ground->isComplex() || ground->hasSubtype()) { f.addU16(0); ground->serializeItemNode_OTMM(*this, f); } else { @@ -989,44 +975,50 @@ bool IOMapOTMM::saveMap(Map& map, NodeFileWriteHandle& f, const FileName& identi f.addU16(0); } - for(ItemVector::const_iterator it = save_tile->items.begin(); it != save_tile->items.end(); ++it) { - if(!(*it)->isMetaItem()) { + for (ItemVector::const_iterator it = save_tile->items.begin(); it != save_tile->items.end(); ++it) { + if (!(*it)->isMetaItem()) { (*it)->serializeItemNode_OTMM(*this, f); } } - } f.endNode(); + } + f.endNode(); ++map_iterator; } - } f.endNode(); // OTMM_TILE_DATA + } + f.endNode(); // OTMM_TILE_DATA - f.addNode(OTMM_SPAWN_MONSTER_DATA); { - SpawnsNpc& spawnsMonster = map.spawnsMonster; + f.addNode(OTMM_SPAWN_MONSTER_DATA); + { + SpawnsNpc &spawnsMonster = map.spawnsMonster; MonsterList monster_list; - for(SpawnNpcPositionList::const_iterator piter = spawnsMonster.begin(); piter != spawnsMonster.end(); ++piter) { + for (SpawnNpcPositionList::const_iterator piter = spawnsMonster.begin(); piter != spawnsMonster.end(); ++piter) { const Tile* tile = map.getTile(*piter); ASSERT(tile); const SpawnMonster* spawnMonster = tile->spawnMonster; ASSERT(spawnMonster); - f.addNode(OTMM_SPAWN_MONSTER_AREA); { + f.addNode(OTMM_SPAWN_MONSTER_AREA); + { f.addU16(tile->getX()); f.addU16(tile->getY()); f.addU8(tile->getZ() & 0xf); f.addU32(spawnMonster->getSize()); - for(int y = -tile->spawnMonster->getSize(); y <= tile->spawnMonster->getSize(); ++y) { - for(int x = -tile->spawnMonster->getSize(); x <= tile->spawnMonster->getSize(); ++x) { + for (int y = -tile->spawnMonster->getSize(); y <= tile->spawnMonster->getSize(); ++y) { + for (int x = -tile->spawnMonster->getSize(); x <= tile->spawnMonster->getSize(); ++x) { Tile* monster_tile = map.getTile(*piter + Position(x, y, 0)); - if(monster_tile) { + if (monster_tile) { Monster* c = monster_tile->monster; - if(c && c->isSaved() == false) { - f.addNode(OTMM_MONSTER); { + if (c && c->isSaved() == false) { + f.addNode(OTMM_MONSTER); + { f.addString(c->getName()); f.addU32(c->getSpawnMonsterTime()); f.addU16(monster_tile->getX()); f.addU16(monster_tile->getY()); f.addU8(monster_tile->getZ() & 0xf); - } f.endNode(); // OTMM_MONSTER + } + f.endNode(); // OTMM_MONSTER // Flag as saved c->save(); @@ -1035,39 +1027,45 @@ bool IOMapOTMM::saveMap(Map& map, NodeFileWriteHandle& f, const FileName& identi } } } - } f.endNode(); // OTMM_SPAWN_MONSTER_AREA + } + f.endNode(); // OTMM_SPAWN_MONSTER_AREA } - for(MonsterList::iterator iter = monster_list.begin(); iter != monster_list.end(); ++iter) { + for (MonsterList::iterator iter = monster_list.begin(); iter != monster_list.end(); ++iter) { (*iter)->reset(); } - } f.endNode(); // OTMM_SPAWN_MONSTER_DATA + } + f.endNode(); // OTMM_SPAWN_MONSTER_DATA - f.addNode(OTMM_SPAWN_NPC_DATA); { - SpawnsNpc& spawnNpc = map.spawnsNpc; + f.addNode(OTMM_SPAWN_NPC_DATA); + { + SpawnsNpc &spawnNpc = map.spawnsNpc; NpcList npcList; - for(SpawnNpcPositionList::const_iterator piter = spawnNpc.begin(); piter != spawnNpc.end(); ++piter) { + for (SpawnNpcPositionList::const_iterator piter = spawnNpc.begin(); piter != spawnNpc.end(); ++piter) { const Tile* tile = map.getTile(*piter); ASSERT(tile); const SpawnNpc* spawnNpc = tile->spawnNpc; ASSERT(spawnNpc); - f.addNode(OTMM_SPAWN_NPC_AREA); { + f.addNode(OTMM_SPAWN_NPC_AREA); + { f.addU16(tile->getX()); f.addU16(tile->getY()); f.addU8(tile->getZ() & 0xf); f.addU32(spawnNpc->getSize()); - for(int y = -tile->spawnNpc->getSize(); y <= tile->spawnNpc->getSize(); ++y) { - for(int x = -tile->spawnNpc->getSize(); x <= tile->spawnNpc->getSize(); ++x) { + for (int y = -tile->spawnNpc->getSize(); y <= tile->spawnNpc->getSize(); ++y) { + for (int x = -tile->spawnNpc->getSize(); x <= tile->spawnNpc->getSize(); ++x) { Tile* npcTile = map.getTile(*piter + Position(x, y, 0)); - if(npcTile) { + if (npcTile) { Npc* npc = npcTile->npc; - if(npc && npc->isSaved() == false) { - f.addNode(OTMM_NPC); { + if (npc && npc->isSaved() == false) { + f.addNode(OTMM_NPC); + { f.addString(npc->getName()); f.addU16(npcTile->getX()); f.addU16(npcTile->getY()); f.addU8(npcTile->getZ() & 0xf); - } f.endNode(); // OTMM_NPC + } + f.endNode(); // OTMM_NPC // Flag as saved npc->save(); @@ -1076,30 +1074,38 @@ bool IOMapOTMM::saveMap(Map& map, NodeFileWriteHandle& f, const FileName& identi } } } - } f.endNode(); // OTMM_SPAWN_NPC_AREA + } + f.endNode(); // OTMM_SPAWN_NPC_AREA } - for(NpcList::iterator iter = npc_list.begin(); iter != npc_list.end(); ++iter) { + for (NpcList::iterator iter = npc_list.begin(); iter != npc_list.end(); ++iter) { (*iter)->reset(); } - } f.endNode(); // OTMM_SPAWN_NPC_DATA + } + f.endNode(); // OTMM_SPAWN_NPC_DATA - f.addNode(OTMM_TOWN_DATA); { - for(TownMap::const_iterator it = map.towns.begin(); it != map.towns.end(); ++it) { + f.addNode(OTMM_TOWN_DATA); + { + for (TownMap::const_iterator it = map.towns.begin(); it != map.towns.end(); ++it) { const Town* town = it->second; - f.addNode(OTMM_TOWN); { + f.addNode(OTMM_TOWN); + { f.addU32(town->getID()); f.addString(town->getName()); f.addU16(town->getTemplePosition().x); f.addU16(town->getTemplePosition().y); f.addU8(town->getTemplePosition().z & 0xf); - } f.endNode(); // OTMM_TOWN + } + f.endNode(); // OTMM_TOWN } - } f.endNode(); // OTMM_TOWN_DATA + } + f.endNode(); // OTMM_TOWN_DATA - f.addNode(OTMM_HOUSE_DATA); { - for(HouseMap::const_iterator it = map.houses.begin(); it != map.houses.end(); ++it) { + f.addNode(OTMM_HOUSE_DATA); + { + for (HouseMap::const_iterator it = map.houses.begin(); it != map.houses.end(); ++it) { const House* house = it->second; - f.addNode(OTMM_HOUSE); { + f.addNode(OTMM_HOUSE); + { f.addU32(house->id); f.addString(house->name); f.addU16(house->townid); @@ -1108,10 +1114,14 @@ bool IOMapOTMM::saveMap(Map& map, NodeFileWriteHandle& f, const FileName& identi f.addU16(house->getExit().x); f.addU16(house->getExit().y); f.addU8(house->getExit().z & 0xf); - } f.endNode(); // OTMM_HOUSE + } + f.endNode(); // OTMM_HOUSE } - } f.endNode(); // OTMM_HOUSE_DATA - } f.endNode(); // OTMM_MAP_DATA - } f.endNode(); // root node + } + f.endNode(); // OTMM_HOUSE_DATA + } + f.endNode(); // OTMM_MAP_DATA + } + f.endNode(); // root node return true; } diff --git a/source/iomap_otmm.h b/source/iomap_otmm.h index 64b75c20..3514ccf5 100644 --- a/source/iomap_otmm.h +++ b/source/iomap_otmm.h @@ -55,7 +55,8 @@ enum OTMM_NodeTypes { OTMM_SPAWN_MONSTER_AREA = 8, OTMM_MONSTER = 9, OTMM_EMPTY = 10 // It's not used - OTMM_TOWN_DATA = 11, + OTMM_TOWN_DATA + = 11, OTMM_TOWN = 12, OTMM_HOUSE_DATA = 13, OTMM_HOUSE = 14, @@ -76,13 +77,13 @@ class IOMapOTMM : public IOMap { IOMapOTMM(); ~IOMapOTMM(); - virtual MapVersion getVersionInfo(const FileName& identifier); + virtual MapVersion getVersionInfo(const FileName &identifier); - virtual bool loadMap(Map& map, NodeFileReadHandle& handle, const FileName& identifier, bool showdialog); - virtual bool loadMap(Map& map, const FileName& identifier, bool showdialog); + virtual bool loadMap(Map &map, NodeFileReadHandle &handle, const FileName &identifier, bool showdialog); + virtual bool loadMap(Map &map, const FileName &identifier, bool showdialog); - virtual bool saveMap(Map& map, NodeFileWriteHandle& handle, const FileName& identifier, bool showdialog); - virtual bool saveMap(Map& map, const FileName& identifier, bool showdialog); + virtual bool saveMap(Map &map, NodeFileWriteHandle &handle, const FileName &identifier, bool showdialog); + virtual bool saveMap(Map &map, const FileName &identifier, bool showdialog); }; #endif diff --git a/source/iominimap.cpp b/source/iominimap.cpp index b8fa165c..ce850a8f 100644 --- a/source/iominimap.cpp +++ b/source/iominimap.cpp @@ -27,8 +27,7 @@ #include #include -void MinimapBlock::updateTile(int x, int y, const MinimapTile& tile) -{ +void MinimapBlock::updateTile(int x, int y, const MinimapTile &tile) { m_tiles[getTileIndex(x, y)] = tile; } @@ -36,18 +35,16 @@ IOMinimap::IOMinimap(Editor* editor, MinimapExportFormat format, MinimapExportMo m_editor(editor), m_format(format), m_mode(mode), - m_updateLoadbar(updateLoadbar) -{ + m_updateLoadbar(updateLoadbar) { } -bool IOMinimap::saveMinimap(const std::string& directory, const std::string& name, int floor) -{ - if(m_mode == MinimapExportMode::AllFloors || m_mode == MinimapExportMode::SelectedArea) { +bool IOMinimap::saveMinimap(const std::string &directory, const std::string &name, int floor) { + if (m_mode == MinimapExportMode::AllFloors || m_mode == MinimapExportMode::SelectedArea) { floor = -1; - } else if(m_mode == MinimapExportMode::GroundFloor) { + } else if (m_mode == MinimapExportMode::GroundFloor) { floor = rme::MapGroundLayer; - } else if(m_mode == MinimapExportMode::SpecificFloor) { - if(floor < rme::MapMinLayer || floor > rme::MapMaxLayer) { + } else if (m_mode == MinimapExportMode::SpecificFloor) { + if (floor < rme::MapMinLayer || floor > rme::MapMaxLayer) { floor = rme::MapGroundLayer; } } @@ -60,17 +57,15 @@ bool IOMinimap::saveMinimap(const std::string& directory, const std::string& nam return saveImage(directory, name); } -bool IOMinimap::saveOtmm(const wxFileName& file) -{ - try - { +bool IOMinimap::saveOtmm(const wxFileName &file) { + try { FileWriteHandle writer(file.GetFullPath().ToStdString()); - if(!writer.isOk()) { - //error("Unable to open file %s for save minimap", file); + if (!writer.isOk()) { + // error("Unable to open file %s for save minimap", file); return false; } - //TODO: compression flag with zlib + // TODO: compression flag with zlib uint32_t flags = 0; // header @@ -94,10 +89,10 @@ bool IOMinimap::saveOtmm(const wxFileName& file) readBlocks(); - for(uint8_t z = 0; z <= rme::MapMaxLayer; ++z) { - for(auto& it : m_blocks[z]) { + for (uint8_t z = 0; z <= rme::MapMaxLayer; ++z) { + for (auto &it : m_blocks[z]) { int index = it.first; - auto& block = it.second; + auto &block = it.second; // write index pos uint16_t x = static_cast((index % (65536 / MMBLOCK_SIZE)) * MMBLOCK_SIZE); @@ -122,7 +117,7 @@ bool IOMinimap::saveOtmm(const wxFileName& file) writer.flush(); writer.close(); - } catch(std::exception& e) { + } catch (std::exception &e) { m_error = wxString::Format("failed to save OTMM minimap: %s", e.what()); return false; } @@ -130,12 +125,9 @@ bool IOMinimap::saveOtmm(const wxFileName& file) return true; } -bool IOMinimap::saveImage(const std::string& directory, const std::string& name) -{ - try - { - switch(m_mode) - { +bool IOMinimap::saveImage(const std::string &directory, const std::string &name) { + try { + switch (m_mode) { case MinimapExportMode::AllFloors: case MinimapExportMode::GroundFloor: case MinimapExportMode::SpecificFloor: { @@ -147,19 +139,16 @@ bool IOMinimap::saveImage(const std::string& directory, const std::string& name) break; } } - } - catch(std::bad_alloc&) - { + } catch (std::bad_alloc &) { m_error = "There is not enough memory available to complete the operation."; } return true; } -bool IOMinimap::exportMinimap(const std::string& directory) -{ - auto& map = m_editor->getMap(); - if(map.size() == 0) { +bool IOMinimap::exportMinimap(const std::string &directory) { + auto &map = m_editor->getMap(); + if (map.size() == 0) { return true; } @@ -168,7 +157,7 @@ bool IOMinimap::exportMinimap(const std::string& directory) int max_z = m_floor == -1 ? rme::MapMaxLayer : m_floor; for (size_t z = min_z; z <= max_z; z++) { - auto& rect = bounds[z]; + auto &rect = bounds[z]; rect.x = rme::MapMaxWidth + 1; rect.y = rme::MapMaxHeight + 1; rect.width = 0; @@ -176,18 +165,18 @@ bool IOMinimap::exportMinimap(const std::string& directory) } int totalTiles = 0; - for(auto it = map.begin(); it != map.end(); ++it) { + for (auto it = map.begin(); it != map.end(); ++it) { auto tile = (*it)->get(); - if(!tile || (!tile->ground && tile->items.empty())) { + if (!tile || (!tile->ground && tile->items.empty())) { continue; } - const auto& position = tile->getPosition(); - auto& rect = bounds[position.z]; - if(position.x < rect.x) { + const auto &position = tile->getPosition(); + auto &rect = bounds[position.z]; + if (position.x < rect.x) { rect.x = position.x; } - if(position.y < rect.y) { + if (position.y < rect.y) { rect.y = position.y; } if (position.x > rect.width) { @@ -204,11 +193,11 @@ bool IOMinimap::exportMinimap(const std::string& directory) uint8_t* pixels = new uint8_t[pixels_size]; auto image = new wxImage(image_size, image_size, pixels, true); - int processedTiles = 0; - int lastShownProgress = -1; - for(size_t z = min_z; z <= max_z; z++) { - auto& rect = bounds[z]; - if(rect.IsEmpty()) { + int processedTiles = 0; + int lastShownProgress = -1; + for (size_t z = min_z; z <= max_z; z++) { + auto &rect = bounds[z]; + if (rect.IsEmpty()) { continue; } @@ -225,12 +214,12 @@ bool IOMinimap::exportMinimap(const std::string& directory) for (int y = 0; y < image_size; y++) { for (int x = 0; x < image_size; x++) { auto tile = map.getTile(w + x, h + y, z); - if(!tile || (!tile->ground && tile->items.empty())) { + if (!tile || (!tile->ground && tile->items.empty())) { index += rme::PixelFormatRGB; continue; } - processedTiles++; + processedTiles++; int progress = static_cast((static_cast(processedTiles) / totalTiles) * 100); if (progress > lastShownProgress) { if (m_updateLoadbar) { @@ -238,11 +227,11 @@ bool IOMinimap::exportMinimap(const std::string& directory) } lastShownProgress = progress; } - + uint8_t color = tile->getMiniMapColor(); - pixels[index ] = (uint8_t)(static_cast(color / 36) % 6 * 51); // red - pixels[index+1] = (uint8_t)(static_cast(color / 6) % 6 * 51); // green - pixels[index+2] = (uint8_t)(color % 6 * 51); // blue + pixels[index] = (uint8_t)(static_cast(color / 36) % 6 * 51); // red + pixels[index + 1] = (uint8_t)(static_cast(color / 6) % 6 * 51); // green + pixels[index + 2] = (uint8_t)(color % 6 * 51); // blue index += rme::PixelFormatRGB; empty = false; } @@ -251,7 +240,7 @@ bool IOMinimap::exportMinimap(const std::string& directory) if (!empty) { image->SetData(pixels, true); wxString extension = m_format == MinimapExportFormat::Png ? "png" : "bmp"; - wxBitmapType type = m_format == MinimapExportFormat::Png ? wxBITMAP_TYPE_PNG : wxBITMAP_TYPE_BMP; + wxBitmapType type = m_format == MinimapExportFormat::Png ? wxBITMAP_TYPE_PNG : wxBITMAP_TYPE_BMP; wxString extension_wx = wxString::FromAscii(extension.mb_str()); wxFileName file = wxString::Format("%s-%s-%s.%s", std::to_string(h), std::to_string(w), std::to_string(z), extension_wx); file.Normalize(wxPATH_NORM_ALL, directory); @@ -267,53 +256,51 @@ bool IOMinimap::exportMinimap(const std::string& directory) return true; } - -bool IOMinimap::exportSelection(const std::string& directory, const std::string& name) -{ +bool IOMinimap::exportSelection(const std::string &directory, const std::string &name) { int min_x = rme::MapMaxWidth + 1; int min_y = rme::MapMaxHeight + 1; int min_z = rme::MapMaxLayer + 1; int max_x = 0, max_y = 0, max_z = 0; - const auto& selection = m_editor->getSelection(); - const auto& tiles = selection.getTiles(); + const auto &selection = m_editor->getSelection(); + const auto &tiles = selection.getTiles(); - for(auto tile : tiles) { - if(!tile || (!tile->ground && tile->items.empty())) { + for (auto tile : tiles) { + if (!tile || (!tile->ground && tile->items.empty())) { continue; } - const auto& position = tile->getPosition(); - if(position.x < min_x) { + const auto &position = tile->getPosition(); + if (position.x < min_x) { min_x = position.x; } - if(position.x > max_x) { + if (position.x > max_x) { max_x = position.x; } - if(position.y < min_y) { + if (position.y < min_y) { min_y = position.y; } - if(position.y > max_y) { + if (position.y > max_y) { max_y = position.y; } - if(position.z < min_z) { + if (position.z < min_z) { min_z = position.z; } - if(position.z > max_z) { + if (position.z > max_z) { max_z = position.z; } } int numtiles = (max_x - min_x) * (max_y - min_y); - if(numtiles == 0) { + if (numtiles == 0) { return false; } int image_width = max_x - min_x + 1; int image_height = max_y - min_y + 1; - if(image_width > 2048 || image_height > 2048) { + if (image_width > 2048 || image_height > 2048) { g_gui.PopupDialog("Error", "Minimap size greater than 2048px.", wxOK); return false; } @@ -323,37 +310,37 @@ bool IOMinimap::exportSelection(const std::string& directory, const std::string& auto image = new wxImage(image_width, image_height, pixels, true); int tiles_iterated = 0; - for(int z = min_z; z <= max_z; z++) { + for (int z = min_z; z <= max_z; z++) { bool empty = true; memset(pixels, 0, pixels_size); - for(auto tile : tiles) { - if(tile->getZ() != z) { + for (auto tile : tiles) { + if (tile->getZ() != z) { continue; } if (m_updateLoadbar) { tiles_iterated++; - if(tiles_iterated % 8192 == 0) { + if (tiles_iterated % 8192 == 0) { g_gui.SetLoadDone(int(tiles_iterated / double(tiles.size()) * 90.0)); } } - if(!tile->ground && tile->items.empty()) { + if (!tile->ground && tile->items.empty()) { continue; } uint8_t color = tile->getMiniMapColor(); uint32_t index = ((tile->getY() - min_y) * image_width + (tile->getX() - min_x)) * 3; - pixels[index ] = (uint8_t)(static_cast(color / 36) % 6 * 51); // red - pixels[index+1] = (uint8_t)(static_cast(color / 6) % 6 * 51); // green - pixels[index+2] = (uint8_t)(color % 6 * 51); // blue + pixels[index] = (uint8_t)(static_cast(color / 36) % 6 * 51); // red + pixels[index + 1] = (uint8_t)(static_cast(color / 6) % 6 * 51); // green + pixels[index + 2] = (uint8_t)(color % 6 * 51); // blue empty = false; } if (!empty) { image->SetData(pixels, true); wxString extension = m_format == MinimapExportFormat::Png ? "png" : "bmp"; - wxBitmapType type = m_format == MinimapExportFormat::Png ? wxBITMAP_TYPE_PNG : wxBITMAP_TYPE_BMP; + wxBitmapType type = m_format == MinimapExportFormat::Png ? wxBITMAP_TYPE_PNG : wxBITMAP_TYPE_BMP; wxFileName file = wxString::Format("%s-%d.%s", name, z, extension); file.Normalize(wxPATH_NORM_ALL, directory); image->SaveFile(file.GetFullPath(), type); @@ -365,16 +352,15 @@ bool IOMinimap::exportSelection(const std::string& directory, const std::string& return true; } -void IOMinimap::readBlocks() -{ +void IOMinimap::readBlocks() { if (m_mode == MinimapExportMode::SelectedArea && !m_editor->hasSelection()) { return; } - auto& map = m_editor->getMap(); + auto &map = m_editor->getMap(); int tiles_iterated = 0; - for(auto it = map.begin(); it != map.end(); ++it) { + for (auto it = map.begin(); it != map.end(); ++it) { auto tile = (*it)->get(); if (m_updateLoadbar) { @@ -384,11 +370,11 @@ void IOMinimap::readBlocks() } } - if(!tile || (!tile->ground && tile->items.empty())) { + if (!tile || (!tile->ground && tile->items.empty())) { continue; } - const auto& position = tile->getPosition(); + const auto &position = tile->getPosition(); if (m_mode == MinimapExportMode::SelectedArea) { if (!tile->isSelected()) { @@ -404,18 +390,18 @@ void IOMinimap::readBlocks() if (tile->isBlocking()) { minimapTile.flags |= MinimapTileNotWalkable; } - //if (!tile->isPathable()) { - //minimapTile.flags |= MinimapTileNotPathable; + // if (!tile->isPathable()) { + // minimapTile.flags |= MinimapTileNotPathable; //} minimapTile.speed = std::min((int)std::ceil(tile->getGroundSpeed() / 10.f), 0xFF); - auto& blocks = m_blocks[position.z]; + auto &blocks = m_blocks[position.z]; uint32_t index = getBlockIndex(position); if (blocks.find(index) == blocks.end()) { blocks.insert({ index, MinimapBlock() }); } - auto& block = blocks.at(index); + auto &block = blocks.at(index); int offset_x = position.x - (position.x % MMBLOCK_SIZE); int offset_y = position.y - (position.y % MMBLOCK_SIZE); block.updateTile(position.x - offset_x, position.y - offset_y, minimapTile); diff --git a/source/iominimap.h b/source/iominimap.h index 7dfca939..214cdc18 100644 --- a/source/iominimap.h +++ b/source/iominimap.h @@ -45,43 +45,48 @@ enum MinimapTileFlags { MinimapTileNotWalkable = 4 }; -#pragma pack(push,1) // disable memory alignment -struct MinimapTile -{ +#pragma pack(push, 1) // disable memory alignment +struct MinimapTile { uint8_t flags = 0; uint8_t color = INVALID_MINIMAP_COLOR; uint8_t speed = 10; }; -class MinimapBlock -{ +class MinimapBlock { public: - void updateTile(int x, int y, const MinimapTile& tile); - MinimapTile& getTile(int x, int y) { return m_tiles[getTileIndex(x,y)]; } - inline uint32_t getTileIndex(int x, int y) const noexcept { return ((y % MMBLOCK_SIZE) * MMBLOCK_SIZE) + (x % MMBLOCK_SIZE); } - const std::array& getTiles() const noexcept { return m_tiles; } + void updateTile(int x, int y, const MinimapTile &tile); + MinimapTile &getTile(int x, int y) { + return m_tiles[getTileIndex(x, y)]; + } + inline uint32_t getTileIndex(int x, int y) const noexcept { + return ((y % MMBLOCK_SIZE) * MMBLOCK_SIZE) + (x % MMBLOCK_SIZE); + } + const std::array &getTiles() const noexcept { + return m_tiles; + } private: std::array m_tiles; }; #pragma pack(pop) -class IOMinimap -{ +class IOMinimap { public: IOMinimap(Editor* editor, MinimapExportFormat format, MinimapExportMode mode, bool updateLoadbar); - bool saveMinimap(const std::string& directory, const std::string& name, int floor = -1); + bool saveMinimap(const std::string &directory, const std::string &name, int floor = -1); - const std::string& getError() const noexcept { return m_error; } + const std::string &getError() const noexcept { + return m_error; + } private: - bool saveOtmm(const wxFileName& file); - bool saveImage(const std::string& directory, const std::string& name); - bool exportMinimap(const std::string& directory); - bool exportSelection(const std::string& directory, const std::string& name); + bool saveOtmm(const wxFileName &file); + bool saveImage(const std::string &directory, const std::string &name); + bool exportMinimap(const std::string &directory); + bool exportSelection(const std::string &directory, const std::string &name); void readBlocks(); - inline uint32_t getBlockIndex(const Position& pos) { + inline uint32_t getBlockIndex(const Position &pos) { return ((pos.y / MMBLOCK_SIZE) * (65536 / MMBLOCK_SIZE)) + (pos.x / MMBLOCK_SIZE); } diff --git a/source/item.cpp b/source/item.cpp index 6a9d4b7f..f18d5fba 100644 --- a/source/item.cpp +++ b/source/item.cpp @@ -30,29 +30,30 @@ #include "table_brush.h" #include "wall_brush.h" -Item* Item::Create(uint16_t id, uint16_t subtype /*= 0xFFFF*/) -{ - if(id == 0) return nullptr; +Item* Item::Create(uint16_t id, uint16_t subtype /*= 0xFFFF*/) { + if (id == 0) { + return nullptr; + } - const ItemType& type = g_items.getItemType(id); - if(type.id == 0) { + const ItemType &type = g_items.getItemType(id); + if (type.id == 0) { return newd Item(id, subtype); } - if(type.isDepot()) { + if (type.isDepot()) { return new Depot(id); - } else if(type.isContainer()) { + } else if (type.isContainer()) { return new Container(id); - } else if(type.isTeleport()) { + } else if (type.isTeleport()) { return new Teleport(id); - } else if(type.isDoor()) { + } else if (type.isDoor()) { return new Door(id); - } else if(subtype == 0xFFFF) { - if(type.isFluidContainer()) { + } else if (subtype == 0xFFFF) { + if (type.isFluidContainer()) { return new Item(id, LIQUID_NONE); - } else if(type.isSplash()) { + } else if (type.isSplash()) { return new Item(id, LIQUID_WATER); - } else if(type.charges > 0) { + } else if (type.charges > 0) { return new Item(id, type.charges); } else { return new Item(id, 1); @@ -65,48 +66,46 @@ Item::Item(unsigned short _type, unsigned short _count) : id(_type), subtype(1), selected(false), - frame(0) -{ - if(hasSubtype()) { + frame(0) { + if (hasSubtype()) { subtype = _count; } } -Item::~Item() -{ +Item::~Item() { //// } -Item* Item::deepCopy() const -{ +Item* Item::deepCopy() const { Item* copy = Create(id, subtype); - if(copy) { + if (copy) { copy->selected = selected; - if(attributes) + if (attributes) { copy->attributes = newd ItemAttributeMap(*attributes); + } } return copy; } -Item* transformItem(Item* old_item, uint16_t new_id, Tile* parent) -{ - if(old_item == nullptr) +Item* transformItem(Item* old_item, uint16_t new_id, Tile* parent) { + if (old_item == nullptr) { return nullptr; + } old_item->setID(new_id); // Through the magic of deepCopy, this will now be a pointer to an item of the correct type. Item* new_item = old_item->deepCopy(); - if(parent) { + if (parent) { // Find the old item and remove it from the tile, insert this one instead! - if(old_item == parent->ground) { + if (old_item == parent->ground) { delete old_item; parent->ground = new_item; return new_item; } std::queue containers; - for(ItemVector::iterator item_iter = parent->items.begin(); item_iter != parent->items.end(); ++item_iter) { - if(*item_iter == old_item) { + for (ItemVector::iterator item_iter = parent->items.begin(); item_iter != parent->items.end(); ++item_iter) { + if (*item_iter == old_item) { delete old_item; item_iter = parent->items.erase(item_iter); parent->items.insert(item_iter, new_item); @@ -114,20 +113,22 @@ Item* transformItem(Item* old_item, uint16_t new_id, Tile* parent) } Container* c = dynamic_cast(*item_iter); - if(c) + if (c) { containers.push(c); + } } - while(containers.size() != 0) { + while (containers.size() != 0) { Container* container = containers.front(); - ItemVector& v = container->getVector(); - for(ItemVector::iterator item_iter = v.begin(); item_iter != v.end(); ++item_iter) { + ItemVector &v = container->getVector(); + for (ItemVector::iterator item_iter = v.begin(); item_iter != v.end(); ++item_iter) { Item* i = *item_iter; Container* c = dynamic_cast(i); - if(c) + if (c) { containers.push(c); + } - if(i == old_item) { + if (i == old_item) { // Found it! item_iter = v.erase(item_iter); v.insert(item_iter, new_item); @@ -142,79 +143,76 @@ Item* transformItem(Item* old_item, uint16_t new_id, Tile* parent) return nullptr; } -uint32_t Item::memsize() const -{ +uint32_t Item::memsize() const { uint32_t mem = sizeof(*this); return mem; } -void Item::setID(uint16_t new_id) -{ +void Item::setID(uint16_t new_id) { id = new_id; } -void Item::setSubtype(uint16_t _subtype) -{ +void Item::setSubtype(uint16_t _subtype) { subtype = _subtype; } -bool Item::hasSubtype() const -{ - const ItemType& type = g_items.getItemType(id); - return (type.isFluidContainer() - || type.stackable - || type.charges != 0 - || type.isSplash() - || isCharged()); +bool Item::hasSubtype() const { + const ItemType &type = g_items.getItemType(id); + return (type.isFluidContainer() || type.stackable || type.charges != 0 || type.isSplash() || isCharged()); } -uint16_t Item::getSubtype() const -{ +uint16_t Item::getSubtype() const { return hasSubtype() ? subtype : 0; } -bool Item::hasProperty(enum ITEMPROPERTY prop) const -{ - const ItemType& type = g_items.getItemType(id); - switch(prop) { +bool Item::hasProperty(enum ITEMPROPERTY prop) const { + const ItemType &type = g_items.getItemType(id); + switch (prop) { case BLOCKSOLID: - if(type.unpassable) + if (type.unpassable) { return true; + } break; case MOVEABLE: - if(type.moveable && getUniqueID() == 0) - return true; - break; -/* - case HASHEIGHT: - if(it.height != 0 ) + if (type.moveable && getUniqueID() == 0) { return true; + } break; -*/ + /* + case HASHEIGHT: + if(it.height != 0 ) + return true; + break; + */ case BLOCKPROJECTILE: - if(type.blockMissiles) + if (type.blockMissiles) { return true; + } break; case BLOCKPATHFIND: - if(type.blockPathfinder) + if (type.blockPathfinder) { return true; + } break; case HOOK_SOUTH: - if(type.hookSouth) + if (type.hookSouth) { return true; + } break; case HOOK_EAST: - if(type.hookEast) + if (type.hookEast) { return true; + } break; case BLOCKINGANDNOTMOVEABLE: - if(type.unpassable && (!type.moveable || getUniqueID() != 0)) + if (type.unpassable && (!type.moveable || getUniqueID() != 0)) { return true; + } break; default: @@ -223,137 +221,120 @@ bool Item::hasProperty(enum ITEMPROPERTY prop) const return false; } -wxPoint Item::getDrawOffset() const -{ - const ItemType& type = g_items.getItemType(id); - if(type.sprite) { +wxPoint Item::getDrawOffset() const { + const ItemType &type = g_items.getItemType(id); + if (type.sprite) { return type.sprite->getDrawOffset(); } return wxPoint(0, 0); } -uint16_t Item::getGroundSpeed() const -{ - const auto& type = g_items.getItemType(id); - if(type.sprite) { +uint16_t Item::getGroundSpeed() const { + const auto &type = g_items.getItemType(id); + if (type.sprite) { return type.sprite->ground_speed; } return 0; } -bool Item::hasLight() const -{ - const ItemType& type = g_items.getItemType(id); - if(type.sprite) { +bool Item::hasLight() const { + const ItemType &type = g_items.getItemType(id); + if (type.sprite) { return type.sprite->hasLight(); } return false; } -SpriteLight Item::getLight() const -{ - const ItemType& type = g_items.getItemType(id); - if(type.sprite) { +SpriteLight Item::getLight() const { + const ItemType &type = g_items.getItemType(id); + if (type.sprite) { return type.sprite->getLight(); } - return SpriteLight{0, 0}; + return SpriteLight { 0, 0 }; } -double Item::getWeight() const -{ - const ItemType& type = g_items.getItemType(id); - if(type.stackable) { +double Item::getWeight() const { + const ItemType &type = g_items.getItemType(id); + if (type.stackable) { return type.weight * std::max(1, (int)subtype); } return type.weight; } -void Item::setUniqueID(unsigned short n) -{ +void Item::setUniqueID(unsigned short n) { setAttribute("uid", n); } -void Item::setActionID(unsigned short n) -{ +void Item::setActionID(unsigned short n) { setAttribute("aid", n); } -void Item::setText(const std::string& str) -{ +void Item::setText(const std::string &str) { setAttribute("text", str); } -void Item::setDescription(const std::string& str) -{ +void Item::setDescription(const std::string &str) { setAttribute("desc", str); } -double Item::getWeight() -{ - const ItemType& type = g_items.getItemType(id); - if(type.isStackable()) { +double Item::getWeight() { + const ItemType &type = g_items.getItemType(id); + if (type.isStackable()) { return type.weight * subtype; } return type.weight; } -bool Item::canHoldText() const -{ +bool Item::canHoldText() const { return isReadable() || canWriteText(); } -bool Item::canHoldDescription() const -{ +bool Item::canHoldDescription() const { return g_items.getItemType(id).allowDistRead; } -uint8_t Item::getMiniMapColor() const -{ +uint8_t Item::getMiniMapColor() const { GameSprite* sprite = g_items.getItemType(id).sprite; - if(sprite) { + if (sprite) { return sprite->getMiniMapColor(); } return 0; } -GroundBrush* Item::getGroundBrush() const -{ - const ItemType& type = g_items.getItemType(id); - if(type.isGroundTile() && type.brush && type.brush->isGround()) { +GroundBrush* Item::getGroundBrush() const { + const ItemType &type = g_items.getItemType(id); + if (type.isGroundTile() && type.brush && type.brush->isGround()) { return type.brush->asGround(); } return nullptr; } -TableBrush* Item::getTableBrush() const -{ - const ItemType& type = g_items.getItemType(id); - if(type.isTable && type.brush && type.brush->isTable()) { +TableBrush* Item::getTableBrush() const { + const ItemType &type = g_items.getItemType(id); + if (type.isTable && type.brush && type.brush->isTable()) { return type.brush->asTable(); } return nullptr; } -CarpetBrush* Item::getCarpetBrush() const -{ - const ItemType& type = g_items.getItemType(id); - if(type.isCarpet && type.brush && type.brush->isCarpet()) { +CarpetBrush* Item::getCarpetBrush() const { + const ItemType &type = g_items.getItemType(id); + if (type.isCarpet && type.brush && type.brush->isCarpet()) { return type.brush->asCarpet(); } return nullptr; } -DoorBrush* Item::getDoorBrush() const -{ - const ItemType& type = g_items.getItemType(id); - if(!type.isWall || !type.isBrushDoor || !type.brush || !type.brush->isWall()) { +DoorBrush* Item::getDoorBrush() const { + const ItemType &type = g_items.getItemType(id); + if (!type.isWall || !type.isBrushDoor || !type.brush || !type.brush->isWall()) { return nullptr; } DoorType door_type = type.brush->asWall()->getDoorTypeFromID(id); DoorBrush* door_brush = nullptr; // Quite a horrible dependency on a global here, meh. - switch(door_type) { + switch (door_type) { case WALL_DOOR_NORMAL: { door_brush = g_gui.normal_door_brush; break; @@ -385,35 +366,33 @@ DoorBrush* Item::getDoorBrush() const return door_brush; } -WallBrush* Item::getWallBrush() const -{ - const ItemType& type = g_items.getItemType(id); - if(type.isWall && type.brush && type.brush->isWall()) +WallBrush* Item::getWallBrush() const { + const ItemType &type = g_items.getItemType(id); + if (type.isWall && type.brush && type.brush->isWall()) { return type.brush->asWall(); + } return nullptr; } -BorderType Item::getWallAlignment() const -{ - const ItemType& type = g_items.getItemType(id); - if(!type.isWall) { +BorderType Item::getWallAlignment() const { + const ItemType &type = g_items.getItemType(id); + if (!type.isWall) { return BORDER_NONE; } return type.border_alignment; } -BorderType Item::getBorderAlignment() const -{ - const ItemType& type = g_items.getItemType(id); +BorderType Item::getBorderAlignment() const { + const ItemType &type = g_items.getItemType(id); return type.border_alignment; } -void Item::animate() -{ - const ItemType& type = g_items.getItemType(id); +void Item::animate() { + const ItemType &type = g_items.getItemType(id); GameSprite* sprite = type.sprite; - if(!sprite || !sprite->animator) + if (!sprite || !sprite->animator) { return; + } frame = sprite->animator->getFrame(); } @@ -421,81 +400,142 @@ void Item::animate() // ============================================================================ // Static conversions -std::string Item::LiquidID2Name(uint16_t id) -{ - switch(id) { - case LIQUID_NONE: return "None"; - case LIQUID_WATER: return "Water"; - case LIQUID_BLOOD: return "Blood"; - case LIQUID_BEER: return "Beer"; - case LIQUID_SLIME: return "Slime"; - case LIQUID_LEMONADE: return "Lemonade"; - case LIQUID_MILK: return "Milk"; - case LIQUID_MANAFLUID: return "Manafluid"; - case LIQUID_WATER2: return "Water"; - case LIQUID_LIFEFLUID: return "Lifefluid"; - case LIQUID_OIL: return "Oil"; - case LIQUID_SLIME2: return "Slime"; - case LIQUID_URINE: return "Urine"; - case LIQUID_COCONUT_MILK: return "Coconut Milk"; - case LIQUID_WINE: return "Wine"; - case LIQUID_MUD: return "Mud"; - case LIQUID_FRUIT_JUICE: return "Fruit Juice"; - case LIQUID_LAVA: return "Lava"; - case LIQUID_RUM: return "Rum"; - case LIQUID_SWAMP: return "Swamp"; - case LIQUID_INK: return "Ink"; - case LIQUID_TEA: return "Tea"; - case LIQUID_MEAD: return "Mead"; - default: return "Unknown"; - } -} - -uint16_t Item::LiquidName2ID(std::string liquid) -{ +std::string Item::LiquidID2Name(uint16_t id) { + switch (id) { + case LIQUID_NONE: + return "None"; + case LIQUID_WATER: + return "Water"; + case LIQUID_BLOOD: + return "Blood"; + case LIQUID_BEER: + return "Beer"; + case LIQUID_SLIME: + return "Slime"; + case LIQUID_LEMONADE: + return "Lemonade"; + case LIQUID_MILK: + return "Milk"; + case LIQUID_MANAFLUID: + return "Manafluid"; + case LIQUID_WATER2: + return "Water"; + case LIQUID_LIFEFLUID: + return "Lifefluid"; + case LIQUID_OIL: + return "Oil"; + case LIQUID_SLIME2: + return "Slime"; + case LIQUID_URINE: + return "Urine"; + case LIQUID_COCONUT_MILK: + return "Coconut Milk"; + case LIQUID_WINE: + return "Wine"; + case LIQUID_MUD: + return "Mud"; + case LIQUID_FRUIT_JUICE: + return "Fruit Juice"; + case LIQUID_LAVA: + return "Lava"; + case LIQUID_RUM: + return "Rum"; + case LIQUID_SWAMP: + return "Swamp"; + case LIQUID_INK: + return "Ink"; + case LIQUID_TEA: + return "Tea"; + case LIQUID_MEAD: + return "Mead"; + default: + return "Unknown"; + } +} + +uint16_t Item::LiquidName2ID(std::string liquid) { to_lower_str(liquid); - if(liquid == "none") return LIQUID_NONE; - if(liquid == "water") return LIQUID_WATER; - if(liquid == "blood") return LIQUID_BLOOD; - if(liquid == "beer") return LIQUID_BEER; - if(liquid == "slime") return LIQUID_SLIME; - if(liquid == "lemonade") return LIQUID_LEMONADE; - if(liquid == "milk") return LIQUID_MILK; - if(liquid == "manafluid") return LIQUID_MANAFLUID; - if(liquid == "lifefluid") return LIQUID_LIFEFLUID; - if(liquid == "oil") return LIQUID_OIL; - if(liquid == "urine") return LIQUID_URINE; - if(liquid == "coconut milk") return LIQUID_COCONUT_MILK; - if(liquid == "wine") return LIQUID_WINE; - if(liquid == "mud") return LIQUID_MUD; - if(liquid == "fruit juice") return LIQUID_FRUIT_JUICE; - if(liquid == "lava") return LIQUID_LAVA; - if(liquid == "rum") return LIQUID_RUM; - if(liquid == "swamp") return LIQUID_SWAMP; - if(liquid == "ink") return LIQUID_INK; - if(liquid == "tea") return LIQUID_TEA; - if(liquid == "mead") return LIQUID_MEAD; + if (liquid == "none") { + return LIQUID_NONE; + } + if (liquid == "water") { + return LIQUID_WATER; + } + if (liquid == "blood") { + return LIQUID_BLOOD; + } + if (liquid == "beer") { + return LIQUID_BEER; + } + if (liquid == "slime") { + return LIQUID_SLIME; + } + if (liquid == "lemonade") { + return LIQUID_LEMONADE; + } + if (liquid == "milk") { + return LIQUID_MILK; + } + if (liquid == "manafluid") { + return LIQUID_MANAFLUID; + } + if (liquid == "lifefluid") { + return LIQUID_LIFEFLUID; + } + if (liquid == "oil") { + return LIQUID_OIL; + } + if (liquid == "urine") { + return LIQUID_URINE; + } + if (liquid == "coconut milk") { + return LIQUID_COCONUT_MILK; + } + if (liquid == "wine") { + return LIQUID_WINE; + } + if (liquid == "mud") { + return LIQUID_MUD; + } + if (liquid == "fruit juice") { + return LIQUID_FRUIT_JUICE; + } + if (liquid == "lava") { + return LIQUID_LAVA; + } + if (liquid == "rum") { + return LIQUID_RUM; + } + if (liquid == "swamp") { + return LIQUID_SWAMP; + } + if (liquid == "ink") { + return LIQUID_INK; + } + if (liquid == "tea") { + return LIQUID_TEA; + } + if (liquid == "mead") { + return LIQUID_MEAD; + } return LIQUID_NONE; } // ============================================================================ // XML Saving & loading -Item* Item::Create(pugi::xml_node xml) -{ +Item* Item::Create(pugi::xml_node xml) { pugi::xml_attribute attribute; uint16_t id = 0; - if((attribute = xml.attribute("id"))) { + if ((attribute = xml.attribute("id"))) { id = attribute.as_uint(); } uint16_t count = 1; - if((attribute = xml.attribute("count")) || (attribute = xml.attribute("subtype"))) { + if ((attribute = xml.attribute("count")) || (attribute = xml.attribute("subtype"))) { count = attribute.as_uint(); } return Create(id, count); } - - diff --git a/source/item.h b/source/item.h index 8c7757b5..1072ab8b 100644 --- a/source/item.h +++ b/source/item.h @@ -20,7 +20,7 @@ #include "items.h" #include "iomap_otbm.h" -//#include "iomap_otmm.h" +// #include "iomap_otmm.h" #include "item_attributes.h" enum ITEMPROPERTY { @@ -35,8 +35,7 @@ enum ITEMPROPERTY { BLOCKINGANDNOTMOVEABLE }; -enum SplashType -{ +enum SplashType { LIQUID_NONE = 0, LIQUID_WATER = 1, LIQUID_BLOOD = 2, @@ -78,14 +77,13 @@ class Npc; struct SpriteLight; -class Item : public ItemAttributes -{ +class Item : public ItemAttributes { public: - //Factory member to create item of right type based on type + // Factory member to create item of right type based on type static Item* Create(uint16_t id, uint16_t subtype = 0xFFFF); static Item* Create(pugi::xml_node); - static Item* Create_OTBM(const IOMap& maphandle, BinaryNode* stream); - //static Item* Create_OTMM(const IOMap& maphandle, BinaryNode* stream); + static Item* Create_OTBM(const IOMap &maphandle, BinaryNode* stream); + // static Item* Create_OTMM(const IOMap& maphandle, BinaryNode* stream); protected: // Constructor for items @@ -94,29 +92,37 @@ class Item : public ItemAttributes public: virtual ~Item(); -// Deep copy thingy + // Deep copy thingy virtual Item* deepCopy() const; // Get memory footprint size uint32_t memsize() const; - virtual Container* getContainer() { return nullptr; } - virtual Depot* getDepot() { return nullptr; } - virtual Teleport* getTeleport() { return nullptr; } - virtual Door* getDoor() { return nullptr; } + virtual Container* getContainer() { + return nullptr; + } + virtual Depot* getDepot() { + return nullptr; + } + virtual Teleport* getTeleport() { + return nullptr; + } + virtual Door* getDoor() { + return nullptr; + } // OTBM map interface // Serialize and unserialize (for save/load) // Used internally - virtual bool readItemAttribute_OTBM(const IOMap& maphandle, OTBM_ItemAttribute attr, BinaryNode* stream); - virtual bool unserializeAttributes_OTBM(const IOMap& maphandle, BinaryNode* stream); - virtual bool unserializeItemNode_OTBM(const IOMap& maphandle, BinaryNode* node); + virtual bool readItemAttribute_OTBM(const IOMap &maphandle, OTBM_ItemAttribute attr, BinaryNode* stream); + virtual bool unserializeAttributes_OTBM(const IOMap &maphandle, BinaryNode* stream); + virtual bool unserializeItemNode_OTBM(const IOMap &maphandle, BinaryNode* node); // Will return a node containing this item - virtual bool serializeItemNode_OTBM(const IOMap& maphandle, NodeFileWriteHandle& f) const; + virtual bool serializeItemNode_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const; // Will write this item to the stream supplied in the argument - virtual void serializeItemCompact_OTBM(const IOMap& maphandle, NodeFileWriteHandle& f) const; - virtual void serializeItemAttributes_OTBM(const IOMap& maphandle, NodeFileWriteHandle& f) const; + virtual void serializeItemCompact_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const; + virtual void serializeItemAttributes_OTBM(const IOMap &maphandle, NodeFileWriteHandle &f) const; // OTMM map interface /* @@ -137,42 +143,74 @@ class Item : public ItemAttributes static std::string LiquidID2Name(uint16_t id); static uint16_t LiquidName2ID(std::string id); - const ItemType& getItemType() const noexcept { return g_items.getItemType(id); } + const ItemType &getItemType() const noexcept { + return g_items.getItemType(id); + } // IDs - uint16_t getID() const { return id; } - uint16_t getClientID() const { return g_items.getItemType(id).clientID; } + uint16_t getID() const { + return id; + } + uint16_t getClientID() const { + return g_items.getItemType(id).clientID; + } // NOTE: This is very volatile, do NOT use this unless you know exactly what you're doing // which you probably don't so avoid it like the plague! void setID(uint16_t new_id); - bool isValidID() const { return g_items.isValidID(id); } + bool isValidID() const { + return g_items.isValidID(id); + } // Usual attributes virtual double getWeight() const; - int getAttack() const { return getItemType().attack; } - int getArmor() const { return getItemType().armor; } - int getDefense() const { return getItemType().defense; } - //int getSlotPosition() const { return g_items.getItemType(id).slot_position; } + int getAttack() const { + return getItemType().attack; + } + int getArmor() const { + return getItemType().armor; + } + int getDefense() const { + return getItemType().defense; + } + // int getSlotPosition() const { return g_items.getItemType(id).slot_position; } // Item g_settings bool canHoldText() const; bool canHoldDescription() const; - bool isReadable() const { return getItemType().canReadText; } - bool canWriteText() const { return getItemType().canWriteText; } - uint32_t getMaxWriteLength() const { return getItemType().maxTextLen; } - Brush* getBrush() const { return getItemType().brush; } + bool isReadable() const { + return getItemType().canReadText; + } + bool canWriteText() const { + return getItemType().canWriteText; + } + uint32_t getMaxWriteLength() const { + return getItemType().maxTextLen; + } + Brush* getBrush() const { + return getItemType().brush; + } GroundBrush* getGroundBrush() const; WallBrush* getWallBrush() const; DoorBrush* getDoorBrush() const; TableBrush* getTableBrush() const; CarpetBrush* getCarpetBrush() const; - Brush* getDoodadBrush() const { return getItemType().doodad_brush; } // This is not necessarily a doodad brush - RAWBrush* getRAWBrush() const { return getItemType().raw_brush; } - uint16_t getGroundEquivalent() const { return getItemType().ground_equivalent; } - uint16_t hasBorderEquivalent() const { return getItemType().has_equivalent; } - uint32_t getBorderGroup() const { return getItemType().border_group; } + Brush* getDoodadBrush() const { + return getItemType().doodad_brush; + } // This is not necessarily a doodad brush + RAWBrush* getRAWBrush() const { + return getItemType().raw_brush; + } + uint16_t getGroundEquivalent() const { + return getItemType().ground_equivalent; + } + uint16_t hasBorderEquivalent() const { + return getItemType().has_equivalent; + } + uint32_t getBorderGroup() const { + return getItemType().border_group; + } // Drawing related uint8_t getMiniMapColor() const; @@ -185,34 +223,86 @@ class Item : public ItemAttributes // Item types bool hasProperty(enum ITEMPROPERTY prop) const; - bool isBlocking() const { return getItemType().unpassable; } - bool isStackable() const { return getItemType().stackable; } - bool isClientCharged() const { return getItemType().isClientCharged(); } - bool isExtraCharged() const { return getItemType().isExtraCharged(); } - bool isCharged() const { return isClientCharged() || isExtraCharged(); } - bool isFluidContainer() const { return (getItemType().isFluidContainer()); } - bool isAlwaysOnBottom() const { return getItemType().alwaysOnBottom; } - int getTopOrder() const { return getItemType().alwaysOnTopOrder; } - bool isGroundTile() const { return getItemType().isGroundTile(); } - bool isSplash() const { return getItemType().isSplash(); } - bool isMagicField() const { return getItemType().isMagicField(); } - bool isNotMoveable() const { return !getItemType().moveable; } - bool isMoveable() const { return getItemType().moveable; } - bool isPickupable() const { return getItemType().pickupable; } - //bool isWeapon() const { return (getItemType().weaponType != WEAPON_NONE && g_items[id].weaponType != WEAPON_AMMO); } - //bool isUseable() const { return getItemType().useable; } - bool isHangable() const { return getItemType().isHangable; } - bool isRoteable() const { return getItemType().rotable && getItemType().rotateTo; } - bool hasCharges() const { return getItemType().charges != 0; } - bool isBorder() const { return getItemType().isBorder; } - bool isOptionalBorder() const { return getItemType().isOptionalBorder; } - bool isWall() const { return getItemType().isWall; } - bool isDoor() const { return getItemType().isDoor(); } - bool isOpen() const { return getItemType().isOpen; } - bool isBrushDoor() const { return getItemType().isBrushDoor; } - bool isTable() const { return getItemType().isTable; } - bool isCarpet() const { return getItemType().isCarpet; } - bool isMetaItem() const { return getItemType().isMetaItem(); } + bool isBlocking() const { + return getItemType().unpassable; + } + bool isStackable() const { + return getItemType().stackable; + } + bool isClientCharged() const { + return getItemType().isClientCharged(); + } + bool isExtraCharged() const { + return getItemType().isExtraCharged(); + } + bool isCharged() const { + return isClientCharged() || isExtraCharged(); + } + bool isFluidContainer() const { + return (getItemType().isFluidContainer()); + } + bool isAlwaysOnBottom() const { + return getItemType().alwaysOnBottom; + } + int getTopOrder() const { + return getItemType().alwaysOnTopOrder; + } + bool isGroundTile() const { + return getItemType().isGroundTile(); + } + bool isSplash() const { + return getItemType().isSplash(); + } + bool isMagicField() const { + return getItemType().isMagicField(); + } + bool isNotMoveable() const { + return !getItemType().moveable; + } + bool isMoveable() const { + return getItemType().moveable; + } + bool isPickupable() const { + return getItemType().pickupable; + } + // bool isWeapon() const { return (getItemType().weaponType != WEAPON_NONE && g_items[id].weaponType != WEAPON_AMMO); } + // bool isUseable() const { return getItemType().useable; } + bool isHangable() const { + return getItemType().isHangable; + } + bool isRoteable() const { + return getItemType().rotable && getItemType().rotateTo; + } + bool hasCharges() const { + return getItemType().charges != 0; + } + bool isBorder() const { + return getItemType().isBorder; + } + bool isOptionalBorder() const { + return getItemType().isOptionalBorder; + } + bool isWall() const { + return getItemType().isWall; + } + bool isDoor() const { + return getItemType().isDoor(); + } + bool isOpen() const { + return getItemType().isOpen; + } + bool isBrushDoor() const { + return getItemType().isBrushDoor; + } + bool isTable() const { + return getItemType().isTable; + } + bool isCarpet() const { + return getItemType().isCarpet; + } + bool isMetaItem() const { + return getItemType().isMetaItem(); + } // Wall alignment (vertical, horizontal, pole, corner) BorderType getWallAlignment() const; @@ -220,20 +310,36 @@ class Item : public ItemAttributes BorderType getBorderAlignment() const; // Get the name! - const std::string getName() const { return getItemType().name; } - const std::string getFullName() const { return getItemType().name + getItemType().editorsuffix; } + const std::string getName() const { + return getItemType().name; + } + const std::string getFullName() const { + return getItemType().name + getItemType().editorsuffix; + } // Selection - bool isSelected() const {return selected;} - void select() {selected = true;} - void deselect() {selected = false;} - void toggleSelection() {selected =! selected;} + bool isSelected() const { + return selected; + } + void select() { + selected = true; + } + void deselect() { + selected = false; + } + void toggleSelection() { + selected = !selected; + } // Item properties! - virtual bool isComplex() const {return attributes && attributes->size();} // If this item requires full save (not compact) + virtual bool isComplex() const { + return attributes && attributes->size(); + } // If this item requires full save (not compact) // Weight - bool hasWeight() {return isPickupable();} + bool hasWeight() { + return isPickupable(); + } virtual double getWeight(); // Subtype (count, fluid, charges) @@ -248,32 +354,34 @@ class Item : public ItemAttributes void setActionID(uint16_t n); uint16_t getActionID() const; - void setText(const std::string& str); + void setText(const std::string &str); std::string getText() const; - void setDescription(const std::string& str); + void setDescription(const std::string &str); std::string getDescription() const; void animate(); - int getFrame() const {return frame;} + int getFrame() const { + return frame; + } void doRotate() { - if(isRoteable()) { + if (isRoteable()) { setID(getItemType().rotateTo); } } protected: - uint16_t id; // the same id as in ItemType + uint16_t id; // the same id as in ItemType // Subtype is either fluid type, count, subtype or charges uint16_t subtype; bool selected; int frame; private: - Item& operator=(const Item& i);// Can't copy + Item &operator=(const Item &i); // Can't copy Item(const Item &i); // Can't copy-construct - Item& operator==(const Item& i);// Can't compare + Item &operator==(const Item &i); // Can't compare }; typedef std::vector ItemVector; @@ -282,7 +390,7 @@ typedef std::list ItemList; Item* transformItem(Item* old_item, uint16_t new_id, Tile* parent = nullptr); inline int Item::getCount() const { - if(isStackable() || isExtraCharged() || isClientCharged()) { + if (isStackable() || isExtraCharged() || isClientCharged()) { return subtype; } return 1; @@ -290,31 +398,34 @@ inline int Item::getCount() const { inline uint16_t Item::getUniqueID() const { const int32_t* a = getIntegerAttribute("uid"); - if(a) + if (a) { return *a; + } return 0; } inline uint16_t Item::getActionID() const { const int32_t* a = getIntegerAttribute("aid"); - if(a) + if (a) { return *a; + } return 0; } inline std::string Item::getText() const { const std::string* a = getStringAttribute("text"); - if(a) + if (a) { return *a; + } return ""; } inline std::string Item::getDescription() const { const std::string* a = getStringAttribute("desc"); - if(a) + if (a) { return *a; + } return ""; } - #endif diff --git a/source/item_attributes.cpp b/source/item_attributes.cpp index b5a66c34..8a3ddb09 100644 --- a/source/item_attributes.cpp +++ b/source/item_attributes.cpp @@ -21,355 +21,345 @@ #include "filehandle.h" ItemAttributes::ItemAttributes() : - attributes(nullptr) -{ + attributes(nullptr) { //// } -ItemAttributes::ItemAttributes(const ItemAttributes& o) -{ - if(o.attributes) +ItemAttributes::ItemAttributes(const ItemAttributes &o) { + if (o.attributes) { attributes = newd ItemAttributeMap(*o.attributes); + } } -ItemAttributes::~ItemAttributes() -{ +ItemAttributes::~ItemAttributes() { clearAllAttributes(); } -void ItemAttributes::createAttributes() -{ - if(!attributes) +void ItemAttributes::createAttributes() { + if (!attributes) { attributes = newd ItemAttributeMap; + } } -void ItemAttributes::clearAllAttributes() -{ - if(attributes) +void ItemAttributes::clearAllAttributes() { + if (attributes) { delete attributes; + } attributes = nullptr; } -ItemAttributeMap ItemAttributes::getAttributes() const -{ - if(attributes) +ItemAttributeMap ItemAttributes::getAttributes() const { + if (attributes) { return *attributes; + } return ItemAttributeMap(); } -void ItemAttributes::setAttribute(const std::string& key, const ItemAttribute& value) -{ +void ItemAttributes::setAttribute(const std::string &key, const ItemAttribute &value) { createAttributes(); (*attributes)[key] = value; } -void ItemAttributes::setAttribute(const std::string& key, const std::string& value) -{ +void ItemAttributes::setAttribute(const std::string &key, const std::string &value) { createAttributes(); (*attributes)[key].set(value); } -void ItemAttributes::setAttribute(const std::string& key, int32_t value) -{ +void ItemAttributes::setAttribute(const std::string &key, int32_t value) { createAttributes(); (*attributes)[key].set(value); } -void ItemAttributes::setAttribute(const std::string& key, double value) -{ +void ItemAttributes::setAttribute(const std::string &key, double value) { createAttributes(); (*attributes)[key].set(value); } -void ItemAttributes::setAttribute(const std::string& key, bool value) -{ +void ItemAttributes::setAttribute(const std::string &key, bool value) { createAttributes(); (*attributes)[key].set(value); } -void ItemAttributes::eraseAttribute(const std::string& key) -{ - if(!attributes) +void ItemAttributes::eraseAttribute(const std::string &key) { + if (!attributes) { return; + } ItemAttributeMap::iterator iter = attributes->find(key); - if(iter != attributes->end()) + if (iter != attributes->end()) { attributes->erase(iter); + } } -const std::string* ItemAttributes::getStringAttribute(const std::string& key) const -{ - if(!attributes) +const std::string* ItemAttributes::getStringAttribute(const std::string &key) const { + if (!attributes) { return nullptr; + } ItemAttributeMap::iterator iter = attributes->find(key); - if(iter != attributes->end()) + if (iter != attributes->end()) { return iter->second.getString(); + } return nullptr; } -const int32_t* ItemAttributes::getIntegerAttribute(const std::string& key) const -{ - if(!attributes) +const int32_t* ItemAttributes::getIntegerAttribute(const std::string &key) const { + if (!attributes) { return nullptr; + } ItemAttributeMap::iterator iter = attributes->find(key); - if(iter != attributes->end()) + if (iter != attributes->end()) { return iter->second.getInteger(); + } return nullptr; } -const double* ItemAttributes::getFloatAttribute(const std::string& key) const -{ - if(!attributes) +const double* ItemAttributes::getFloatAttribute(const std::string &key) const { + if (!attributes) { return nullptr; + } ItemAttributeMap::iterator iter = attributes->find(key); - if(iter != attributes->end()) + if (iter != attributes->end()) { return iter->second.getFloat(); + } return nullptr; } -const bool* ItemAttributes::getBooleanAttribute(const std::string& key) const -{ - if(!attributes) +const bool* ItemAttributes::getBooleanAttribute(const std::string &key) const { + if (!attributes) { return nullptr; + } ItemAttributeMap::iterator iter = attributes->find(key); - if(iter != attributes->end()) + if (iter != attributes->end()) { return iter->second.getBoolean(); + } return nullptr; } -bool ItemAttributes::hasStringAttribute(const std::string& key) const -{ +bool ItemAttributes::hasStringAttribute(const std::string &key) const { return getStringAttribute(key) != nullptr; } -bool ItemAttributes::hasIntegerAttribute(const std::string& key) const -{ +bool ItemAttributes::hasIntegerAttribute(const std::string &key) const { return getIntegerAttribute(key) != nullptr; } -bool ItemAttributes::hasFloatAttribute(const std::string& key) const -{ +bool ItemAttributes::hasFloatAttribute(const std::string &key) const { return getFloatAttribute(key) != nullptr; } -bool ItemAttributes::hasBooleanAttribute(const std::string& key) const -{ +bool ItemAttributes::hasBooleanAttribute(const std::string &key) const { return getBooleanAttribute(key) != nullptr; } - // Attribute type // Can hold either int, bool or std::string // Without using newd to allocate them -ItemAttribute::ItemAttribute() : type(ItemAttribute::NONE) -{ +ItemAttribute::ItemAttribute() : + type(ItemAttribute::NONE) { //// } - -ItemAttribute::ItemAttribute(const std::string& str) : type(ItemAttribute::STRING) -{ - new(data) std::string(str); +ItemAttribute::ItemAttribute(const std::string &str) : + type(ItemAttribute::STRING) { + new (data) std::string(str); } -ItemAttribute::ItemAttribute(int32_t i) : type(ItemAttribute::INTEGER) -{ +ItemAttribute::ItemAttribute(int32_t i) : + type(ItemAttribute::INTEGER) { *reinterpret_cast(data) = i; } -ItemAttribute::ItemAttribute(double f) : type(ItemAttribute::DOUBLE) -{ +ItemAttribute::ItemAttribute(double f) : + type(ItemAttribute::DOUBLE) { *reinterpret_cast(data) = f; } -ItemAttribute::ItemAttribute(bool b) -{ +ItemAttribute::ItemAttribute(bool b) { *reinterpret_cast(data) = b; } -ItemAttribute::ItemAttribute(const ItemAttribute& o) : type(ItemAttribute::NONE) -{ +ItemAttribute::ItemAttribute(const ItemAttribute &o) : + type(ItemAttribute::NONE) { *this = o; } -ItemAttribute& ItemAttribute::operator=(const ItemAttribute& o) -{ - if(&o == this) +ItemAttribute &ItemAttribute::operator=(const ItemAttribute &o) { + if (&o == this) { return *this; + } clear(); type = o.type; - if(type == STRING) - new(data) std::string(*reinterpret_cast(&o.data)); - else if(type == INTEGER) + if (type == STRING) { + new (data) std::string(*reinterpret_cast(&o.data)); + } else if (type == INTEGER) { *reinterpret_cast(data) = *reinterpret_cast(&o.data); - else if(type == FLOAT) + } else if (type == FLOAT) { *reinterpret_cast(data) = *reinterpret_cast(&o.data); - else if(type == DOUBLE) + } else if (type == DOUBLE) { *reinterpret_cast(data) = *reinterpret_cast(&o.data); - else if(type == BOOLEAN) + } else if (type == BOOLEAN) { *reinterpret_cast(data) = *reinterpret_cast(&o.data); - else + } else { type = NONE; + } return *this; - } -ItemAttribute::~ItemAttribute() -{ +ItemAttribute::~ItemAttribute() { clear(); } -void ItemAttribute::clear() -{ - if(type == STRING) { +void ItemAttribute::clear() { + if (type == STRING) { (reinterpret_cast(&data))->~basic_string(); type = NONE; } } -void ItemAttribute::set(const std::string& str) -{ +void ItemAttribute::set(const std::string &str) { clear(); type = STRING; - new(data) std::string(str); + new (data) std::string(str); } -void ItemAttribute::set(int32_t i) -{ +void ItemAttribute::set(int32_t i) { clear(); type = INTEGER; *reinterpret_cast(&data) = i; } -void ItemAttribute::set(double y) -{ +void ItemAttribute::set(double y) { clear(); type = DOUBLE; *reinterpret_cast(&data) = y; } -void ItemAttribute::set(bool b) -{ +void ItemAttribute::set(bool b) { clear(); type = BOOLEAN; *reinterpret_cast(&data) = b; } -const std::string* ItemAttribute::getString() const -{ - if(type == STRING) +const std::string* ItemAttribute::getString() const { + if (type == STRING) { return reinterpret_cast(&data); + } return nullptr; } -const int32_t* ItemAttribute::getInteger() const -{ - if(type == INTEGER) +const int32_t* ItemAttribute::getInteger() const { + if (type == INTEGER) { return reinterpret_cast(&data); + } return nullptr; } -const double* ItemAttribute::getFloat() const -{ - if(type == DOUBLE) +const double* ItemAttribute::getFloat() const { + if (type == DOUBLE) { return reinterpret_cast(&data); + } return nullptr; } -const bool* ItemAttribute::getBoolean() const -{ - if(type == BOOLEAN) +const bool* ItemAttribute::getBoolean() const { + if (type == BOOLEAN) { return reinterpret_cast(&data); + } return nullptr; } -bool ItemAttributes::unserializeAttributeMap(const IOMap& maphandle, BinaryNode* stream) -{ +bool ItemAttributes::unserializeAttributeMap(const IOMap &maphandle, BinaryNode* stream) { uint16_t n; - if(stream->getU16(n)) { + if (stream->getU16(n)) { createAttributes(); std::string key; ItemAttribute attrib; - while(n--) { - if(!stream->getString(key)) + while (n--) { + if (!stream->getString(key)) { return false; - if(!attrib.unserialize(maphandle, stream)) + } + if (!attrib.unserialize(maphandle, stream)) { return false; + } (*attributes)[key] = attrib; } } return true; } -void ItemAttributes::serializeAttributeMap(const IOMap& maphandle, NodeFileWriteHandle& f) const -{ +void ItemAttributes::serializeAttributeMap(const IOMap &maphandle, NodeFileWriteHandle &f) const { // Maximum of 65535 attributes per item f.addU16(std::min((size_t)0xFFFF, attributes->size())); ItemAttributeMap::const_iterator attribute = attributes->begin(); int i = 0; - while(attribute != attributes->end() && i <= 0xFFFF) { - const std::string& key = attribute->first; - if(key.size() > 0xFFFF) + while (attribute != attributes->end() && i <= 0xFFFF) { + const std::string &key = attribute->first; + if (key.size() > 0xFFFF) { f.addString(key.substr(0, 65535)); - else + } else { f.addString(key); + } attribute->second.serialize(maphandle, f); ++attribute, ++i; } } -bool ItemAttribute::unserialize(const IOMap& maphandle, BinaryNode* stream) -{ +bool ItemAttribute::unserialize(const IOMap &maphandle, BinaryNode* stream) { // Read type uint8_t rtype; stream->getU8(rtype); // Read contents - switch(rtype) { + switch (rtype) { case STRING: { std::string str; - if(!stream->getLongString(str)) + if (!stream->getLongString(str)) { return false; + } set(str); break; } case INTEGER: { uint32_t u32; - if(!stream->getU32(u32)) + if (!stream->getU32(u32)) { return false; + } set(*reinterpret_cast(&u32)); break; } case FLOAT: { uint32_t u32; - if(!stream->getU32(u32)) + if (!stream->getU32(u32)) { return false; + } set((double)*reinterpret_cast(&u32)); break; } case DOUBLE: { uint64_t u64; - if(!stream->getU64(u64)) + if (!stream->getU64(u64)) { return false; + } set(*reinterpret_cast(&u64)); break; } case BOOLEAN: { uint8_t b; - if(!stream->getU8(b)) + if (!stream->getU8(b)) { return false; + } set(b != 0); } default: @@ -378,13 +368,12 @@ bool ItemAttribute::unserialize(const IOMap& maphandle, BinaryNode* stream) return true; } -void ItemAttribute::serialize(const IOMap& maphandle, NodeFileWriteHandle& f) const -{ +void ItemAttribute::serialize(const IOMap &maphandle, NodeFileWriteHandle &f) const { // Write type f.addU8((uint8_t)(type)); // Write contents - switch(type) { + switch (type) { case STRING: f.addLongString(*getString()); break; diff --git a/source/item_attributes.h b/source/item_attributes.h index 5cc4b79d..75cad4a5 100644 --- a/source/item_attributes.h +++ b/source/item_attributes.h @@ -29,16 +29,15 @@ class ItemAttribute; class PropWriteStream; class PropStream; -class ItemAttribute -{ +class ItemAttribute { public: ItemAttribute(); - ItemAttribute(const std::string& str); + ItemAttribute(const std::string &str); ItemAttribute(int32_t i); ItemAttribute(double f); ItemAttribute(bool b); - ItemAttribute(const ItemAttribute& o); - ItemAttribute& operator=(const ItemAttribute& o); + ItemAttribute(const ItemAttribute &o); + ItemAttribute &operator=(const ItemAttribute &o); ~ItemAttribute(); enum Type { @@ -50,12 +49,12 @@ class ItemAttribute NONE = 0 } type; - void serialize(const IOMap& maphandle, NodeFileWriteHandle& f) const; - bool unserialize(const IOMap& maphandle, BinaryNode* f); + void serialize(const IOMap &maphandle, NodeFileWriteHandle &f) const; + bool unserialize(const IOMap &maphandle, BinaryNode* f); void clear(); - void set(const std::string& str); + void set(const std::string &str); void set(int32_t i); void set(double f); void set(bool b); @@ -71,37 +70,36 @@ class ItemAttribute typedef std::map ItemAttributeMap; -class ItemAttributes -{ +class ItemAttributes { public: ItemAttributes(); ItemAttributes(const ItemAttributes &i); virtual ~ItemAttributes(); // Save / load - void serializeAttributeMap(const IOMap& maphandle, NodeFileWriteHandle& f) const; - bool unserializeAttributeMap(const IOMap& maphandle, BinaryNode* node); + void serializeAttributeMap(const IOMap &maphandle, NodeFileWriteHandle &f) const; + bool unserializeAttributeMap(const IOMap &maphandle, BinaryNode* node); public: - void setAttribute(const std::string& key, const ItemAttribute& attr); - void setAttribute(const std::string& key, const std::string& value); - void setAttribute(const std::string& key, int32_t value); - void setAttribute(const std::string& key, double value); - void setAttribute(const std::string& key, bool set); + void setAttribute(const std::string &key, const ItemAttribute &attr); + void setAttribute(const std::string &key, const std::string &value); + void setAttribute(const std::string &key, int32_t value); + void setAttribute(const std::string &key, double value); + void setAttribute(const std::string &key, bool set); // returns nullptr if the attribute is not set - const std::string* getStringAttribute(const std::string& key) const; - const int32_t* getIntegerAttribute(const std::string& key) const; - const double* getFloatAttribute(const std::string& key) const; - const bool* getBooleanAttribute(const std::string& key) const; + const std::string* getStringAttribute(const std::string &key) const; + const int32_t* getIntegerAttribute(const std::string &key) const; + const double* getFloatAttribute(const std::string &key) const; + const bool* getBooleanAttribute(const std::string &key) const; // Returns true if the attribute (of that type) exists - bool hasStringAttribute(const std::string& key) const; - bool hasIntegerAttribute(const std::string& key) const; - bool hasFloatAttribute(const std::string& key) const; - bool hasBooleanAttribute(const std::string& key) const; + bool hasStringAttribute(const std::string &key) const; + bool hasIntegerAttribute(const std::string &key) const; + bool hasFloatAttribute(const std::string &key) const; + bool hasBooleanAttribute(const std::string &key) const; - void eraseAttribute(const std::string& key); + void eraseAttribute(const std::string &key); void clearAllAttributes(); ItemAttributeMap getAttributes() const; diff --git a/source/items.cpp b/source/items.cpp index e8cfbc7a..9e9049f6 100644 --- a/source/items.cpp +++ b/source/items.cpp @@ -39,7 +39,7 @@ ItemType::ItemType() : type(ITEM_TYPE_NONE), volume(0), maxTextLen(0), - //writeOnceItemID(0), + // writeOnceItemID(0), ground_equivalent(0), border_group(0), has_equivalent(false), @@ -90,13 +90,11 @@ ItemType::ItemType() : alwaysOnTopOrder(0), rotateTo(0), - border_alignment(BORDER_NONE) -{ + border_alignment(BORDER_NONE) { //// } -bool ItemType::isFloorChange() const noexcept -{ +bool ItemType::isFloorChange() const noexcept { return floorChange || floorChangeDown || floorChangeNorth @@ -120,41 +118,38 @@ ItemDatabase::ItemDatabase() : minClientID(0), maxClientID(0), - maxItemId(0) -{ + maxItemId(0) { //// } -ItemDatabase::~ItemDatabase() -{ +ItemDatabase::~ItemDatabase() { clear(); } -void ItemDatabase::clear() -{ - for(size_t i = 0; i < items.size(); i++) { +void ItemDatabase::clear() { + for (size_t i = 0; i < items.size(); i++) { delete items[i]; items.set(i, nullptr); } } -bool ItemDatabase::loadFromOtbVer1(BinaryNode* itemNode, wxString& error, wxArrayString& warnings) -{ - for(; itemNode != nullptr; itemNode = itemNode->advance()) { +bool ItemDatabase::loadFromOtbVer1(BinaryNode* itemNode, wxString &error, wxArrayString &warnings) { + for (; itemNode != nullptr; itemNode = itemNode->advance()) { uint8_t group; - if(!itemNode->getU8(group)) { + if (!itemNode->getU8(group)) { // Invalid! warnings.push_back("Invalid item type encountered..."); continue; } - if(group == ITEM_GROUP_DEPRECATED) + if (group == ITEM_GROUP_DEPRECATED) { continue; + } ItemType* item = new ItemType(); item->group = static_cast(group); - switch(item->group) { + switch (item->group) { case ITEM_GROUP_NONE: case ITEM_GROUP_GROUND: case ITEM_GROUP_SPLASH: @@ -186,12 +181,12 @@ bool ItemDatabase::loadFromOtbVer1(BinaryNode* itemNode, wxString& error, wxArra } uint32_t flags; - if(itemNode->getU32(flags)) { + if (itemNode->getU32(flags)) { item->unpassable = ((flags & FLAG_UNPASSABLE) == FLAG_UNPASSABLE); item->blockMissiles = ((flags & FLAG_BLOCK_MISSILES) == FLAG_BLOCK_MISSILES); item->blockPathfinder = ((flags & FLAG_BLOCK_PATHFINDER) == FLAG_BLOCK_PATHFINDER); item->hasElevation = ((flags & FLAG_HAS_ELEVATION) == FLAG_HAS_ELEVATION); - //t->useable = ((flags & FLAG_USEABLE) == FLAG_USEABLE); + // t->useable = ((flags & FLAG_USEABLE) == FLAG_USEABLE); item->pickupable = ((flags & FLAG_PICKUPABLE) == FLAG_PICKUPABLE); item->moveable = ((flags & FLAG_MOVEABLE) == FLAG_MOVEABLE); item->stackable = ((flags & FLAG_STACKABLE) == FLAG_STACKABLE); @@ -212,82 +207,88 @@ bool ItemDatabase::loadFromOtbVer1(BinaryNode* itemNode, wxString& error, wxArra } uint8_t attribute; - while(itemNode->getU8(attribute)) { + while (itemNode->getU8(attribute)) { uint16_t datalen; - if(!itemNode->getU16(datalen)) { + if (!itemNode->getU16(datalen)) { warnings.push_back("Invalid item type property"); break; } - switch(attribute) { + switch (attribute) { case ITEM_ATTR_SERVERID: { - if(datalen != sizeof(uint16_t)) { + if (datalen != sizeof(uint16_t)) { error = "items.otb: Unexpected data length of server id block (Should be 2 bytes)"; return false; } - if(!itemNode->getU16(item->id)) + if (!itemNode->getU16(item->id)) { warnings.push_back("Invalid item type property (2)"); + } - if(maxItemId < item->id) + if (maxItemId < item->id) { maxItemId = item->id; + } break; } case ITEM_ATTR_CLIENTID: { - if(datalen != sizeof(uint16_t)) { + if (datalen != sizeof(uint16_t)) { error = "items.otb: Unexpected data length of client id block (Should be 2 bytes)"; return false; } - if(!itemNode->getU16(item->clientID)) + if (!itemNode->getU16(item->clientID)) { warnings.push_back("Invalid item type property (2)"); + } item->sprite = static_cast(g_gui.gfx.getSprite(item->clientID)); break; } case ITEM_ATTR_SPEED: { - if(datalen != sizeof(uint16_t)) { + if (datalen != sizeof(uint16_t)) { error = "items.otb: Unexpected data length of speed block (Should be 2 bytes)"; return false; } - //t->speed = itemNode->getU16(); - if(!itemNode->skip(2)) // Just skip two bytes, we don't need speed + // t->speed = itemNode->getU16(); + if (!itemNode->skip(2)) { // Just skip two bytes, we don't need speed warnings.push_back("Invalid item type property (3)"); + } break; } case ITEM_ATTR_LIGHT2: { - if(datalen != sizeof(lightBlock2)) { + if (datalen != sizeof(lightBlock2)) { warnings.push_back("items.otb: Unexpected data length of item light (2) block (Should be " + i2ws(sizeof(lightBlock2)) + " bytes)"); break; } - if(!itemNode->skip(4)) // Just skip two bytes, we don't need light + if (!itemNode->skip(4)) { // Just skip two bytes, we don't need light warnings.push_back("Invalid item type property (4)"); + } - //t->lightLevel = itemNode->getU16(); - //t->lightColor = itemNode->getU16(); + // t->lightLevel = itemNode->getU16(); + // t->lightColor = itemNode->getU16(); break; } case ITEM_ATTR_TOPORDER: { - if(datalen != sizeof(uint8_t)) { + if (datalen != sizeof(uint8_t)) { warnings.push_back("items.otb: Unexpected data length of item toporder block (Should be 1 byte)"); break; } uint8_t value = 0; - if(!itemNode->getU8(value)) + if (!itemNode->getU8(value)) { warnings.push_back("Invalid item type property (5)"); + } item->alwaysOnTopOrder = value; break; } case ITEM_ATTR_NAME: { - if(datalen >= 128) { + if (datalen >= 128) { warnings.push_back("items.otb: Unexpected data length of item name block (Should be 128 bytes)"); break; } @@ -295,7 +296,7 @@ bool ItemDatabase::loadFromOtbVer1(BinaryNode* itemNode, wxString& error, wxArra uint8_t name[128]; memset(&name, 0, 128); - if(!itemNode->getRAW(name, datalen)) { + if (!itemNode->getRAW(name, datalen)) { warnings.push_back("Invalid item type property (6)"); break; } @@ -304,7 +305,7 @@ bool ItemDatabase::loadFromOtbVer1(BinaryNode* itemNode, wxString& error, wxArra } case ITEM_ATTR_DESCR: { - if(datalen >= 128) { + if (datalen >= 128) { warnings.push_back("items.otb: Unexpected data length of item descr block (Should be 128 bytes)"); break; } @@ -312,7 +313,7 @@ bool ItemDatabase::loadFromOtbVer1(BinaryNode* itemNode, wxString& error, wxArra uint8_t description[128]; memset(&description, 0, 128); - if(!itemNode->getRAW(description, datalen)) { + if (!itemNode->getRAW(description, datalen)) { warnings.push_back("Invalid item type property (7)"); break; } @@ -322,24 +323,25 @@ bool ItemDatabase::loadFromOtbVer1(BinaryNode* itemNode, wxString& error, wxArra } case ITEM_ATTR_MAXITEMS: { - if(datalen != sizeof(unsigned short)) { + if (datalen != sizeof(unsigned short)) { warnings.push_back("items.otb: Unexpected data length of item volume block (Should be 2 bytes)"); break; } - if(!itemNode->getU16(item->volume)) + if (!itemNode->getU16(item->volume)) { warnings.push_back("Invalid item type property (8)"); + } break; } case ITEM_ATTR_WEIGHT: { - if(datalen != sizeof(double)) { + if (datalen != sizeof(double)) { warnings.push_back("items.otb: Unexpected data length of item weight block (Should be 8 bytes)"); break; } uint8_t weight[sizeof(double)]; - if(!itemNode->getRAW(weight, sizeof(double))) { + if (!itemNode->getRAW(weight, sizeof(double))) { warnings.push_back("Invalid item type property (7)"); break; } @@ -352,13 +354,13 @@ bool ItemDatabase::loadFromOtbVer1(BinaryNode* itemNode, wxString& error, wxArra } case ITEM_ATTR_ROTATETO: { - if(datalen != sizeof(unsigned short)) { + if (datalen != sizeof(unsigned short)) { warnings.push_back("items.otb: Unexpected data length of item rotateTo block (Should be 2 bytes)"); break; } uint16_t rotate; - if(!itemNode->getU16(rotate)) { + if (!itemNode->getU16(rotate)) { warnings.push_back("Invalid item type property (8)"); break; } @@ -368,7 +370,7 @@ bool ItemDatabase::loadFromOtbVer1(BinaryNode* itemNode, wxString& error, wxArra } case ITEM_ATTR_WRITEABLE3: { - if(datalen != sizeof(writeableBlock3)) { + if (datalen != sizeof(writeableBlock3)) { warnings.push_back("items.otb: Unexpected data length of item toporder block (Should be 1 byte)"); break; } @@ -376,31 +378,31 @@ bool ItemDatabase::loadFromOtbVer1(BinaryNode* itemNode, wxString& error, wxArra uint16_t readOnlyID; uint16_t maxTextLen; - if(!itemNode->getU16(readOnlyID)) { + if (!itemNode->getU16(readOnlyID)) { warnings.push_back("Invalid item type property (9)"); break; } - if(!itemNode->getU16(maxTextLen)) { + if (!itemNode->getU16(maxTextLen)) { warnings.push_back("Invalid item type property (10)"); break; } - //t->readOnlyId = wb3->readOnlyId; + // t->readOnlyId = wb3->readOnlyId; item->maxTextLen = maxTextLen; break; } default: { - //skip unknown attributes + // skip unknown attributes itemNode->skip(datalen); - //warnings.push_back("items.otb: Skipped unknown attribute"); + // warnings.push_back("items.otb: Skipped unknown attribute"); break; } } } - if(items[item->id]) { + if (items[item->id]) { warnings.push_back("items.otb: Duplicate items"); delete items[item->id]; } @@ -409,23 +411,23 @@ bool ItemDatabase::loadFromOtbVer1(BinaryNode* itemNode, wxString& error, wxArra return true; } -bool ItemDatabase::loadFromOtbVer2(BinaryNode* itemNode, wxString& error, wxArrayString& warnings) -{ +bool ItemDatabase::loadFromOtbVer2(BinaryNode* itemNode, wxString &error, wxArrayString &warnings) { uint8_t group; - for(; itemNode != nullptr; itemNode = itemNode->advance()) { - if(!itemNode->getU8(group)) { + for (; itemNode != nullptr; itemNode = itemNode->advance()) { + if (!itemNode->getU8(group)) { // Invalid! warnings.push_back("Invalid item type encountered..."); continue; } - if(group == ITEM_GROUP_DEPRECATED) + if (group == ITEM_GROUP_DEPRECATED) { continue; + } ItemType* item = newd ItemType(); item->group = static_cast(group); - switch(item->group) { + switch (item->group) { case ITEM_GROUP_NONE: case ITEM_GROUP_GROUND: case ITEM_GROUP_SPLASH: @@ -452,7 +454,7 @@ bool ItemDatabase::loadFromOtbVer2(BinaryNode* itemNode, wxString& error, wxArra } uint32_t flags; - if(itemNode->getU32(flags)) { + if (itemNode->getU32(flags)) { item->unpassable = ((flags & FLAG_UNPASSABLE) == FLAG_UNPASSABLE); item->blockMissiles = ((flags & FLAG_BLOCK_MISSILES) == FLAG_BLOCK_MISSILES); item->blockPathfinder = ((flags & FLAG_BLOCK_PATHFINDER) == FLAG_BLOCK_PATHFINDER); @@ -477,75 +479,80 @@ bool ItemDatabase::loadFromOtbVer2(BinaryNode* itemNode, wxString& error, wxArra } uint8_t attribute; - while(itemNode->getU8(attribute)) { + while (itemNode->getU8(attribute)) { uint16_t datalen; - if(!itemNode->getU16(datalen)) { + if (!itemNode->getU16(datalen)) { warnings.push_back("Invalid item type property"); break; } - switch(attribute) { + switch (attribute) { case ITEM_ATTR_SERVERID: { - if(datalen != sizeof(uint16_t)) { + if (datalen != sizeof(uint16_t)) { error = "items.otb: Unexpected data length of server id block (Should be 2 bytes)"; return false; } - if(!itemNode->getU16(item->id)) + if (!itemNode->getU16(item->id)) { warnings.push_back("Invalid item type property (2)"); + } - if(maxItemId < item->id) + if (maxItemId < item->id) { maxItemId = item->id; + } break; } case ITEM_ATTR_CLIENTID: { - if(datalen != sizeof(uint16_t)) { + if (datalen != sizeof(uint16_t)) { error = "items.otb: Unexpected data length of client id block (Should be 2 bytes)"; return false; } - if(!itemNode->getU16(item->clientID)) + if (!itemNode->getU16(item->clientID)) { warnings.push_back("Invalid item type property (2)"); + } item->sprite = static_cast(g_gui.gfx.getSprite(item->clientID)); break; } case ITEM_ATTR_SPEED: { - if(datalen != sizeof(uint16_t)) { + if (datalen != sizeof(uint16_t)) { error = "items.otb: Unexpected data length of speed block (Should be 2 bytes)"; return false; } - //t->speed = itemNode->getU16(); - if(!itemNode->skip(2)) // Just skip two bytes, we don't need speed + // t->speed = itemNode->getU16(); + if (!itemNode->skip(2)) { // Just skip two bytes, we don't need speed warnings.push_back("Invalid item type property (3)"); + } break; } case ITEM_ATTR_LIGHT2: { - if(datalen != sizeof(lightBlock2)) { + if (datalen != sizeof(lightBlock2)) { warnings.push_back("items.otb: Unexpected data length of item light (2) block (Should be " + i2ws(sizeof(lightBlock2)) + " bytes)"); break; } - if(!itemNode->skip(4)) // Just skip two bytes, we don't need light + if (!itemNode->skip(4)) { // Just skip two bytes, we don't need light warnings.push_back("Invalid item type property (4)"); + } - //t->lightLevel = itemNode->getU16(); - //t->lightColor = itemNode->getU16(); + // t->lightLevel = itemNode->getU16(); + // t->lightColor = itemNode->getU16(); break; } case ITEM_ATTR_TOPORDER: { - if(datalen != sizeof(uint8_t)) { + if (datalen != sizeof(uint8_t)) { warnings.push_back("items.otb: Unexpected data length of item toporder block (Should be 1 byte)"); break; } uint8_t value = 0; - if(!itemNode->getU8(value)) { + if (!itemNode->getU8(value)) { warnings.push_back("Invalid item type property (5)"); break; } @@ -554,15 +561,15 @@ bool ItemDatabase::loadFromOtbVer2(BinaryNode* itemNode, wxString& error, wxArra } default: { - //skip unknown attributes + // skip unknown attributes itemNode->skip(datalen); - //warnings.push_back("items.otb: Skipped unknown attribute"); + // warnings.push_back("items.otb: Skipped unknown attribute"); break; } } } - if(items[item->id]) { + if (items[item->id]) { warnings.push_back("items.otb: Duplicate items"); delete items[item->id]; } @@ -571,23 +578,23 @@ bool ItemDatabase::loadFromOtbVer2(BinaryNode* itemNode, wxString& error, wxArra return true; } -bool ItemDatabase::loadFromOtbVer3(BinaryNode* itemNode, wxString& error, wxArrayString& warnings) -{ +bool ItemDatabase::loadFromOtbVer3(BinaryNode* itemNode, wxString &error, wxArrayString &warnings) { uint8_t group; - for(; itemNode != nullptr; itemNode = itemNode->advance()) { - if(!itemNode->getU8(group)) { + for (; itemNode != nullptr; itemNode = itemNode->advance()) { + if (!itemNode->getU8(group)) { // Invalid! warnings.push_back("Invalid item type encountered..."); continue; } - if(group == ITEM_GROUP_DEPRECATED) + if (group == ITEM_GROUP_DEPRECATED) { continue; + } ItemType* item = newd ItemType(); item->group = static_cast(group); - switch(item->group) { + switch (item->group) { case ITEM_GROUP_NONE: case ITEM_GROUP_GROUND: case ITEM_GROUP_SPLASH: @@ -602,7 +609,7 @@ bool ItemDatabase::loadFromOtbVer3(BinaryNode* itemNode, wxString& error, wxArra } uint32_t flags; - if(itemNode->getU32(flags)) { + if (itemNode->getU32(flags)) { item->unpassable = ((flags & FLAG_UNPASSABLE) == FLAG_UNPASSABLE); item->blockMissiles = ((flags & FLAG_BLOCK_MISSILES) == FLAG_BLOCK_MISSILES); item->blockPathfinder = ((flags & FLAG_BLOCK_PATHFINDER) == FLAG_BLOCK_PATHFINDER); @@ -629,75 +636,79 @@ bool ItemDatabase::loadFromOtbVer3(BinaryNode* itemNode, wxString& error, wxArra } uint8_t attribute; - while(itemNode->getU8(attribute)) { + while (itemNode->getU8(attribute)) { uint16_t datalen; - if(!itemNode->getU16(datalen)) { + if (!itemNode->getU16(datalen)) { warnings.push_back("Invalid item type property"); break; } - switch(attribute) { + switch (attribute) { case ITEM_ATTR_SERVERID: { - if(datalen != sizeof(uint16_t)) { + if (datalen != sizeof(uint16_t)) { error = "items.otb: Unexpected data length of server id block (Should be 2 bytes)"; return false; } - if(!itemNode->getU16(item->id)) + if (!itemNode->getU16(item->id)) { warnings.push_back("Invalid item type property (2)"); + } - if(maxItemId < item->id) + if (maxItemId < item->id) { maxItemId = item->id; + } break; } case ITEM_ATTR_CLIENTID: { - if(datalen != sizeof(uint16_t)) { + if (datalen != sizeof(uint16_t)) { error = "items.otb: Unexpected data length of client id block (Should be 2 bytes)"; return false; } - if(!itemNode->getU16(item->clientID)) + if (!itemNode->getU16(item->clientID)) { warnings.push_back("Invalid item type property (2)"); + } item->sprite = static_cast(g_gui.gfx.getSprite(item->clientID)); break; } case ITEM_ATTR_SPEED: { - if(datalen != sizeof(uint16_t)) { + if (datalen != sizeof(uint16_t)) { error = "items.otb: Unexpected data length of speed block (Should be 2 bytes)"; return false; } - //t->speed = itemNode->getU16(); - if(!itemNode->skip(2)) // Just skip two bytes, we don't need speed + // t->speed = itemNode->getU16(); + if (!itemNode->skip(2)) { // Just skip two bytes, we don't need speed warnings.push_back("Invalid item type property (3)"); + } break; } case ITEM_ATTR_LIGHT2: { - if(datalen != sizeof(lightBlock2)) - { + if (datalen != sizeof(lightBlock2)) { warnings.push_back("items.otb: Unexpected data length of item light (2) block (Should be " + i2ws(sizeof(lightBlock2)) + " bytes)"); break; } - if(!itemNode->skip(4)) // Just skip two bytes, we don't need light + if (!itemNode->skip(4)) { // Just skip two bytes, we don't need light warnings.push_back("Invalid item type property (4)"); + } - //t->lightLevel = itemNode->getU16(); - //t->lightColor = itemNode->getU16(); + // t->lightLevel = itemNode->getU16(); + // t->lightColor = itemNode->getU16(); break; } case ITEM_ATTR_TOPORDER: { - if(datalen != sizeof(uint8_t)) { + if (datalen != sizeof(uint8_t)) { warnings.push_back("items.otb: Unexpected data length of item toporder block (Should be 1 byte)"); break; } uint8_t value; - if(!itemNode->getU8(value)) { + if (!itemNode->getU8(value)) { warnings.push_back("Invalid item type property (5)"); break; } @@ -707,15 +718,15 @@ bool ItemDatabase::loadFromOtbVer3(BinaryNode* itemNode, wxString& error, wxArra } default: { - //skip unknown attributes + // skip unknown attributes itemNode->skip(datalen); - //warnings.push_back("items.otb: Skipped unknown attribute"); + // warnings.push_back("items.otb: Skipped unknown attribute"); break; } } } - if(items[item->id]) { + if (items[item->id]) { warnings.push_back("items.otb: Duplicate items"); delete items[item->id]; } @@ -724,46 +735,46 @@ bool ItemDatabase::loadFromOtbVer3(BinaryNode* itemNode, wxString& error, wxArra return true; } -bool ItemDatabase::loadFromOtb(const FileName& datafile, wxString& error, wxArrayString& warnings) -{ +bool ItemDatabase::loadFromOtb(const FileName &datafile, wxString &error, wxArrayString &warnings) { std::string filename = nstr((datafile.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + datafile.GetFullName())); DiskNodeFileReadHandle f(filename, StringVector(1, "OTBI")); - if(!f.isOk()) { + if (!f.isOk()) { error = "Couldn't open file \"" + wxstr(filename) + "\":" + wxstr(f.getErrorMessage()); return false; } BinaryNode* root = f.getRootNode(); -#define safe_get(node, func, ...) do {\ - if(!node->get##func(__VA_ARGS__)) {\ +#define safe_get(node, func, ...) \ + do { \ + if (!node->get##func(__VA_ARGS__)) { \ error = wxstr(f.getErrorMessage()); \ - return false; \ - } \ - } while(false) + return false; \ + } \ + } while (false) // Read root flags root->skip(1); // Type info - //uint32_t flags = + // uint32_t flags = root->skip(4); // Unused? uint8_t attr; safe_get(root, U8, attr); - if(attr == ROOT_ATTR_VERSION) { + if (attr == ROOT_ATTR_VERSION) { uint16_t datalen; - if(!root->getU16(datalen) || datalen != 4 + 4 + 4 + 1*128) { + if (!root->getU16(datalen) || datalen != 4 + 4 + 4 + 1 * 128) { error = "items.otb: Size of version header is invalid, updated .otb version?"; return false; } - safe_get(root, U32, MajorVersion); // items otb format file version - safe_get(root, U32, MinorVersion); // client version - safe_get(root, U32, BuildNumber); // revision + safe_get(root, U32, MajorVersion); // items otb format file version + safe_get(root, U32, MinorVersion); // client version + safe_get(root, U32, BuildNumber); // revision std::string csd; csd.resize(128); - if(!root->getRAW((uint8_t*)csd.data(), 128)) { // CSDVersion ?? + if (!root->getRAW((uint8_t*)csd.data(), 128)) { // CSDVersion ?? error = wxstr(f.getErrorMessage()); return false; } @@ -771,208 +782,211 @@ bool ItemDatabase::loadFromOtb(const FileName& datafile, wxString& error, wxArra error = "Expected ROOT_ATTR_VERSION as first node of items.otb!"; } - if(g_settings.getInteger(Config::CHECK_SIGNATURES)) { - if(g_gui.GetCurrentVersion().getOTBVersion().format_version != MajorVersion) { + if (g_settings.getInteger(Config::CHECK_SIGNATURES)) { + if (g_gui.GetCurrentVersion().getOTBVersion().format_version != MajorVersion) { error = "Unsupported items.otb version (version " + i2ws(MajorVersion) + ")"; return false; } } BinaryNode* itemNode = root->getChild(); - switch(MajorVersion) { - case 1: return loadFromOtbVer1(itemNode, error, warnings); - case 2: return loadFromOtbVer2(itemNode, error, warnings); - case 3: return loadFromOtbVer3(itemNode, error, warnings); + switch (MajorVersion) { + case 1: + return loadFromOtbVer1(itemNode, error, warnings); + case 2: + return loadFromOtbVer2(itemNode, error, warnings); + case 3: + return loadFromOtbVer3(itemNode, error, warnings); } return true; } -bool ItemDatabase::loadItemFromGameXml(pugi::xml_node itemNode, uint16_t id) -{ +bool ItemDatabase::loadItemFromGameXml(pugi::xml_node itemNode, uint16_t id) { ClientVersionID clientVersion = g_gui.GetCurrentVersionID(); - if(clientVersion < CLIENT_VERSION_980 && id > 20000 && id < 20100) { + if (clientVersion < CLIENT_VERSION_980 && id > 20000 && id < 20100) { itemNode = itemNode.next_sibling(); return true; - } else if(id > 30000 && id < 30100) { + } else if (id > 30000 && id < 30100) { itemNode = itemNode.next_sibling(); return true; } - // Não verificar isValidID se o ID estiver entre 1 e 18, mas verificar para outros IDs. - if(!(id >= 1 && id <= 18) && !isValidID(id)) - return false; + // Não verificar isValidID se o ID estiver entre 1 e 18, mas verificar para outros IDs. + if (!(id >= 1 && id <= 18) && !isValidID(id)) { + return false; + } - ItemType& item = getItemType(id); + ItemType &item = getItemType(id); item.name = itemNode.attribute("name").as_string(); item.editorsuffix = itemNode.attribute("editorsuffix").as_string(); pugi::xml_attribute attribute; - for(pugi::xml_node itemAttributesNode = itemNode.first_child(); itemAttributesNode; itemAttributesNode = itemAttributesNode.next_sibling()) { - if(!(attribute = itemAttributesNode.attribute("key"))) { + for (pugi::xml_node itemAttributesNode = itemNode.first_child(); itemAttributesNode; itemAttributesNode = itemAttributesNode.next_sibling()) { + if (!(attribute = itemAttributesNode.attribute("key"))) { continue; } std::string key = attribute.as_string(); to_lower_str(key); - if(key == "type") { - if(!(attribute = itemAttributesNode.attribute("value"))) { + if (key == "type") { + if (!(attribute = itemAttributesNode.attribute("value"))) { continue; } std::string typeValue = attribute.as_string(); to_lower_str(key); - if(typeValue == "depot") { + if (typeValue == "depot") { item.type = ITEM_TYPE_DEPOT; - } else if(typeValue == "mailbox") { + } else if (typeValue == "mailbox") { item.type = ITEM_TYPE_MAILBOX; - } else if(typeValue == "trashholder") { + } else if (typeValue == "trashholder") { item.type = ITEM_TYPE_TRASHHOLDER; - } else if(typeValue == "container") { + } else if (typeValue == "container") { item.type = ITEM_TYPE_CONTAINER; - } else if(typeValue == "door") { + } else if (typeValue == "door") { item.type = ITEM_TYPE_DOOR; - } else if(typeValue == "magicfield") { + } else if (typeValue == "magicfield") { item.group = ITEM_GROUP_MAGICFIELD; item.type = ITEM_TYPE_MAGICFIELD; - } else if(typeValue == "teleport") { + } else if (typeValue == "teleport") { item.type = ITEM_TYPE_TELEPORT; - } else if(typeValue == "bed") { + } else if (typeValue == "bed") { item.type = ITEM_TYPE_BED; - } else if(typeValue == "key") { + } else if (typeValue == "key") { item.type = ITEM_TYPE_KEY; } - } else if(key == "name") { - if((attribute = itemAttributesNode.attribute("value"))) { + } else if (key == "name") { + if ((attribute = itemAttributesNode.attribute("value"))) { item.name = attribute.as_string(); } - } else if(key == "description") { - if((attribute = itemAttributesNode.attribute("value"))) { + } else if (key == "description") { + if ((attribute = itemAttributesNode.attribute("value"))) { item.description = attribute.as_string(); } - }else if(key == "runespellName") { + } else if (key == "runespellName") { /*if((attribute = itemAttributesNode.attribute("value"))) { it.runeSpellName = attribute.as_string(); }*/ - } else if(key == "weight") { - if((attribute = itemAttributesNode.attribute("value"))) { + } else if (key == "weight") { + if ((attribute = itemAttributesNode.attribute("value"))) { item.weight = attribute.as_int() / 100.f; } - } else if(key == "armor") { - if((attribute = itemAttributesNode.attribute("value"))) { + } else if (key == "armor") { + if ((attribute = itemAttributesNode.attribute("value"))) { item.armor = attribute.as_int(); } - } else if(key == "defense") { - if((attribute = itemAttributesNode.attribute("value"))) { + } else if (key == "defense") { + if ((attribute = itemAttributesNode.attribute("value"))) { item.defense = attribute.as_int(); } - } else if(key == "rotateto") { - if((attribute = itemAttributesNode.attribute("value"))) { + } else if (key == "rotateto") { + if ((attribute = itemAttributesNode.attribute("value"))) { item.rotateTo = attribute.as_uint(); } - } else if(key == "containersize") { - if((attribute = itemAttributesNode.attribute("value"))) { + } else if (key == "containersize") { + if ((attribute = itemAttributesNode.attribute("value"))) { item.volume = attribute.as_uint(); } - } else if(key == "readable") { - if((attribute = itemAttributesNode.attribute("value"))) { + } else if (key == "readable") { + if ((attribute = itemAttributesNode.attribute("value"))) { item.canReadText = attribute.as_bool(); } - } else if(key == "writeable") { - if((attribute = itemAttributesNode.attribute("value"))) { + } else if (key == "writeable") { + if ((attribute = itemAttributesNode.attribute("value"))) { item.canWriteText = item.canReadText = attribute.as_bool(); } - } else if(key == "decayto") { + } else if (key == "decayto") { item.decays = true; - } else if(key == "maxtextlen" || key == "maxtextlength") { - if((attribute = itemAttributesNode.attribute("value"))) { + } else if (key == "maxtextlen" || key == "maxtextlength") { + if ((attribute = itemAttributesNode.attribute("value"))) { item.maxTextLen = attribute.as_uint(); item.canReadText = item.maxTextLen > 0; } - } else if(key == "writeonceitemid") { + } else if (key == "writeonceitemid") { /*if((attribute = itemAttributesNode.attribute("value"))) { it.writeOnceItemId = pugi::cast(attribute.value()); }*/ - } else if(key == "allowdistread") { - if((attribute = itemAttributesNode.attribute("value"))) { + } else if (key == "allowdistread") { + if ((attribute = itemAttributesNode.attribute("value"))) { item.allowDistRead = attribute.as_bool(); } - } else if(key == "charges") { - if((attribute = itemAttributesNode.attribute("value"))) { + } else if (key == "charges") { + if ((attribute = itemAttributesNode.attribute("value"))) { item.charges = attribute.as_uint(); item.extra_chargeable = true; } - } else if(key == "floorchange") { + } else if (key == "floorchange") { if ((attribute = itemAttributesNode.attribute("value"))) { std::string value = attribute.as_string(); - if(value == "down") { + if (value == "down") { item.floorChangeDown = true; item.floorChange = true; - } else if(value == "north") { + } else if (value == "north") { item.floorChangeNorth = true; item.floorChange = true; - } else if(value == "south") { + } else if (value == "south") { item.floorChangeSouth = true; item.floorChange = true; - } else if(value == "west") { + } else if (value == "west") { item.floorChangeWest = true; item.floorChange = true; - } else if(value == "east") { + } else if (value == "east") { item.floorChangeEast = true; item.floorChange = true; - } else if(value == "northex") + } else if (value == "northex") { item.floorChange = true; - else if(value == "southex") + } else if (value == "southex") { item.floorChange = true; - else if(value == "westex") + } else if (value == "westex") { item.floorChange = true; - else if(value == "eastex") + } else if (value == "eastex") { item.floorChange = true; - else if(value == "southalt") + } else if (value == "southalt") { item.floorChange = true; - else if(value == "eastalt") + } else if (value == "eastalt") { item.floorChange = true; + } } } } return true; } -bool ItemDatabase::loadFromGameXml(const FileName& identifier, wxString& error, wxArrayString& warnings) -{ +bool ItemDatabase::loadFromGameXml(const FileName &identifier, wxString &error, wxArrayString &warnings) { pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(identifier.GetFullPath().mb_str()); - if(!result) { + if (!result) { error = "Could not load items.xml (Syntax error?)"; return false; } pugi::xml_node node = doc.child("items"); - if(!node) { + if (!node) { error = "items.xml, invalid root node."; return false; } - for(pugi::xml_node itemNode = node.first_child(); itemNode; itemNode = itemNode.next_sibling()) { - if(as_lower_str(itemNode.name()) != "item") { + for (pugi::xml_node itemNode = node.first_child(); itemNode; itemNode = itemNode.next_sibling()) { + if (as_lower_str(itemNode.name()) != "item") { continue; } uint16_t fromId = 0; uint16_t toId = 0; - if(const pugi::xml_attribute attribute = itemNode.attribute("id")) { + if (const pugi::xml_attribute attribute = itemNode.attribute("id")) { fromId = toId = attribute.as_uint(); } else { fromId = itemNode.attribute("fromid").as_uint(); toId = itemNode.attribute("toid").as_uint(); } - if(fromId == 0 || toId == 0) { - error = "Could not read item id from item node, fromid "+ std::to_string(fromId) +", toid "+ std::to_string(toId) +"."; + if (fromId == 0 || toId == 0) { + error = "Could not read item id from item node, fromid " + std::to_string(fromId) + ", toid " + std::to_string(toId) + "."; return false; } - for(uint16_t id = fromId; id <= toId; ++id) { - if(!loadItemFromGameXml(itemNode, id)) { + for (uint16_t id = fromId; id <= toId; ++id) { + if (!loadItemFromGameXml(itemNode, id)) { error = wxString::Format("Could not load item id %d. Item id not found.", id); return false; } @@ -981,11 +995,10 @@ bool ItemDatabase::loadFromGameXml(const FileName& identifier, wxString& error, return true; } -bool ItemDatabase::loadMetaItem(pugi::xml_node node) -{ - if(const pugi::xml_attribute attribute = node.attribute("id")) { +bool ItemDatabase::loadMetaItem(pugi::xml_node node) { + if (const pugi::xml_attribute attribute = node.attribute("id")) { const uint16_t id = attribute.as_uint(); - if(id == 0 || items[id]) { + if (id == 0 || items[id]) { return false; } @@ -998,30 +1011,29 @@ bool ItemDatabase::loadMetaItem(pugi::xml_node node) return false; } -ItemType& ItemDatabase::getItemType(uint16_t id) -{ - if(id == 0 || id > maxItemId) { +ItemType &ItemDatabase::getItemType(uint16_t id) { + if (id == 0 || id > maxItemId) { return dummy; } ItemType* type = items[id]; - if(type) { + if (type) { return *type; } return dummy; } -ItemType* ItemDatabase::getRawItemType(uint16_t id) -{ - if(id == 0 || id > maxItemId) +ItemType* ItemDatabase::getRawItemType(uint16_t id) { + if (id == 0 || id > maxItemId) { return nullptr; + } return items[id]; } -bool ItemDatabase::isValidID(uint16_t id) const -{ - if(id == 0 || id > maxItemId) +bool ItemDatabase::isValidID(uint16_t id) const { + if (id == 0 || id > maxItemId) { return false; + } return items[id] != nullptr; } diff --git a/source/items.h b/source/items.h index 59674bb5..e1417dc0 100644 --- a/source/items.h +++ b/source/items.h @@ -80,7 +80,7 @@ enum ItemTypes_t { /////////OTB specific////////////// -enum rootattrib_t{ +enum rootattrib_t { ROOT_ATTR_VERSION = 0x01 }; @@ -108,7 +108,7 @@ enum itemattrib_t { ITEM_ATTR_08, ITEM_ATTR_LIGHT, - //1-byte aligned + // 1-byte aligned ITEM_ATTR_DECAY2, ITEM_ATTR_WEAPON2, ITEM_ATTR_AMU2, @@ -150,7 +150,7 @@ enum itemflags_t { FLAG_IGNORE_LOOK = 1 << 23 }; -enum slotsOTB_t{ +enum slotsOTB_t { OTB_SLOT_DEFAULT, OTB_SLOT_HEAD, OTB_SLOT_BODY, @@ -165,26 +165,26 @@ enum slotsOTB_t{ }; enum ShootTypeOtb_t { - OTB_SHOOT_NONE = 0, - OTB_SHOOT_BOLT = 1, - OTB_SHOOT_ARROW = 2, - OTB_SHOOT_FIRE = 3, - OTB_SHOOT_ENERGY = 4, - OTB_SHOOT_POISONARROW = 5, - OTB_SHOOT_BURSTARROW = 6, - OTB_SHOOT_THROWINGSTAR = 7, + OTB_SHOOT_NONE = 0, + OTB_SHOOT_BOLT = 1, + OTB_SHOOT_ARROW = 2, + OTB_SHOOT_FIRE = 3, + OTB_SHOOT_ENERGY = 4, + OTB_SHOOT_POISONARROW = 5, + OTB_SHOOT_BURSTARROW = 6, + OTB_SHOOT_THROWINGSTAR = 7, OTB_SHOOT_THROWINGKNIFE = 8, - OTB_SHOOT_SMALLSTONE = 9, - OTB_SHOOT_SUDDENDEATH = 10, - OTB_SHOOT_LARGEROCK = 11, - OTB_SHOOT_SNOWBALL = 12, - OTB_SHOOT_POWERBOLT = 13, - OTB_SHOOT_SPEAR = 14, - OTB_SHOOT_POISONFIELD = 15, - OTB_SHOOT_INFERNALBOLT = 16 + OTB_SHOOT_SMALLSTONE = 9, + OTB_SHOOT_SUDDENDEATH = 10, + OTB_SHOOT_LARGEROCK = 11, + OTB_SHOOT_SNOWBALL = 12, + OTB_SHOOT_POWERBOLT = 13, + OTB_SHOOT_SPEAR = 14, + OTB_SHOOT_POISONFIELD = 15, + OTB_SHOOT_INFERNALBOLT = 16 }; -//1-byte aligned structs +// 1-byte aligned structs #pragma pack(1) struct VERSIONINFO { @@ -235,40 +235,75 @@ struct writeableBlock3 { #pragma pack() -class ItemType -{ +class ItemType { private: - ItemType(const ItemType&) {} + ItemType(const ItemType &) { } public: ItemType(); - bool isGroundTile() const noexcept { return group == ITEM_GROUP_GROUND; } - bool isSplash() const noexcept { return group == ITEM_GROUP_SPLASH; } - bool isFluidContainer() const noexcept { return group == ITEM_GROUP_FLUID; } - - bool isClientCharged() const { return client_chargeable; } - bool isExtraCharged() const { return !client_chargeable && extra_chargeable; } - - bool isDepot() const noexcept { return type == ITEM_TYPE_DEPOT; } - bool isMailbox() const noexcept { return type == ITEM_TYPE_MAILBOX; } - bool isTrashHolder() const noexcept { return type == ITEM_TYPE_TRASHHOLDER; } - bool isContainer() const noexcept { return type == ITEM_TYPE_CONTAINER; } - bool isDoor() const noexcept { return type == ITEM_TYPE_DOOR; } - bool isMagicField() const noexcept { return type == ITEM_TYPE_MAGICFIELD; } - bool isTeleport() const noexcept { return type == ITEM_TYPE_TELEPORT; } - bool isBed() const noexcept { return type == ITEM_TYPE_BED; } - bool isKey() const noexcept { return type == ITEM_TYPE_KEY; } - - bool isStackable() const noexcept { return stackable; } - bool isMetaItem() const noexcept { return is_metaitem; } + bool isGroundTile() const noexcept { + return group == ITEM_GROUP_GROUND; + } + bool isSplash() const noexcept { + return group == ITEM_GROUP_SPLASH; + } + bool isFluidContainer() const noexcept { + return group == ITEM_GROUP_FLUID; + } + + bool isClientCharged() const { + return client_chargeable; + } + bool isExtraCharged() const { + return !client_chargeable && extra_chargeable; + } + + bool isDepot() const noexcept { + return type == ITEM_TYPE_DEPOT; + } + bool isMailbox() const noexcept { + return type == ITEM_TYPE_MAILBOX; + } + bool isTrashHolder() const noexcept { + return type == ITEM_TYPE_TRASHHOLDER; + } + bool isContainer() const noexcept { + return type == ITEM_TYPE_CONTAINER; + } + bool isDoor() const noexcept { + return type == ITEM_TYPE_DOOR; + } + bool isMagicField() const noexcept { + return type == ITEM_TYPE_MAGICFIELD; + } + bool isTeleport() const noexcept { + return type == ITEM_TYPE_TELEPORT; + } + bool isBed() const noexcept { + return type == ITEM_TYPE_BED; + } + bool isKey() const noexcept { + return type == ITEM_TYPE_KEY; + } + + bool isStackable() const noexcept { + return stackable; + } + bool isMetaItem() const noexcept { + return is_metaitem; + } bool isFloorChange() const noexcept; - float getWeight() const noexcept { return weight; } - uint16_t getVolume() const noexcept { return volume; } + float getWeight() const noexcept { + return weight; + } + uint16_t getVolume() const noexcept { + return volume; + } -// editor related + // editor related public: Brush* brush; Brush* doodad_brush; @@ -304,7 +339,7 @@ class ItemType uint16_t volume; uint16_t maxTextLen; - //uint16_t writeOnceItemId; + // uint16_t writeOnceItemId; std::string name; std::string editorsuffix; @@ -353,27 +388,30 @@ class ItemType BorderType border_alignment; }; -class ItemDatabase -{ +class ItemDatabase { public: ItemDatabase(); ~ItemDatabase(); void clear(); - uint16_t getMinID() const noexcept { return 100; } - uint16_t getMaxID() const noexcept { return maxItemId; } - ItemType& getItemType(uint16_t id); + uint16_t getMinID() const noexcept { + return 100; + } + uint16_t getMaxID() const noexcept { + return maxItemId; + } + ItemType &getItemType(uint16_t id); ItemType* getRawItemType(uint16_t id); bool isValidID(uint16_t id) const; - bool loadFromOtb(const FileName& datafile, wxString& error, wxArrayString& warnings); - bool loadFromGameXml(const FileName& datafile, wxString& error, wxArrayString& warnings); + bool loadFromOtb(const FileName &datafile, wxString &error, wxArrayString &warnings); + bool loadFromGameXml(const FileName &datafile, wxString &error, wxArrayString &warnings); bool loadItemFromGameXml(pugi::xml_node itemNode, uint16_t id); bool loadMetaItem(pugi::xml_node node); - //typedef std::map ItemMap; + // typedef std::map ItemMap; typedef contigous_vector ItemMap; typedef std::map ItemNameMap; @@ -383,9 +421,9 @@ class ItemDatabase uint32_t BuildNumber; protected: - bool loadFromOtbVer1(BinaryNode* itemNode, wxString& error, wxArrayString& warnings); - bool loadFromOtbVer2(BinaryNode* itemNode, wxString& error, wxArrayString& warnings); - bool loadFromOtbVer3(BinaryNode* itemNode, wxString& error, wxArrayString& warnings); + bool loadFromOtbVer1(BinaryNode* itemNode, wxString &error, wxArrayString &warnings); + bool loadFromOtbVer2(BinaryNode* itemNode, wxString &error, wxArrayString &warnings); + bool loadFromOtbVer3(BinaryNode* itemNode, wxString &error, wxArrayString &warnings); protected: ItemMap items; diff --git a/source/light_drawer.cpp b/source/light_drawer.cpp index d8f18824..06451b2d 100644 --- a/source/light_drawer.cpp +++ b/source/light_drawer.cpp @@ -18,8 +18,7 @@ #include "main.h" #include "light_drawer.h" -LightDrawer::LightDrawer() -{ +LightDrawer::LightDrawer() { texture = 0; buffer.resize(static_cast(rme::ClientMapWidth * rme::ClientMapHeight * rme::PixelFormatRGBA)); global_color = wxColor(50, 50, 50, 255); @@ -27,15 +26,13 @@ LightDrawer::LightDrawer() createGLTexture(); } -LightDrawer::~LightDrawer() -{ +LightDrawer::~LightDrawer() { unloadGLTexture(); lights.clear(); } -void LightDrawer::draw(int map_x, int map_y, int scroll_x, int scroll_y) -{ +void LightDrawer::draw(int map_x, int map_y, int scroll_x, int scroll_y) { constexpr int half_tile_size = rme::TileSize / 2; for (int x = 0; x < rme::ClientMapWidth; ++x) { @@ -47,12 +44,12 @@ void LightDrawer::draw(int map_x, int map_y, int scroll_x, int scroll_y) int index = (y * rme::ClientMapWidth + x); int color_index = index * rme::PixelFormatRGBA; - buffer[color_index] = global_color.Red(); + buffer[color_index] = global_color.Red(); buffer[color_index + 1] = global_color.Green(); buffer[color_index + 2] = global_color.Blue(); buffer[color_index + 3] = global_color.Alpha(); - for (auto& light : lights) { + for (auto &light : lights) { float intensity = calculateIntensity(mx, my, light); if (intensity == 0.f) { continue; @@ -61,7 +58,7 @@ void LightDrawer::draw(int map_x, int map_y, int scroll_x, int scroll_y) uint8_t red = static_cast(light_color.Red() * intensity); uint8_t green = static_cast(light_color.Green() * intensity); uint8_t blue = static_cast(light_color.Blue() * intensity); - buffer[color_index] = std::max(buffer[color_index], red); + buffer[color_index] = std::max(buffer[color_index], red); buffer[color_index + 1] = std::max(buffer[color_index + 1], green); buffer[color_index + 2] = std::max(buffer[color_index + 2], blue); } @@ -84,23 +81,25 @@ void LightDrawer::draw(int map_x, int map_y, int scroll_x, int scroll_y) glEnable(GL_TEXTURE_2D); glBegin(GL_QUADS); - glTexCoord2f(0.f, 0.f); glVertex2f(draw_x, draw_y); - glTexCoord2f(1.f, 0.f); glVertex2f(draw_x + draw_width, draw_y); - glTexCoord2f(1.f, 1.f); glVertex2f(draw_x + draw_width, draw_y + draw_height); - glTexCoord2f(0.f, 1.f); glVertex2f(draw_x, draw_y + draw_height); + glTexCoord2f(0.f, 0.f); + glVertex2f(draw_x, draw_y); + glTexCoord2f(1.f, 0.f); + glVertex2f(draw_x + draw_width, draw_y); + glTexCoord2f(1.f, 1.f); + glVertex2f(draw_x + draw_width, draw_y + draw_height); + glTexCoord2f(0.f, 1.f); + glVertex2f(draw_x, draw_y + draw_height); glEnd(); glDisable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } -void LightDrawer::setGlobalLightColor(uint8_t color) -{ +void LightDrawer::setGlobalLightColor(uint8_t color) { global_color = colorFromEightBit(color); } -void LightDrawer::addLight(int map_x, int map_y, const SpriteLight& light) -{ +void LightDrawer::addLight(int map_x, int map_y, const SpriteLight &light) { if (map_x <= 0 || map_x >= rme::MapMaxWidth || map_y <= 0 || map_y >= rme::MapMaxHeight) { return; } @@ -108,27 +107,24 @@ void LightDrawer::addLight(int map_x, int map_y, const SpriteLight& light) uint8_t intensity = std::min(light.intensity, static_cast(rme::MaxLightIntensity)); if (!lights.empty()) { - Light& previous = lights.back(); + Light &previous = lights.back(); if (previous.map_x == map_x && previous.map_y == map_y && previous.color == light.color) { previous.intensity = std::max(previous.intensity, intensity); return; } } - lights.push_back(Light{ static_cast(map_x), static_cast(map_y), light.color, intensity }); + lights.push_back(Light { static_cast(map_x), static_cast(map_y), light.color, intensity }); } -void LightDrawer::clear() noexcept -{ +void LightDrawer::clear() noexcept { lights.clear(); } -void LightDrawer::createGLTexture() -{ +void LightDrawer::createGLTexture() { glGenTextures(1, &texture); } -void LightDrawer::unloadGLTexture() -{ +void LightDrawer::unloadGLTexture() { glDeleteTextures(1, &texture); } diff --git a/source/light_drawer.h b/source/light_drawer.h index 06cb45b9..778f8b79 100644 --- a/source/light_drawer.h +++ b/source/light_drawer.h @@ -21,8 +21,7 @@ #include "graphics.h" #include "position.h" -class LightDrawer -{ +class LightDrawer { struct Light { uint16_t map_x = 0; uint16_t map_y = 0; @@ -37,14 +36,14 @@ class LightDrawer void draw(int map_x, int map_y, int scroll_x, int scroll_y); void setGlobalLightColor(uint8_t color); - void addLight(int map_x, int map_y, const SpriteLight& light); + void addLight(int map_x, int map_y, const SpriteLight &light); void clear() noexcept; private: void createGLTexture(); void unloadGLTexture(); - inline float calculateIntensity(int map_x, int map_y, const Light& light) { + inline float calculateIntensity(int map_x, int map_y, const Light &light) { int dx = map_x - light.map_x; int dy = map_y - light.map_y; float distance = std::sqrt(dx * dx + dy * dy); diff --git a/source/live_action.cpp b/source/live_action.cpp index 80a23769..ce72c3b0 100644 --- a/source/live_action.cpp +++ b/source/live_action.cpp @@ -20,34 +20,29 @@ #include "live_action.h" #include "editor.h" -NetworkedAction::NetworkedAction(Editor& editor, ActionIdentifier ident) : +NetworkedAction::NetworkedAction(Editor &editor, ActionIdentifier ident) : Action(editor, ident), - owner(0) -{ + owner(0) { ; } -NetworkedAction::~NetworkedAction() -{ +NetworkedAction::~NetworkedAction() { ; } -NetworkedBatchAction::NetworkedBatchAction(Editor& editor, NetworkedActionQueue& queue, ActionIdentifier ident) : +NetworkedBatchAction::NetworkedBatchAction(Editor &editor, NetworkedActionQueue &queue, ActionIdentifier ident) : BatchAction(editor, ident), - queue(queue) -{ + queue(queue) { ; } -NetworkedBatchAction::~NetworkedBatchAction() -{ +NetworkedBatchAction::~NetworkedBatchAction() { ; } -void NetworkedBatchAction::addAndCommitAction(Action* action) -{ +void NetworkedBatchAction::addAndCommitAction(Action* action) { // If empty, do nothing. - if(action->size() == 0) { + if (action->size() == 0) { delete action; return; } @@ -55,11 +50,12 @@ void NetworkedBatchAction::addAndCommitAction(Action* action) // Track changed nodes... DirtyList dirty_list; NetworkedAction* netact = dynamic_cast(action); - if(netact) + if (netact) { dirty_list.owner = netact->owner; + } // Add it! - action->commit(type != ACTION_SELECT? &dirty_list : nullptr); + action->commit(type != ACTION_SELECT ? &dirty_list : nullptr); batch.push_back(action); timestamp = time(nullptr); @@ -67,59 +63,53 @@ void NetworkedBatchAction::addAndCommitAction(Action* action) queue.broadcast(dirty_list); } -void NetworkedBatchAction::commit() -{ +void NetworkedBatchAction::commit() { // Track changed nodes... DirtyList dirty_list; - for(ActionVector::iterator it = batch.begin(); it != batch.end(); ++it) { + for (ActionVector::iterator it = batch.begin(); it != batch.end(); ++it) { NetworkedAction* action = static_cast(*it); - if(!action->isCommited()) { - action->commit(type != ACTION_SELECT? &dirty_list : nullptr); - if(action->owner != 0) + if (!action->isCommited()) { + action->commit(type != ACTION_SELECT ? &dirty_list : nullptr); + if (action->owner != 0) { dirty_list.owner = action->owner; + } } } // Broadcast changes! queue.broadcast(dirty_list); } -void NetworkedBatchAction::undo() -{ +void NetworkedBatchAction::undo() { // Track changed nodes... DirtyList dirty_list; - for(ActionVector::reverse_iterator it = batch.rbegin(); it != batch.rend(); ++it) { - (*it)->undo(type != ACTION_SELECT? &dirty_list : nullptr); + for (ActionVector::reverse_iterator it = batch.rbegin(); it != batch.rend(); ++it) { + (*it)->undo(type != ACTION_SELECT ? &dirty_list : nullptr); } // Broadcast changes! queue.broadcast(dirty_list); } -void NetworkedBatchAction::redo() -{ +void NetworkedBatchAction::redo() { commit(); } - //=================== // Action queue -NetworkedActionQueue::NetworkedActionQueue(Editor& editor) : ActionQueue(editor) -{ +NetworkedActionQueue::NetworkedActionQueue(Editor &editor) : + ActionQueue(editor) { } -Action* NetworkedActionQueue::createAction(ActionIdentifier identifier) const -{ +Action* NetworkedActionQueue::createAction(ActionIdentifier identifier) const { return new NetworkedAction(editor, identifier); } -BatchAction* NetworkedActionQueue::createBatch(ActionIdentifier identifier) -{ +BatchAction* NetworkedActionQueue::createBatch(ActionIdentifier identifier) { return new NetworkedBatchAction(editor, *this, identifier); } -void NetworkedActionQueue::broadcast(DirtyList& dirty_list) -{ +void NetworkedActionQueue::broadcast(DirtyList &dirty_list) { editor.BroadcastNodes(dirty_list); } diff --git a/source/live_action.h b/source/live_action.h index 3d8e87d7..12dbfae5 100644 --- a/source/live_action.h +++ b/source/live_action.h @@ -24,8 +24,9 @@ class NetworkedActionQueue; class NetworkedAction : public Action { protected: - NetworkedAction(Editor& editor, ActionIdentifier ident); + NetworkedAction(Editor &editor, ActionIdentifier ident); ~NetworkedAction(); + public: uint32_t owner; @@ -33,9 +34,10 @@ class NetworkedAction : public Action { }; class NetworkedBatchAction : public BatchAction { - NetworkedActionQueue& queue; + NetworkedActionQueue &queue; + protected: - NetworkedBatchAction(Editor& editor, NetworkedActionQueue& queue, ActionIdentifier ident); + NetworkedBatchAction(Editor &editor, NetworkedActionQueue &queue, ActionIdentifier ident); ~NetworkedBatchAction(); public: @@ -49,16 +51,15 @@ class NetworkedBatchAction : public BatchAction { friend class NetworkedActionQueue; }; -class NetworkedActionQueue : public ActionQueue -{ +class NetworkedActionQueue : public ActionQueue { public: - NetworkedActionQueue(Editor& editor); + NetworkedActionQueue(Editor &editor); Action* createAction(ActionIdentifier identifier) const; BatchAction* createBatch(ActionIdentifier identifier); protected: - void broadcast(DirtyList& dirty_list); + void broadcast(DirtyList &dirty_list); friend class NetworkedBatchAction; }; diff --git a/source/live_client.cpp b/source/live_client.cpp index bc732f2d..1d763db3 100644 --- a/source/live_client.cpp +++ b/source/live_client.cpp @@ -22,40 +22,36 @@ #include "live_action.h" #include "editor.h" - -LiveClient::LiveClient() : LiveSocket(), +LiveClient::LiveClient() : + LiveSocket(), readMessage(), queryNodeList(), currentOperation(), - resolver(nullptr), socket(nullptr), editor(nullptr), stopped(false) -{ + resolver(nullptr), socket(nullptr), editor(nullptr), stopped(false) { // } -LiveClient::~LiveClient() -{ +LiveClient::~LiveClient() { // } -bool LiveClient::connect(const std::string& address, uint16_t port) -{ - NetworkConnection& connection = NetworkConnection::getInstance(); - if(!connection.start()) { +bool LiveClient::connect(const std::string &address, uint16_t port) { + NetworkConnection &connection = NetworkConnection::getInstance(); + if (!connection.start()) { setLastError("The previous connection has not been terminated yet."); return false; } - auto& service = connection.get_service(); - if(!resolver) { + auto &service = connection.get_service(); + if (!resolver) { resolver = std::make_shared(service); } - if(!socket) { + if (!socket) { socket = std::make_shared(service); } asio::ip::tcp::resolver::query query(address, std::to_string(port)); - resolver->async_resolve(query, [this](const std::error_code& error, asio::ip::tcp::resolver::iterator endpoint_iterator) -> void - { - if(error) { + resolver->async_resolve(query, [this](const std::error_code &error, asio::ip::tcp::resolver::iterator endpoint_iterator) -> void { + if (error) { logMessage("Error: " + error.message()); } else { tryConnect(endpoint_iterator); @@ -89,24 +85,22 @@ bool LiveClient::connect(const std::string& address, uint16_t port) return true; } -void LiveClient::tryConnect(asio::ip::tcp::resolver::iterator endpoint_iterator) -{ - if(stopped) { +void LiveClient::tryConnect(asio::ip::tcp::resolver::iterator endpoint_iterator) { + if (stopped) { return; } - if(endpoint_iterator == asio::ip::tcp::resolver::iterator()) { + if (endpoint_iterator == asio::ip::tcp::resolver::iterator()) { return; } logMessage("Joining server " + endpoint_iterator->host_name() + ":" + endpoint_iterator->service_name() + "..."); - asio::async_connect(*socket, endpoint_iterator, [this](std::error_code error, asio::ip::tcp::resolver::iterator endpoint_iterator) -> void - { - if(!socket->is_open()) { + asio::async_connect(*socket, endpoint_iterator, [this](std::error_code error, asio::ip::tcp::resolver::iterator endpoint_iterator) -> void { + if (!socket->is_open()) { tryConnect(++endpoint_iterator); - } else if(error) { - if(handleError(error)) { + } else if (error) { + if (handleError(error)) { tryConnect(++endpoint_iterator); } else { wxTheApp->CallAfter([this]() { @@ -116,7 +110,7 @@ void LiveClient::tryConnect(asio::ip::tcp::resolver::iterator endpoint_iterator) } } else { socket->set_option(asio::ip::tcp::no_delay(true), error); - if(error) { + if (error) { wxTheApp->CallAfter([this]() { close(); }); @@ -128,17 +122,16 @@ void LiveClient::tryConnect(asio::ip::tcp::resolver::iterator endpoint_iterator) }); } -void LiveClient::close() -{ - if(resolver) { +void LiveClient::close() { + if (resolver) { resolver->cancel(); } - if(socket) { + if (socket) { socket->close(); } - if(log) { + if (log) { log->Message("Disconnected from server."); log->Disconnect(); log = nullptr; @@ -147,85 +140,70 @@ void LiveClient::close() stopped = true; } -bool LiveClient::handleError(const std::error_code& error) -{ - if(error == asio::error::eof || error == asio::error::connection_reset) { +bool LiveClient::handleError(const std::error_code &error) { + if (error == asio::error::eof || error == asio::error::connection_reset) { wxTheApp->CallAfter([this]() { log->Message(wxString() + getHostName() + ": disconnected."); close(); }); return true; - } else if(error == asio::error::connection_aborted) { + } else if (error == asio::error::connection_aborted) { logMessage("You have left the server."); return true; } return false; } -std::string LiveClient::getHostName() const -{ - if(!socket) { +std::string LiveClient::getHostName() const { + if (!socket) { return "not connected"; } return socket->remote_endpoint().address().to_string(); } -void LiveClient::receiveHeader() -{ +void LiveClient::receiveHeader() { readMessage.position = 0; - asio::async_read(*socket, - asio::buffer(readMessage.buffer, 4), - [this](const std::error_code& error, size_t bytesReceived) -> void { - if(error) { - if(!handleError(error)) { - logMessage(wxString() + getHostName() + ": " + error.message()); - } - } else if(bytesReceived < 4) { - logMessage(wxString() + getHostName() + ": Could not receive header[size: " + std::to_string(bytesReceived) + "], disconnecting client."); - } else { - receive(readMessage.read()); + asio::async_read(*socket, asio::buffer(readMessage.buffer, 4), [this](const std::error_code &error, size_t bytesReceived) -> void { + if (error) { + if (!handleError(error)) { + logMessage(wxString() + getHostName() + ": " + error.message()); } + } else if (bytesReceived < 4) { + logMessage(wxString() + getHostName() + ": Could not receive header[size: " + std::to_string(bytesReceived) + "], disconnecting client."); + } else { + receive(readMessage.read()); } - ); + }); } -void LiveClient::receive(uint32_t packetSize) -{ +void LiveClient::receive(uint32_t packetSize) { readMessage.buffer.resize(readMessage.position + packetSize); - asio::async_read(*socket, - asio::buffer(&readMessage.buffer[readMessage.position], packetSize), - [this](const std::error_code& error, size_t bytesReceived) -> void { - if(error) { - if(!handleError(error)) { - logMessage(wxString() + getHostName() + ": " + error.message()); - } - } else if(bytesReceived < readMessage.buffer.size() - 4) { - logMessage(wxString() + getHostName() + ": Could not receive packet[size: " + std::to_string(bytesReceived) + "], disconnecting client."); - } else { - wxTheApp->CallAfter([this]() { - parsePacket(std::move(readMessage)); - receiveHeader(); - }); + asio::async_read(*socket, asio::buffer(&readMessage.buffer[readMessage.position], packetSize), [this](const std::error_code &error, size_t bytesReceived) -> void { + if (error) { + if (!handleError(error)) { + logMessage(wxString() + getHostName() + ": " + error.message()); } + } else if (bytesReceived < readMessage.buffer.size() - 4) { + logMessage(wxString() + getHostName() + ": Could not receive packet[size: " + std::to_string(bytesReceived) + "], disconnecting client."); + } else { + wxTheApp->CallAfter([this]() { + parsePacket(std::move(readMessage)); + receiveHeader(); + }); } - ); + }); } -void LiveClient::send(NetworkMessage& message) -{ +void LiveClient::send(NetworkMessage &message) { memcpy(&message.buffer[0], &message.size, 4); - asio::async_write(*socket, - asio::buffer(message.buffer, message.size + 4), - [this](const std::error_code& error, size_t bytesTransferred) -> void { - if(error) { - logMessage(wxString() + getHostName() + ": " + error.message()); - } + asio::async_write(*socket, asio::buffer(message.buffer, message.size + 4), [this](const std::error_code &error, size_t bytesTransferred) -> void { + if (error) { + logMessage(wxString() + getHostName() + ": " + error.message()); } - ); + }); } -void LiveClient::updateCursor(const Position& position) -{ +void LiveClient::updateCursor(const Position &position) { LiveCursor cursor; cursor.id = 77; // Unimportant, server fixes it for us cursor.pos = position; @@ -243,8 +221,7 @@ void LiveClient::updateCursor(const Position& position) send(message); } -LiveLogTab* LiveClient::createLogWindow(wxWindow* parent) -{ +LiveLogTab* LiveClient::createLogWindow(wxWindow* parent) { MapTabbook* mtb = dynamic_cast(parent); ASSERT(mtb); @@ -254,8 +231,7 @@ LiveLogTab* LiveClient::createLogWindow(wxWindow* parent) return log; } -MapTab* LiveClient::createEditorWindow() -{ +MapTab* LiveClient::createEditorWindow() { MapTabbook* mtb = dynamic_cast(g_gui.tabbook); ASSERT(mtb); @@ -265,8 +241,7 @@ MapTab* LiveClient::createEditorWindow() return edit; } -void LiveClient::sendHello() -{ +void LiveClient::sendHello() { NetworkMessage message; message.write(PACKET_HELLO_FROM_CLIENT); message.write(__RME_VERSION_ID__); @@ -278,9 +253,8 @@ void LiveClient::sendHello() send(message); } -void LiveClient::sendNodeRequests() -{ - if(queryNodeList.empty()) { +void LiveClient::sendNodeRequests() { + if (queryNodeList.empty()) { return; } @@ -288,7 +262,7 @@ void LiveClient::sendNodeRequests() message.write(PACKET_REQUEST_NODES); message.write(queryNodeList.size()); - for(uint32_t node : queryNodeList) { + for (uint32_t node : queryNodeList) { message.write(node); } @@ -296,18 +270,17 @@ void LiveClient::sendNodeRequests() queryNodeList.clear(); } -void LiveClient::sendChanges(DirtyList& dirtyList) -{ - ChangeList& changeList = dirtyList.GetChanges(); - if(changeList.empty()) { +void LiveClient::sendChanges(DirtyList &dirtyList) { + ChangeList &changeList = dirtyList.GetChanges(); + if (changeList.empty()) { return; } mapWriter.reset(); - for(Change* change : changeList) { + for (Change* change : changeList) { switch (change->getType()) { case CHANGE_TILE: { - const Position& position = static_cast(change->getData())->getPosition(); + const Position &position = static_cast(change->getData())->getPosition(); sendTile(mapWriter, editor->getMap().getTile(position), &position); break; } @@ -326,23 +299,20 @@ void LiveClient::sendChanges(DirtyList& dirtyList) send(message); } -void LiveClient::sendChat(const wxString& chatMessage) -{ +void LiveClient::sendChat(const wxString &chatMessage) { NetworkMessage message; message.write(PACKET_CLIENT_TALK); message.write(nstr(chatMessage)); send(message); } -void LiveClient::sendReady() -{ +void LiveClient::sendReady() { NetworkMessage message; message.write(PACKET_READY_CLIENT); send(message); } -void LiveClient::queryNode(int32_t ndx, int32_t ndy, bool underground) -{ +void LiveClient::queryNode(int32_t ndx, int32_t ndy, bool underground) { uint32_t nd = 0; nd |= ((ndx >> 2) << 18); nd |= ((ndy >> 2) << 4); @@ -350,10 +320,9 @@ void LiveClient::queryNode(int32_t ndx, int32_t ndy, bool underground) queryNodeList.insert(nd); } -void LiveClient::parsePacket(NetworkMessage message) -{ +void LiveClient::parsePacket(NetworkMessage message) { uint8_t packetType; - while(message.position < message.buffer.size()) { + while (message.position < message.buffer.size()) { packetType = message.read(); switch (packetType) { case PACKET_HELLO_FROM_SERVER: @@ -392,12 +361,11 @@ void LiveClient::parsePacket(NetworkMessage message) } } -void LiveClient::parseHello(NetworkMessage& message) -{ +void LiveClient::parseHello(NetworkMessage &message) { ASSERT(editor == nullptr); editor = newd Editor(g_gui.copybuffer, this); - Map& map = editor->getMap(); + Map &map = editor->getMap(); map.setName("Live Map - " + message.read()); map.setWidth(message.read()); map.setHeight(message.read()); @@ -405,23 +373,20 @@ void LiveClient::parseHello(NetworkMessage& message) createEditorWindow(); } -void LiveClient::parseKick(NetworkMessage& message) -{ - const std::string& kickMessage = message.read(); +void LiveClient::parseKick(NetworkMessage &message) { + const std::string &kickMessage = message.read(); close(); g_gui.PopupDialog("Disconnected", wxstr(kickMessage), wxOK); } -void LiveClient::parseClientAccepted(NetworkMessage& message) -{ +void LiveClient::parseClientAccepted(NetworkMessage &message) { sendReady(); } -void LiveClient::parseChangeClientVersion(NetworkMessage& message) -{ +void LiveClient::parseChangeClientVersion(NetworkMessage &message) { ClientVersionID clientVersion = static_cast(message.read()); - if(!g_gui.CloseAllEditors()) { + if (!g_gui.CloseAllEditors()) { close(); return; } @@ -433,18 +398,16 @@ void LiveClient::parseChangeClientVersion(NetworkMessage& message) sendReady(); } -void LiveClient::parseServerTalk(NetworkMessage& message) -{ - const std::string& speaker = message.read(); - const std::string& chatMessage = message.read(); +void LiveClient::parseServerTalk(NetworkMessage &message) { + const std::string &speaker = message.read(); + const std::string &chatMessage = message.read(); log->Chat( wxstr(speaker), wxstr(chatMessage) ); } -void LiveClient::parseNode(NetworkMessage& message) -{ +void LiveClient::parseNode(NetworkMessage &message) { uint32_t ind = message.read(); // Extract node position @@ -460,26 +423,23 @@ void LiveClient::parseNode(NetworkMessage& message) g_gui.UpdateMinimap(); } -void LiveClient::parseCursorUpdate(NetworkMessage& message) -{ +void LiveClient::parseCursorUpdate(NetworkMessage &message) { LiveCursor cursor = readCursor(message); cursors[cursor.id] = cursor; g_gui.RefreshView(); } -void LiveClient::parseStartOperation(NetworkMessage& message) -{ - const std::string& operation = message.read(); +void LiveClient::parseStartOperation(NetworkMessage &message) { + const std::string &operation = message.read(); currentOperation = wxstr(operation); g_gui.SetStatusText("Server Operation in Progress: " + currentOperation + "... (0%)"); } -void LiveClient::parseUpdateOperation(NetworkMessage& message) -{ +void LiveClient::parseUpdateOperation(NetworkMessage &message) { int32_t percent = message.read(); - if(percent >= 100) { + if (percent >= 100) { g_gui.SetStatusText("Server Operation Finished."); } else { g_gui.SetStatusText("Server Operation in Progress: " + currentOperation + "... (" + std::to_string(percent) + "%)"); diff --git a/source/live_client.h b/source/live_client.h index 13b9937f..d0f3a259 100644 --- a/source/live_client.h +++ b/source/live_client.h @@ -26,69 +26,68 @@ class DirtyList; class MapTab; -class LiveClient : public LiveSocket -{ - public: - LiveClient(); - ~LiveClient(); +class LiveClient : public LiveSocket { +public: + LiveClient(); + ~LiveClient(); - // - bool connect(const std::string& address, uint16_t port); - void tryConnect(asio::ip::tcp::resolver::iterator endpoint); + // + bool connect(const std::string &address, uint16_t port); + void tryConnect(asio::ip::tcp::resolver::iterator endpoint); - void close(); - bool handleError(const std::error_code& error); + void close(); + bool handleError(const std::error_code &error); - // - std::string getHostName() const; + // + std::string getHostName() const; - // - void receiveHeader(); - void receive(uint32_t packetSize); - void send(NetworkMessage& message); + // + void receiveHeader(); + void receive(uint32_t packetSize); + void send(NetworkMessage &message); - // - void updateCursor(const Position& position); + // + void updateCursor(const Position &position); - LiveLogTab* createLogWindow(wxWindow* parent); - MapTab* createEditorWindow(); + LiveLogTab* createLogWindow(wxWindow* parent); + MapTab* createEditorWindow(); - // send packets - void sendHello(); - void sendNodeRequests(); - void sendChanges(DirtyList& dirtyList); - void sendChat(const wxString& chatMessage); - void sendReady(); + // send packets + void sendHello(); + void sendNodeRequests(); + void sendChanges(DirtyList &dirtyList); + void sendChat(const wxString &chatMessage); + void sendReady(); - // Flags a node as queried and stores it, need to call SendNodeRequest to send it to server - void queryNode(int32_t ndx, int32_t ndy, bool underground); + // Flags a node as queried and stores it, need to call SendNodeRequest to send it to server + void queryNode(int32_t ndx, int32_t ndy, bool underground); - protected: - void parsePacket(NetworkMessage message); +protected: + void parsePacket(NetworkMessage message); - // parse packets - void parseHello(NetworkMessage& message); - void parseKick(NetworkMessage& message); - void parseClientAccepted(NetworkMessage& message); - void parseChangeClientVersion(NetworkMessage& message); - void parseServerTalk(NetworkMessage& message); - void parseNode(NetworkMessage& message); - void parseCursorUpdate(NetworkMessage& message); - void parseStartOperation(NetworkMessage& message); - void parseUpdateOperation(NetworkMessage& message); + // parse packets + void parseHello(NetworkMessage &message); + void parseKick(NetworkMessage &message); + void parseClientAccepted(NetworkMessage &message); + void parseChangeClientVersion(NetworkMessage &message); + void parseServerTalk(NetworkMessage &message); + void parseNode(NetworkMessage &message); + void parseCursorUpdate(NetworkMessage &message); + void parseStartOperation(NetworkMessage &message); + void parseUpdateOperation(NetworkMessage &message); - // - NetworkMessage readMessage; + // + NetworkMessage readMessage; - std::set queryNodeList; - wxString currentOperation; + std::set queryNodeList; + wxString currentOperation; - std::shared_ptr resolver; - std::shared_ptr socket; + std::shared_ptr resolver; + std::shared_ptr socket; - Editor* editor; + Editor* editor; - bool stopped; + bool stopped; }; #endif diff --git a/source/live_packets.h b/source/live_packets.h index 520dff39..157eabe0 100644 --- a/source/live_packets.h +++ b/source/live_packets.h @@ -18,9 +18,7 @@ #ifndef LIVE_PACKETS_H #define LIVE_PACKETS_H - -enum LivePacketType -{ +enum LivePacketType { PACKET_HELLO_FROM_CLIENT = 0x10, PACKET_READY_CLIENT = 0x11, diff --git a/source/live_peer.cpp b/source/live_peer.cpp index 4ef64267..971ce114 100644 --- a/source/live_peer.cpp +++ b/source/live_peer.cpp @@ -24,104 +24,87 @@ #include "editor.h" -LivePeer::LivePeer(LiveServer* server, asio::ip::tcp::socket socket) : LiveSocket(), - readMessage(), server(server), socket(std::move(socket)), color(), id(0), clientId(0), connected(false) -{ +LivePeer::LivePeer(LiveServer* server, asio::ip::tcp::socket socket) : + LiveSocket(), + readMessage(), server(server), socket(std::move(socket)), color(), id(0), clientId(0), connected(false) { ASSERT(server != nullptr); } -LivePeer::~LivePeer() -{ - if(socket.is_open()) { +LivePeer::~LivePeer() { + if (socket.is_open()) { socket.close(); } } -void LivePeer::close() -{ +void LivePeer::close() { server->removeClient(id); } -bool LivePeer::handleError(const std::error_code& error) -{ - if(error == asio::error::eof || error == asio::error::connection_reset) { +bool LivePeer::handleError(const std::error_code &error) { + if (error == asio::error::eof || error == asio::error::connection_reset) { logMessage(wxString() + getHostName() + ": disconnected."); close(); return true; - } else if(error == asio::error::connection_aborted) { + } else if (error == asio::error::connection_aborted) { logMessage(name + " have left the server."); return true; } return false; } -std::string LivePeer::getHostName() const -{ +std::string LivePeer::getHostName() const { return socket.remote_endpoint().address().to_string(); } -void LivePeer::receiveHeader() -{ +void LivePeer::receiveHeader() { readMessage.position = 0; - asio::async_read(socket, - asio::buffer(readMessage.buffer, 4), - [this](const std::error_code& error, size_t bytesReceived) -> void { - if(error) { - if(!handleError(error)) { - logMessage(wxString() + getHostName() + ": " + error.message()); - } - } else if(bytesReceived < 4) { - logMessage(wxString() + getHostName() + ": Could not receive header[size: " + std::to_string(bytesReceived) + "], disconnecting client."); - } else { - receive(readMessage.read()); + asio::async_read(socket, asio::buffer(readMessage.buffer, 4), [this](const std::error_code &error, size_t bytesReceived) -> void { + if (error) { + if (!handleError(error)) { + logMessage(wxString() + getHostName() + ": " + error.message()); } + } else if (bytesReceived < 4) { + logMessage(wxString() + getHostName() + ": Could not receive header[size: " + std::to_string(bytesReceived) + "], disconnecting client."); + } else { + receive(readMessage.read()); } - ); + }); } -void LivePeer::receive(uint32_t packetSize) -{ +void LivePeer::receive(uint32_t packetSize) { readMessage.buffer.resize(readMessage.position + packetSize); - asio::async_read(socket, - asio::buffer(&readMessage.buffer[readMessage.position], packetSize), - [this](const std::error_code& error, size_t bytesReceived) -> void { - if(error) { - if(!handleError(error)) { - logMessage(wxString() + getHostName() + ": " + error.message()); - } - } else if(bytesReceived < readMessage.buffer.size() - 4) { - logMessage(wxString() + getHostName() + ": Could not receive packet[size: " + std::to_string(bytesReceived) + "], disconnecting client."); - } else { - wxTheApp->CallAfter([this]() { - if(connected) { - parseEditorPacket(std::move(readMessage)); - } else { - parseLoginPacket(std::move(readMessage)); - } - receiveHeader(); - }); + asio::async_read(socket, asio::buffer(&readMessage.buffer[readMessage.position], packetSize), [this](const std::error_code &error, size_t bytesReceived) -> void { + if (error) { + if (!handleError(error)) { + logMessage(wxString() + getHostName() + ": " + error.message()); } + } else if (bytesReceived < readMessage.buffer.size() - 4) { + logMessage(wxString() + getHostName() + ": Could not receive packet[size: " + std::to_string(bytesReceived) + "], disconnecting client."); + } else { + wxTheApp->CallAfter([this]() { + if (connected) { + parseEditorPacket(std::move(readMessage)); + } else { + parseLoginPacket(std::move(readMessage)); + } + receiveHeader(); + }); } - ); + }); } -void LivePeer::send(NetworkMessage& message) -{ +void LivePeer::send(NetworkMessage &message) { memcpy(&message.buffer[0], &message.size, 4); - asio::async_write(socket, - asio::buffer(message.buffer, message.size + 4), - [this](const std::error_code& error, size_t bytesTransferred) -> void { - if(error) { - logMessage(wxString() + getHostName() + ": " + error.message()); - } + asio::async_write(socket, asio::buffer(message.buffer, message.size + 4), [this](const std::error_code &error, size_t bytesTransferred) -> void { + if (error) { + logMessage(wxString() + getHostName() + ": " + error.message()); } - ); + }); } -void LivePeer::parseLoginPacket(NetworkMessage message) -{ +void LivePeer::parseLoginPacket(NetworkMessage message) { uint8_t packetType; - while(message.position < message.buffer.size()) { + while (message.position < message.buffer.size()) { packetType = message.read(); switch (packetType) { case PACKET_HELLO_FROM_CLIENT: @@ -139,10 +122,9 @@ void LivePeer::parseLoginPacket(NetworkMessage message) } } -void LivePeer::parseEditorPacket(NetworkMessage message) -{ +void LivePeer::parseEditorPacket(NetworkMessage message) { uint8_t packetType; - while(message.position < message.buffer.size()) { + while (message.position < message.buffer.size()) { packetType = message.read(); switch (packetType) { case PACKET_REQUEST_NODES: @@ -175,15 +157,14 @@ void LivePeer::parseEditorPacket(NetworkMessage message) } } -void LivePeer::parseHello(NetworkMessage& message) -{ - if(connected) { +void LivePeer::parseHello(NetworkMessage &message) { + if (connected) { close(); return; } uint32_t rmeVersion = message.read(); - if(rmeVersion != __RME_VERSION_ID__) { + if (rmeVersion != __RME_VERSION_ID__) { NetworkMessage outMessage; outMessage.write(PACKET_KICK); outMessage.write("Wrong editor version."); @@ -194,7 +175,7 @@ void LivePeer::parseHello(NetworkMessage& message) } uint32_t netVersion = message.read(); - if(netVersion != __LIVE_NET_VERSION__) { + if (netVersion != __LIVE_NET_VERSION__) { NetworkMessage outMessage; outMessage.write(PACKET_KICK); outMessage.write("Wrong protocol version."); @@ -208,7 +189,7 @@ void LivePeer::parseHello(NetworkMessage& message) std::string nickname = message.read(); std::string password = message.read(); - if(server->getPassword() != wxString(password.c_str(), wxConvUTF8)) { + if (server->getPassword() != wxString(password.c_str(), wxConvUTF8)) { log->Message("Client tried to connect, but used the wrong password, connection refused."); close(); return; @@ -218,7 +199,7 @@ void LivePeer::parseHello(NetworkMessage& message) log->Message(name + " (" + getHostName() + ") connected."); NetworkMessage outMessage; - if(static_cast(clientVersion) != g_gui.GetCurrentVersionID()) { + if (static_cast(clientVersion) != g_gui.GetCurrentVersionID()) { outMessage.write(PACKET_CHANGE_CLIENT_VERSION); outMessage.write(g_gui.GetCurrentVersionID()); } else { @@ -227,9 +208,8 @@ void LivePeer::parseHello(NetworkMessage& message) send(outMessage); } -void LivePeer::parseReady(NetworkMessage& message) -{ - if(connected) { +void LivePeer::parseReady(NetworkMessage &message) { + if (connected) { close(); return; } @@ -238,7 +218,7 @@ void LivePeer::parseReady(NetworkMessage& message) // Find free client id clientId = server->getFreeClientId(); - if(clientId == 0) { + if (clientId == 0) { NetworkMessage outMessage; outMessage.write(PACKET_KICK); outMessage.write("Server is full."); @@ -254,7 +234,7 @@ void LivePeer::parseReady(NetworkMessage& message) NetworkMessage outMessage; outMessage.write(PACKET_HELLO_FROM_SERVER); - const Map& map = server->getEditor()->getMap(); + const Map &map = server->getEditor()->getMap(); outMessage.write(map.getName()); outMessage.write(map.getWidth()); outMessage.write(map.getHeight()); @@ -262,10 +242,9 @@ void LivePeer::parseReady(NetworkMessage& message) send(outMessage); } -void LivePeer::parseNodeRequest(NetworkMessage& message) -{ - Map& map = server->getEditor()->getMap(); - for(uint32_t nodes = message.read(); nodes != 0; --nodes) { +void LivePeer::parseNodeRequest(NetworkMessage &message) { + Map &map = server->getEditor()->getMap(); + for (uint32_t nodes = message.read(); nodes != 0; --nodes) { uint32_t ind = message.read(); int32_t ndx = ind >> 18; @@ -273,18 +252,17 @@ void LivePeer::parseNodeRequest(NetworkMessage& message) bool underground = ind & 1; QTreeNode* node = map.createLeaf(ndx * 4, ndy * 4); - if(node) { + if (node) { sendNode(clientId, node, ndx, ndy, underground ? 0xFF00 : 0x00FF); } } } -void LivePeer::parseReceiveChanges(NetworkMessage& message) -{ - Editor& editor = *server->getEditor(); +void LivePeer::parseReceiveChanges(NetworkMessage &message) { + Editor &editor = *server->getEditor(); // -1 on address since we skip the first START_NODE when sending - const std::string& data = message.read(); + const std::string &data = message.read(); mapReader.assign(reinterpret_cast(data.c_str() - 1), data.size()); BinaryNode* rootNode = mapReader.getRootNode(); @@ -293,12 +271,14 @@ void LivePeer::parseReceiveChanges(NetworkMessage& message) NetworkedAction* action = static_cast(editor.createAction(ACTION_REMOTE)); action->owner = clientId; - if(tileNode) do { - Tile* tile = readTile(tileNode, editor, nullptr); - if(tile) { - action->addChange(newd Change(tile)); - } - } while(tileNode->advance()); + if (tileNode) { + do { + Tile* tile = readTile(tileNode, editor, nullptr); + if (tile) { + action->addChange(newd Change(tile)); + } + } while (tileNode->advance()); + } mapReader.close(); editor.addAction(action); @@ -307,24 +287,20 @@ void LivePeer::parseReceiveChanges(NetworkMessage& message) g_gui.UpdateMinimap(); } -void LivePeer::parseAddHouse(NetworkMessage& message) -{ +void LivePeer::parseAddHouse(NetworkMessage &message) { } -void LivePeer::parseEditHouse(NetworkMessage& message) -{ +void LivePeer::parseEditHouse(NetworkMessage &message) { } -void LivePeer::parseRemoveHouse(NetworkMessage& message) -{ +void LivePeer::parseRemoveHouse(NetworkMessage &message) { } -void LivePeer::parseCursorUpdate(NetworkMessage& message) -{ +void LivePeer::parseCursorUpdate(NetworkMessage &message) { LiveCursor cursor = readCursor(message); cursor.id = clientId; - if(cursor.color != color) { + if (cursor.color != color) { setUsedColor(cursor.color); server->updateClientList(); } @@ -333,8 +309,7 @@ void LivePeer::parseCursorUpdate(NetworkMessage& message) g_gui.RefreshView(); } -void LivePeer::parseChatMessage(NetworkMessage& message) -{ - const std::string& chatMessage = message.read(); +void LivePeer::parseChatMessage(NetworkMessage &message) { + const std::string &chatMessage = message.read(); server->broadcastChat(name, wxstr(chatMessage)); } diff --git a/source/live_peer.h b/source/live_peer.h index d119313f..f61d546d 100644 --- a/source/live_peer.h +++ b/source/live_peer.h @@ -22,64 +22,71 @@ #include "net_connection.h" class LiveServer; -class LivePeer : public LiveSocket -{ - public: - LivePeer(LiveServer* server, asio::ip::tcp::socket socket); - ~LivePeer(); - - void close(); - bool handleError(const std::error_code& error); - - // - uint32_t getId() const { return id; } - uint32_t getClientId() const { return clientId; } - - std::string getHostName() const; - - wxColor getUsedColor() const { return color; } - void setUsedColor(const wxColor& newColor) { color = newColor; } - - // - void receiveHeader(); - void receive(uint32_t packetSize); - void send(NetworkMessage& message); - - // - void updateCursor(const Position& position) {} - - protected: - void parseLoginPacket(NetworkMessage message); - void parseEditorPacket(NetworkMessage message); - - // login packets - void parseHello(NetworkMessage& message); - void parseReady(NetworkMessage& message); - - // editor packets - void parseNodeRequest(NetworkMessage& message); - void parseReceiveChanges(NetworkMessage& message); - void parseAddHouse(NetworkMessage& message); - void parseEditHouse(NetworkMessage& message); - void parseRemoveHouse(NetworkMessage& message); - void parseCursorUpdate(NetworkMessage& message); - void parseChatMessage(NetworkMessage& message); - - // - NetworkMessage readMessage; - - LiveServer* server; - asio::ip::tcp::socket socket; - - wxColor color; - - uint32_t id; - uint32_t clientId; - - bool connected; - - friend class LiveLogTab; - friend class LiveServer; +class LivePeer : public LiveSocket { +public: + LivePeer(LiveServer* server, asio::ip::tcp::socket socket); + ~LivePeer(); + + void close(); + bool handleError(const std::error_code &error); + + // + uint32_t getId() const { + return id; + } + uint32_t getClientId() const { + return clientId; + } + + std::string getHostName() const; + + wxColor getUsedColor() const { + return color; + } + void setUsedColor(const wxColor &newColor) { + color = newColor; + } + + // + void receiveHeader(); + void receive(uint32_t packetSize); + void send(NetworkMessage &message); + + // + void updateCursor(const Position &position) { } + +protected: + void parseLoginPacket(NetworkMessage message); + void parseEditorPacket(NetworkMessage message); + + // login packets + void parseHello(NetworkMessage &message); + void parseReady(NetworkMessage &message); + + // editor packets + void parseNodeRequest(NetworkMessage &message); + void parseReceiveChanges(NetworkMessage &message); + void parseAddHouse(NetworkMessage &message); + void parseEditHouse(NetworkMessage &message); + void parseRemoveHouse(NetworkMessage &message); + void parseCursorUpdate(NetworkMessage &message); + void parseChatMessage(NetworkMessage &message); + + // + NetworkMessage readMessage; + + LiveServer* server; + asio::ip::tcp::socket socket; + + wxColor color; + + uint32_t id; + uint32_t clientId; + + bool connected; + + friend class LiveLogTab; + friend class LiveServer; }; #endif diff --git a/source/live_server.cpp b/source/live_server.cpp index fdf65204..cf019161 100644 --- a/source/live_server.cpp +++ b/source/live_server.cpp @@ -24,27 +24,25 @@ #include "editor.h" -LiveServer::LiveServer(Editor& editor) : LiveSocket(), +LiveServer::LiveServer(Editor &editor) : + LiveSocket(), clients(), acceptor(nullptr), socket(nullptr), editor(&editor), - clientIds(0), port(0), stopped(false) -{ + clientIds(0), port(0), stopped(false) { // } -LiveServer::~LiveServer() -{ +LiveServer::~LiveServer() { // } -bool LiveServer::bind() -{ - NetworkConnection& connection = NetworkConnection::getInstance(); - if(!connection.start()) { +bool LiveServer::bind() { + NetworkConnection &connection = NetworkConnection::getInstance(); + if (!connection.start()) { setLastError("The previous connection has not been terminated yet."); return false; } - auto& service = connection.get_service(); + auto &service = connection.get_service(); acceptor = std::make_shared(service); asio::ip::tcp::endpoint endpoint(asio::ip::tcp::v4(), port); @@ -52,7 +50,7 @@ bool LiveServer::bind() std::error_code error; acceptor->set_option(asio::ip::tcp::no_delay(true), error); - if(error) { + if (error) { setLastError("Error: " + error.message()); return false; } @@ -64,45 +62,42 @@ bool LiveServer::bind() return true; } -void LiveServer::close() -{ - for(auto& clientEntry : clients) { +void LiveServer::close() { + for (auto &clientEntry : clients) { delete clientEntry.second; } clients.clear(); - if(log) { + if (log) { log->Message("Server was shutdown."); log->Disconnect(); log = nullptr; } stopped = true; - if(acceptor) { + if (acceptor) { acceptor->close(); } - if(socket) { + if (socket) { socket->close(); } } -void LiveServer::acceptClient() -{ +void LiveServer::acceptClient() { static uint32_t id = 0; - if(stopped) { + if (stopped) { return; } - if(!socket) { + if (!socket) { socket = std::make_shared( NetworkConnection::getInstance().get_service() ); } - acceptor->async_accept(*socket, [this](const std::error_code& error) -> void - { - if(error) { + acceptor->async_accept(*socket, [this](const std::error_code &error) -> void { + if (error) { // } else { LivePeer* peer = new LivePeer(this, std::move(*socket)); @@ -115,15 +110,14 @@ void LiveServer::acceptClient() }); } -void LiveServer::removeClient(uint32_t id) -{ +void LiveServer::removeClient(uint32_t id) { auto it = clients.find(id); - if(it == clients.end()) { + if (it == clients.end()) { return; } const uint32_t clientId = it->second->getClientId(); - if(clientId != 0) { + if (clientId != 0) { clientIds &= ~clientId; editor->getMap().clearVisible(clientIds); } @@ -132,8 +126,7 @@ void LiveServer::removeClient(uint32_t id) updateClientList(); } -void LiveServer::updateCursor(const Position& position) -{ +void LiveServer::updateCursor(const Position &position) { LiveCursor cursor; cursor.id = 0; cursor.pos = position; @@ -146,19 +139,16 @@ void LiveServer::updateCursor(const Position& position) broadcastCursor(cursor); } -void LiveServer::updateClientList() const -{ +void LiveServer::updateClientList() const { log->UpdateClientList(clients); } -uint16_t LiveServer::getPort() const -{ +uint16_t LiveServer::getPort() const { return port; } -bool LiveServer::setPort(int32_t newPort) -{ - if(newPort < 1 || newPort > 65535) { +bool LiveServer::setPort(int32_t newPort) { + if (newPort < 1 || newPort > 65535) { setLastError("Port must be a number in the range 1-65535."); return false; } @@ -166,10 +156,9 @@ bool LiveServer::setPort(int32_t newPort) return true; } -uint32_t LiveServer::getFreeClientId() -{ - for(int32_t bit = 1; bit < (1 << 16); bit <<= 1) { - if(!testFlags(clientIds, bit)) { +uint32_t LiveServer::getFreeClientId() { + for (int32_t bit = 1; bit < (1 << 16); bit <<= 1) { + if (!testFlags(clientIds, bit)) { clientIds |= bit; return bit; } @@ -177,57 +166,54 @@ uint32_t LiveServer::getFreeClientId() return 0; } -std::string LiveServer::getHostName() const -{ - if(acceptor) { +std::string LiveServer::getHostName() const { + if (acceptor) { auto endpoint = acceptor->local_endpoint(); return endpoint.address().to_string() + ":" + std::to_string(endpoint.port()); } return "localhost"; } -void LiveServer::broadcastNodes(DirtyList& dirtyList) -{ - if(dirtyList.Empty()) { +void LiveServer::broadcastNodes(DirtyList &dirtyList) { + if (dirtyList.Empty()) { return; } - for(const auto& ind : dirtyList.GetPosList()) { + for (const auto &ind : dirtyList.GetPosList()) { int32_t ndx = ind.pos >> 18; int32_t ndy = (ind.pos >> 4) & 0x3FFF; uint32_t floors = ind.floors; QTreeNode* node = editor->getMap().getLeaf(ndx * 4, ndy * 4); - if(!node) { + if (!node) { continue; } - for(auto& clientEntry : clients) { + for (auto &clientEntry : clients) { LivePeer* peer = clientEntry.second; const uint32_t clientId = peer->getClientId(); - if(dirtyList.owner != 0 && dirtyList.owner == clientId) { + if (dirtyList.owner != 0 && dirtyList.owner == clientId) { continue; } - if(node->isVisible(clientId, true)) { + if (node->isVisible(clientId, true)) { peer->sendNode(clientId, node, ndx, ndy, floors & 0xFF00); } - if(node->isVisible(clientId, false)) { + if (node->isVisible(clientId, false)) { peer->sendNode(clientId, node, ndx, ndy, floors & 0x00FF); } } } } -void LiveServer::broadcastCursor(const LiveCursor& cursor) -{ - if(clients.empty()) { +void LiveServer::broadcastCursor(const LiveCursor &cursor) { + if (clients.empty()) { return; } - if(cursor.id != 0) { + if (cursor.id != 0) { cursors[cursor.id] = cursor; } @@ -235,17 +221,16 @@ void LiveServer::broadcastCursor(const LiveCursor& cursor) message.write(PACKET_CURSOR_UPDATE); writeCursor(message, cursor); - for(auto& clientEntry : clients) { + for (auto &clientEntry : clients) { LivePeer* peer = clientEntry.second; - if(peer->getClientId() != cursor.id) { + if (peer->getClientId() != cursor.id) { peer->send(message); } } } -void LiveServer::broadcastChat(const wxString& speaker, const wxString& chatMessage) -{ - if(clients.empty()) { +void LiveServer::broadcastChat(const wxString &speaker, const wxString &chatMessage) { + if (clients.empty()) { return; } @@ -254,16 +239,15 @@ void LiveServer::broadcastChat(const wxString& speaker, const wxString& chatMess message.write(nstr(speaker)); message.write(nstr(chatMessage)); - for(auto& clientEntry : clients) { + for (auto &clientEntry : clients) { clientEntry.second->send(message); } log->Chat(name, chatMessage); } -void LiveServer::startOperation(const wxString& operationMessage) -{ - if(clients.empty()) { +void LiveServer::startOperation(const wxString &operationMessage) { + if (clients.empty()) { return; } @@ -271,14 +255,13 @@ void LiveServer::startOperation(const wxString& operationMessage) message.write(PACKET_START_OPERATION); message.write(nstr(operationMessage)); - for(auto& clientEntry : clients) { + for (auto &clientEntry : clients) { clientEntry.second->send(message); } } -void LiveServer::updateOperation(int32_t percent) -{ - if(clients.empty()) { +void LiveServer::updateOperation(int32_t percent) { + if (clients.empty()) { return; } @@ -286,13 +269,12 @@ void LiveServer::updateOperation(int32_t percent) message.write(PACKET_UPDATE_OPERATION); message.write(percent); - for(auto& clientEntry : clients) { + for (auto &clientEntry : clients) { clientEntry.second->send(message); } } -LiveLogTab* LiveServer::createLogWindow(wxWindow* parent) -{ +LiveLogTab* LiveServer::createLogWindow(wxWindow* parent) { MapTabbook* mapTabBook = dynamic_cast(parent); ASSERT(mapTabBook); diff --git a/source/live_server.h b/source/live_server.h index fd440ac1..ac81cd51 100644 --- a/source/live_server.h +++ b/source/live_server.h @@ -26,62 +26,61 @@ class LivePeer; class LiveLogTab; class QTreeNode; -class LiveServer : public LiveSocket -{ - public: - LiveServer(Editor& editor); - ~LiveServer(); +class LiveServer : public LiveSocket { +public: + LiveServer(Editor &editor); + ~LiveServer(); - // - bool bind(); - void close(); + // + bool bind(); + void close(); - void acceptClient(); - void removeClient(uint32_t id); + void acceptClient(); + void removeClient(uint32_t id); - // - void receiveHeader() {} - void receive(uint32_t packetSize) {} - void send(NetworkMessage& message) {} + // + void receiveHeader() { } + void receive(uint32_t packetSize) { } + void send(NetworkMessage &message) { } - // - void updateCursor(const Position& position); - void updateClientList() const; + // + void updateCursor(const Position &position); + void updateClientList() const; - // - LiveLogTab* createLogWindow(wxWindow* parent); + // + LiveLogTab* createLogWindow(wxWindow* parent); - // - uint16_t getPort() const; - bool setPort(int32_t newPort); + // + uint16_t getPort() const; + bool setPort(int32_t newPort); - Editor* getEditor() const { - return editor; - } + Editor* getEditor() const { + return editor; + } - uint32_t getFreeClientId(); - std::string getHostName() const; + uint32_t getFreeClientId(); + std::string getHostName() const; - // - void broadcastNodes(DirtyList& dirtyList); - void broadcastChat(const wxString& speaker, const wxString& chatMessage); - void broadcastCursor(const LiveCursor& cursor); + // + void broadcastNodes(DirtyList &dirtyList); + void broadcastChat(const wxString &speaker, const wxString &chatMessage); + void broadcastCursor(const LiveCursor &cursor); - void startOperation(const wxString& operationMessage); - void updateOperation(int32_t percent); + void startOperation(const wxString &operationMessage); + void updateOperation(int32_t percent); - protected: - std::unordered_map clients; +protected: + std::unordered_map clients; - std::shared_ptr acceptor; - std::shared_ptr socket; + std::shared_ptr acceptor; + std::shared_ptr socket; - Editor* editor; + Editor* editor; - uint32_t clientIds; - uint16_t port; + uint32_t clientIds; + uint16_t port; - bool stopped; + bool stopped; }; #endif diff --git a/source/live_socket.cpp b/source/live_socket.cpp index 53354efe..c9afa0a9 100644 --- a/source/live_socket.cpp +++ b/source/live_socket.cpp @@ -25,27 +25,23 @@ LiveSocket::LiveSocket() : cursors(), mapReader(nullptr, 0), mapWriter(), mapVersion(MapVersion(MAP_OTBM_4, CLIENT_VERSION_NONE)), log(nullptr), - name("User"), password("") -{ + name("User"), password("") { // } -LiveSocket::~LiveSocket() -{ +LiveSocket::~LiveSocket() { // } -wxString LiveSocket::getName() const -{ +wxString LiveSocket::getName() const { return name; } -bool LiveSocket::setName(const wxString& newName) -{ - if(newName.empty()) { +bool LiveSocket::setName(const wxString &newName) { + if (newName.empty()) { setLastError("Must provide a name."); return false; - } else if(newName.length() > 32) { + } else if (newName.length() > 32) { setLastError("Name is too long."); return false; } @@ -53,14 +49,12 @@ bool LiveSocket::setName(const wxString& newName) return true; } -wxString LiveSocket::getPassword() const -{ +wxString LiveSocket::getPassword() const { return password; } -bool LiveSocket::setPassword(const wxString& newPassword) -{ - if(newPassword.length() > 32) { +bool LiveSocket::setPassword(const wxString &newPassword) { + if (newPassword.length() > 32) { setLastError("Password is too long."); return false; } @@ -68,43 +62,37 @@ bool LiveSocket::setPassword(const wxString& newPassword) return true; } -wxString LiveSocket::getLastError() const -{ +wxString LiveSocket::getLastError() const { return lastError; } -void LiveSocket::setLastError(const wxString& error) -{ +void LiveSocket::setLastError(const wxString &error) { lastError = error; } -std::string LiveSocket::getHostName() const -{ +std::string LiveSocket::getHostName() const { return "?"; } -std::vector LiveSocket::getCursorList() const -{ +std::vector LiveSocket::getCursorList() const { std::vector cursorList; - for(auto& cursorEntry : cursors) { + for (auto &cursorEntry : cursors) { cursorList.push_back(cursorEntry.second); } return cursorList; } -void LiveSocket::logMessage(const wxString& message) -{ +void LiveSocket::logMessage(const wxString &message) { wxTheApp->CallAfter([this, message]() { - if(log) { + if (log) { log->Message(message); } }); } -void LiveSocket::receiveNode(NetworkMessage& message, Editor& editor, Action* action, int32_t ndx, int32_t ndy, bool underground) -{ +void LiveSocket::receiveNode(NetworkMessage &message, Editor &editor, Action* action, int32_t ndx, int32_t ndy, bool underground) { QTreeNode* node = editor.getMap().getLeaf(ndx * 4, ndy * 4); - if(!node) { + if (!node) { log->Message("Warning: Received update for unknown tile (" + std::to_string(ndx * 4) + "/" + std::to_string(ndy * 4) + "/" + (underground ? "true" : "false") + ")"); return; } @@ -113,22 +101,21 @@ void LiveSocket::receiveNode(NetworkMessage& message, Editor& editor, Action* ac node->setVisible(underground, true); uint16_t floorBits = message.read(); - if(floorBits == 0) { + if (floorBits == 0) { return; } - for(uint_fast8_t z = 0; z < 16; ++z) { - if(testFlags(floorBits, static_cast(1) << z)) { + for (uint_fast8_t z = 0; z < 16; ++z) { + if (testFlags(floorBits, static_cast(1) << z)) { receiveFloor(message, editor, action, ndx, ndy, z, node, node->getFloor(z)); } } } -void LiveSocket::sendNode(uint32_t clientId, QTreeNode* node, int32_t ndx, int32_t ndy, uint32_t floorMask) -{ +void LiveSocket::sendNode(uint32_t clientId, QTreeNode* node, int32_t ndx, int32_t ndy, uint32_t floorMask) { bool underground; - if(floorMask & 0xFF00) { - if(floorMask & 0x00FF) { + if (floorMask & 0xFF00) { + if (floorMask & 0x00FF) { underground = false; } else { underground = true; @@ -144,22 +131,22 @@ void LiveSocket::sendNode(uint32_t clientId, QTreeNode* node, int32_t ndx, int32 message.write(PACKET_NODE); message.write((ndx << 18) | (ndy << 4) | ((floorMask & 0xFF00) ? 1 : 0)); - if(!node) { + if (!node) { message.write(0x00); } else { Floor** floors = node->getFloors(); uint16_t sendMask = 0; - for(uint32_t z = 0; z < 16; ++z) { + for (uint32_t z = 0; z < 16; ++z) { uint32_t bit = 1 << z; - if(floors[z] && testFlags(floorMask, bit)) { + if (floors[z] && testFlags(floorMask, bit)) { sendMask |= bit; } } message.write(sendMask); - for(uint32_t z = 0; z < 16; ++z) { - if(testFlags(sendMask, static_cast(1) << z)) { + for (uint32_t z = 0; z < 16; ++z) { + if (testFlags(sendMask, static_cast(1) << z)) { sendFloor(message, floors[z]); } } @@ -168,14 +155,13 @@ void LiveSocket::sendNode(uint32_t clientId, QTreeNode* node, int32_t ndx, int32 send(message); } -void LiveSocket::receiveFloor(NetworkMessage& message, Editor& editor, Action* action, int32_t ndx, int32_t ndy, int32_t z, QTreeNode* node, Floor* floor) -{ - Map& map = editor.getMap(); +void LiveSocket::receiveFloor(NetworkMessage &message, Editor &editor, Action* action, int32_t ndx, int32_t ndy, int32_t z, QTreeNode* node, Floor* floor) { + Map &map = editor.getMap(); uint16_t tileBits = message.read(); - if(tileBits == 0) { - for(uint_fast8_t x = 0; x < 4; ++x) { - for(uint_fast8_t y = 0; y < 4; ++y) { + if (tileBits == 0) { + for (uint_fast8_t x = 0; x < 4; ++x) { + for (uint_fast8_t y = 0; y < 4; ++y) { action->addChange(new Change(map.allocator(node->createTile(ndx * 4 + x, ndy * 4 + y, z)))); } } @@ -183,19 +169,19 @@ void LiveSocket::receiveFloor(NetworkMessage& message, Editor& editor, Action* a } // -1 on address since we skip the first START_NODE when sending - const std::string& data = message.read(); + const std::string &data = message.read(); mapReader.assign(reinterpret_cast(data.c_str() - 1), data.size()); BinaryNode* rootNode = mapReader.getRootNode(); BinaryNode* tileNode = rootNode->getChild(); Position position(0, 0, z); - for(uint_fast8_t x = 0; x < 4; ++x) { - for(uint_fast8_t y = 0; y < 4; ++y) { + for (uint_fast8_t x = 0; x < 4; ++x) { + for (uint_fast8_t y = 0; y < 4; ++y) { position.x = (ndx * 4) + x; position.y = (ndy * 4) + y; - if(testFlags(tileBits, static_cast(1) << ((x * 4) + y))) { + if (testFlags(tileBits, static_cast(1) << ((x * 4) + y))) { receiveTile(tileNode, editor, action, &position); tileNode->advance(); } else { @@ -206,30 +192,29 @@ void LiveSocket::receiveFloor(NetworkMessage& message, Editor& editor, Action* a mapReader.close(); } -void LiveSocket::sendFloor(NetworkMessage& message, Floor* floor) -{ +void LiveSocket::sendFloor(NetworkMessage &message, Floor* floor) { uint16_t tileBits = 0; - for(uint_fast8_t x = 0; x < 4; ++x) { - for(uint_fast8_t y = 0; y < 4; ++y) { + for (uint_fast8_t x = 0; x < 4; ++x) { + for (uint_fast8_t y = 0; y < 4; ++y) { uint_fast8_t index = (x * 4) + y; Tile* tile = floor->locs[index].get(); - if(tile && tile->size() > 0) { + if (tile && tile->size() > 0) { tileBits |= (1 << index); } } } message.write(tileBits); - if(tileBits == 0) { + if (tileBits == 0) { return; } mapWriter.reset(); - for(uint_fast8_t x = 0; x < 4; ++x) { - for(uint_fast8_t y = 0; y < 4; ++y) { + for (uint_fast8_t x = 0; x < 4; ++x) { + for (uint_fast8_t y = 0; y < 4; ++y) { uint_fast8_t index = (x * 4) + y; - if(testFlags(tileBits, static_cast(1) << index)) { + if (testFlags(tileBits, static_cast(1) << index)) { sendTile(mapWriter, floor->locs[index].get(), nullptr); } } @@ -243,37 +228,35 @@ void LiveSocket::sendFloor(NetworkMessage& message, Floor* floor) message.write(stream); } -void LiveSocket::receiveTile(BinaryNode* node, Editor& editor, Action* action, const Position* position) -{ +void LiveSocket::receiveTile(BinaryNode* node, Editor &editor, Action* action, const Position* position) { ASSERT(node != nullptr); Tile* tile = readTile(node, editor, position); - if(tile) { + if (tile) { action->addChange(newd Change(tile)); } } -void LiveSocket::sendTile(MemoryNodeFileWriteHandle& writer, Tile* tile, const Position* position) -{ +void LiveSocket::sendTile(MemoryNodeFileWriteHandle &writer, Tile* tile, const Position* position) { writer.addNode(tile->isHouseTile() ? OTBM_HOUSETILE : OTBM_TILE); - if(position) { + if (position) { writer.addU16(position->x); writer.addU16(position->y); writer.addU8(position->z); } - if(tile->isHouseTile()) { + if (tile->isHouseTile()) { writer.addU32(tile->getHouseID()); } - if(tile->getMapFlags()) { + if (tile->getMapFlags()) { writer.addByte(OTBM_ATTR_TILE_FLAGS); writer.addU32(tile->getMapFlags()); } Item* ground = tile->ground; - if(ground) { - if(ground->isComplex()) { + if (ground) { + if (ground->isComplex()) { ground->serializeItemNode_OTBM(mapVersion, writer); } else { writer.addByte(OTBM_ATTR_ITEM); @@ -281,111 +264,117 @@ void LiveSocket::sendTile(MemoryNodeFileWriteHandle& writer, Tile* tile, const P } } - for(Item* item : tile->items) { + for (Item* item : tile->items) { item->serializeItemNode_OTBM(mapVersion, writer); } writer.endNode(); } -Tile* LiveSocket::readTile(BinaryNode* node, Editor& editor, const Position* position) -{ +Tile* LiveSocket::readTile(BinaryNode* node, Editor &editor, const Position* position) { ASSERT(node != nullptr); - Map& map = editor.getMap(); + Map &map = editor.getMap(); uint8_t tileType; node->getByte(tileType); - if(tileType != OTBM_TILE && tileType != OTBM_HOUSETILE) { + if (tileType != OTBM_TILE && tileType != OTBM_HOUSETILE) { return nullptr; } Position pos; - if(position) { + if (position) { pos = *position; } else { - uint16_t x; node->getU16(x); pos.x = x; - uint16_t y; node->getU16(y); pos.y = y; - uint8_t z; node->getU8(z); pos.z = z; + uint16_t x; + node->getU16(x); + pos.x = x; + uint16_t y; + node->getU16(y); + pos.y = y; + uint8_t z; + node->getU8(z); + pos.z = z; } Tile* tile = map.allocator( map.createTileL(pos) ); - if(tileType == OTBM_HOUSETILE) { + if (tileType == OTBM_HOUSETILE) { uint32_t houseId; - if(!node->getU32(houseId)) { - //warning("House tile without house data, discarding tile"); + if (!node->getU32(houseId)) { + // warning("House tile without house data, discarding tile"); delete tile; return nullptr; } - if(houseId) { + if (houseId) { House* house = map.houses.getHouse(houseId); - if(house) { + if (house) { tile->setHouse(house); } } else { - //warning("Invalid house id from tile %d:%d:%d", pos.x, pos.y, pos.z); + // warning("Invalid house id from tile %d:%d:%d", pos.x, pos.y, pos.z); } } uint8_t attribute; - while(node->getU8(attribute)) { + while (node->getU8(attribute)) { switch (attribute) { case OTBM_ATTR_TILE_FLAGS: { uint32_t flags = 0; - if(!node->getU32(flags)) { - //warning("Invalid tile flags of tile on %d:%d:%d", pos.x, pos.y, pos.z); + if (!node->getU32(flags)) { + // warning("Invalid tile flags of tile on %d:%d:%d", pos.x, pos.y, pos.z); } tile->setMapFlags(flags); break; } case OTBM_ATTR_ITEM: { Item* item = Item::Create_OTBM(mapVersion, node); - if(!item) { - //warning("Invalid item at tile %d:%d:%d", pos.x, pos.y, pos.z); + if (!item) { + // warning("Invalid item at tile %d:%d:%d", pos.x, pos.y, pos.z); } tile->addItem(item); break; } default: - //warning("Unknown tile attribute at %d:%d:%d", pos.x, pos.y, pos.z); + // warning("Unknown tile attribute at %d:%d:%d", pos.x, pos.y, pos.z); break; } } - //for(BinaryNode* itemNode = node->getChild(); itemNode; itemNode->advance()) { + // for(BinaryNode* itemNode = node->getChild(); itemNode; itemNode->advance()) { BinaryNode* itemNode = node->getChild(); - if(itemNode) do { - uint8_t itemType; - if(!itemNode->getByte(itemType)) { - //warning("Unknown item type %d:%d:%d", pos.x, pos.y, pos.z); - delete tile; - return nullptr; - } + if (itemNode) { + do { + uint8_t itemType; + if (!itemNode->getByte(itemType)) { + // warning("Unknown item type %d:%d:%d", pos.x, pos.y, pos.z); + delete tile; + return nullptr; + } - if(itemType == OTBM_ITEM) { - Item* item = Item::Create_OTBM(mapVersion, itemNode); - if(item) { - if(!item->unserializeItemNode_OTBM(mapVersion, itemNode)) { - //warning("Couldn't unserialize item attributes at %d:%d:%d", pos.x, pos.y, pos.z); + if (itemType == OTBM_ITEM) { + Item* item = Item::Create_OTBM(mapVersion, itemNode); + if (item) { + if (!item->unserializeItemNode_OTBM(mapVersion, itemNode)) { + // warning("Couldn't unserialize item attributes at %d:%d:%d", pos.x, pos.y, pos.z); + } + tile->addItem(item); } - tile->addItem(item); + } else { + // warning("Unknown type of tile child node"); } - } else { - //warning("Unknown type of tile child node"); - } - //} - } while(itemNode->advance()); + //} + } while (itemNode->advance()); + } return tile; } -LiveCursor LiveSocket::readCursor(NetworkMessage& message) -{ +LiveCursor LiveSocket::readCursor(NetworkMessage &message) { LiveCursor cursor; cursor.id = message.read(); @@ -399,8 +388,7 @@ LiveCursor LiveSocket::readCursor(NetworkMessage& message) return cursor; } -void LiveSocket::writeCursor(NetworkMessage& message, const LiveCursor& cursor) -{ +void LiveSocket::writeCursor(NetworkMessage &message, const LiveCursor &cursor) { message.write(cursor.id); message.write(cursor.color.Red()); message.write(cursor.color.Green()); diff --git a/source/live_socket.h b/source/live_socket.h index 991ccc6e..d7fab550 100644 --- a/source/live_socket.h +++ b/source/live_socket.h @@ -30,74 +30,72 @@ class LiveLogTab; class Action; -struct LiveCursor -{ +struct LiveCursor { uint32_t id; wxColor color; Position pos; }; -class LiveSocket -{ - public: - LiveSocket(); - virtual ~LiveSocket(); +class LiveSocket { +public: + LiveSocket(); + virtual ~LiveSocket(); - // - wxString getName() const; - bool setName(const wxString& newName); + // + wxString getName() const; + bool setName(const wxString &newName); - wxString getPassword() const; - bool setPassword(const wxString& newPassword); + wxString getPassword() const; + bool setPassword(const wxString &newPassword); - wxString getLastError() const; - void setLastError(const wxString& error); + wxString getLastError() const; + void setLastError(const wxString &error); - std::string getHostName() const; - std::vector getCursorList() const; + std::string getHostName() const; + std::vector getCursorList() const; - // - void logMessage(const wxString& message); + // + void logMessage(const wxString &message); - // - virtual void receiveHeader() = 0; - virtual void receive(uint32_t packetSize) = 0; - virtual void send(NetworkMessage& message) = 0; + // + virtual void receiveHeader() = 0; + virtual void receive(uint32_t packetSize) = 0; + virtual void send(NetworkMessage &message) = 0; - // - virtual void updateCursor(const Position& position) = 0; + // + virtual void updateCursor(const Position &position) = 0; - protected: - // receive / send methods - void receiveNode(NetworkMessage& message, Editor& editor, Action* action, int32_t ndx, int32_t ndy, bool underground); - void sendNode(uint32_t clientId, QTreeNode* node, int32_t ndx, int32_t ndy, uint32_t floorMask); +protected: + // receive / send methods + void receiveNode(NetworkMessage &message, Editor &editor, Action* action, int32_t ndx, int32_t ndy, bool underground); + void sendNode(uint32_t clientId, QTreeNode* node, int32_t ndx, int32_t ndy, uint32_t floorMask); - void receiveFloor(NetworkMessage& message, Editor& editor, Action* action, int32_t ndx, int32_t ndy, int32_t z, QTreeNode* node, Floor* floor); - void sendFloor(NetworkMessage& message, Floor* floor); + void receiveFloor(NetworkMessage &message, Editor &editor, Action* action, int32_t ndx, int32_t ndy, int32_t z, QTreeNode* node, Floor* floor); + void sendFloor(NetworkMessage &message, Floor* floor); - void receiveTile(BinaryNode* node, Editor& editor, Action* action, const Position* position); - void sendTile(MemoryNodeFileWriteHandle& writer, Tile* tile, const Position* position); + void receiveTile(BinaryNode* node, Editor &editor, Action* action, const Position* position); + void sendTile(MemoryNodeFileWriteHandle &writer, Tile* tile, const Position* position); - // read / write types - Tile* readTile(BinaryNode* node, Editor& editor, const Position* position); + // read / write types + Tile* readTile(BinaryNode* node, Editor &editor, const Position* position); - LiveCursor readCursor(NetworkMessage& message); - void writeCursor(NetworkMessage& message, const LiveCursor& cursor); + LiveCursor readCursor(NetworkMessage &message); + void writeCursor(NetworkMessage &message, const LiveCursor &cursor); - // - std::unordered_map cursors; + // + std::unordered_map cursors; - MemoryNodeFileReadHandle mapReader; - MemoryNodeFileWriteHandle mapWriter; - VirtualIOMap mapVersion; + MemoryNodeFileReadHandle mapReader; + MemoryNodeFileWriteHandle mapWriter; + VirtualIOMap mapVersion; - LiveLogTab* log; + LiveLogTab* log; - wxString name; - wxString password; - wxString lastError; + wxString name; + wxString password; + wxString lastError; - friend class LiveLogTab; + friend class LiveLogTab; }; #endif diff --git a/source/live_tab.cpp b/source/live_tab.cpp index c7adf39d..5e6e644f 100644 --- a/source/live_tab.cpp +++ b/source/live_tab.cpp @@ -21,14 +21,14 @@ #include "live_socket.h" #include "live_peer.h" -class myGrid : public wxGrid -{ +class myGrid : public wxGrid { public: - myGrid(wxWindow* parent, wxWindowID id, wxPoint pos, wxSize size) : wxGrid(parent, id, pos, size) {} - virtual ~myGrid() {} + myGrid(wxWindow* parent, wxWindowID id, wxPoint pos, wxSize size) : + wxGrid(parent, id, pos, size) { } + virtual ~myGrid() { } - void DrawCellHighlight(wxDC& dc, const wxGridCellAttr* attr) { - //wxGrid::DrawCellHighlight(dc, attr); + void DrawCellHighlight(wxDC &dc, const wxGridCellAttr* attr) { + // wxGrid::DrawCellHighlight(dc, attr); } DECLARE_CLASS(myGrid); @@ -37,15 +37,14 @@ class myGrid : public wxGrid IMPLEMENT_CLASS(myGrid, wxGrid) BEGIN_EVENT_TABLE(LiveLogTab, wxPanel) - EVT_TEXT(LIVE_CHAT_TEXTBOX, LiveLogTab::OnChat) +EVT_TEXT(LIVE_CHAT_TEXTBOX, LiveLogTab::OnChat) END_EVENT_TABLE() LiveLogTab::LiveLogTab(MapTabbook* aui, LiveSocket* server) : EditorTab(), wxPanel(aui), aui(aui), - socket(server) -{ + socket(server) { wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); wxPanel* splitter = newd wxPanel(this); @@ -64,8 +63,8 @@ LiveLogTab::LiveLogTab(MapTabbook* aui, LiveSocket* server) : log->DisableDragColSize(); log->SetSelectionMode(wxGrid::wxGridSelectRows); log->SetRowLabelSize(0); - //log->SetColLabelSize(0); - //log->EnableGridLines(false); + // log->SetColLabelSize(0); + // log->EnableGridLines(false); log->EnableEditing(false); log->SetColLabelValue(0, "Time"); @@ -105,7 +104,7 @@ LiveLogTab::LiveLogTab(MapTabbook* aui, LiveSocket* server) : user_list->SetColLabelValue(2, "Name"); user_list->SetColSize(2, 200); - //user_list->GetGridWindow()-> + // user_list->GetGridWindow()-> // Finalize SetSizerAndFit(topsizer); @@ -114,42 +113,38 @@ LiveLogTab::LiveLogTab(MapTabbook* aui, LiveSocket* server) : split_sizer->Add(left_pane, wxSizerFlags(1).Expand()); split_sizer->Add(user_list, wxSizerFlags(0).Expand()); splitter->SetSizerAndFit(split_sizer); - //splitter->SplitVertically(left_pane, user_list, max(this->GetSize().GetWidth() - 200, 0)); + // splitter->SplitVertically(left_pane, user_list, max(this->GetSize().GetWidth() - 200, 0)); aui->AddTab(this, true); } -LiveLogTab::~LiveLogTab() -{ - +LiveLogTab::~LiveLogTab() { } -wxString LiveLogTab::GetTitle() const -{ - if(socket) { +wxString LiveLogTab::GetTitle() const { + if (socket) { return "Live Log - " + socket->getHostName(); } return "Live Log - Disconnected"; } -void LiveLogTab::Disconnect() -{ +void LiveLogTab::Disconnect() { socket->log = nullptr; input->SetWindowStyle(input->GetWindowStyle() | wxTE_READONLY); socket = nullptr; Refresh(); } -wxString format00(wxDateTime::wxDateTime_t t) -{ +wxString format00(wxDateTime::wxDateTime_t t) { wxString str; - if(t < 10) str << "0"; + if (t < 10) { + str << "0"; + } str << t; return str; } -void LiveLogTab::Message(const wxString& str) -{ +void LiveLogTab::Message(const wxString &str) { wxDateTime t = wxDateTime::Now(); wxString time, speaker; time << format00(t.GetHour()) << ":" @@ -165,8 +160,7 @@ void LiveLogTab::Message(const wxString& str) log->SetCellValue(n, 2, str); } -void LiveLogTab::Chat(const wxString& speaker, const wxString& str) -{ +void LiveLogTab::Chat(const wxString &speaker, const wxString &str) { wxDateTime t = wxDateTime::Now(); wxString time; time << format00(t.GetHour()) << ":" @@ -180,34 +174,27 @@ void LiveLogTab::Chat(const wxString& speaker, const wxString& str) log->SetCellValue(n, 2, str); } -void LiveLogTab::OnChat(wxCommandEvent& evt) -{ - +void LiveLogTab::OnChat(wxCommandEvent &evt) { } -void LiveLogTab::OnResizeChat(wxSizeEvent& evt) -{ +void LiveLogTab::OnResizeChat(wxSizeEvent &evt) { log->SetColSize(2, log->GetSize().GetWidth() - 160); } -void LiveLogTab::OnResizeClientList(wxSizeEvent& evt) -{ +void LiveLogTab::OnResizeClientList(wxSizeEvent &evt) { } -void LiveLogTab::OnSelectChatbox(wxFocusEvent& evt) -{ +void LiveLogTab::OnSelectChatbox(wxFocusEvent &evt) { g_gui.DisableHotkeys(); } -void LiveLogTab::OnDeselectChatbox(wxFocusEvent& evt) -{ +void LiveLogTab::OnDeselectChatbox(wxFocusEvent &evt) { g_gui.EnableHotkeys(); } -void LiveLogTab::UpdateClientList(const std::unordered_map& updatedClients) -{ +void LiveLogTab::UpdateClientList(const std::unordered_map &updatedClients) { // Delete old rows - if(user_list->GetNumberRows() > 0) { + if (user_list->GetNumberRows() > 0) { user_list->DeleteRows(0, user_list->GetNumberRows()); } @@ -215,7 +202,7 @@ void LiveLogTab::UpdateClientList(const std::unordered_map& user_list->AppendRows(clients.size()); int32_t i = 0; - for(auto& clientEntry : clients) { + for (auto &clientEntry : clients) { LivePeer* peer = clientEntry.second; user_list->SetCellBackgroundColour(i, 0, peer->getUsedColor()); user_list->SetCellValue(i, 1, i2ws((peer->getClientId() >> 1) + 1)); diff --git a/source/live_tab.h b/source/live_tab.h index e336120b..920c967b 100644 --- a/source/live_tab.h +++ b/source/live_tab.h @@ -35,25 +35,31 @@ class LiveLogTab : public EditorTab, public wxPanel { LiveLogTab(MapTabbook* aui, LiveSocket* socket); ~LiveLogTab(); - void Message(const wxString& str); - void Chat(const wxString& speaker, const wxString& str); + void Message(const wxString &str); + void Chat(const wxString &speaker, const wxString &str); - virtual wxWindow* GetWindow() const {return (wxPanel*)this;} + virtual wxWindow* GetWindow() const { + return (wxPanel*)this; + } virtual wxString GetTitle() const; - bool IsConnected() const {return socket != nullptr;} + bool IsConnected() const { + return socket != nullptr; + } void Disconnect(); - LiveSocket* GetSocket() {return socket;} + LiveSocket* GetSocket() { + return socket; + } - void UpdateClientList(const std::unordered_map& updatedClients); + void UpdateClientList(const std::unordered_map &updatedClients); - void OnSelectChatbox(wxFocusEvent& evt); - void OnDeselectChatbox(wxFocusEvent& evt); + void OnSelectChatbox(wxFocusEvent &evt); + void OnDeselectChatbox(wxFocusEvent &evt); - void OnChat(wxCommandEvent& evt); - void OnResizeChat(wxSizeEvent& evt); - void OnResizeClientList(wxSizeEvent& evt); + void OnChat(wxCommandEvent &evt); + void OnResizeChat(wxSizeEvent &evt); + void OnResizeClientList(wxSizeEvent &evt); protected: MapTabbook* aui; diff --git a/source/main.h b/source/main.h index 6b44e20c..7b985622 100644 --- a/source/main.h +++ b/source/main.h @@ -19,27 +19,29 @@ #define RME_MAIN_H_ #ifdef _WIN32 -# define WIN32_LEAN_AND_MEAN -# ifdef _WIN32_WINNT -# undef _WIN32_WINNT -# endif -# define _WIN32_WINNT 0x0501 + #define WIN32_LEAN_AND_MEAN + #ifdef _WIN32_WINNT + #undef _WIN32_WINNT + #endif + #define _WIN32_WINNT 0x0501 #endif #ifdef DEBUG_MEM -#define _CRTDBG_MAP_ALLOC + #define _CRTDBG_MAP_ALLOC -#pragma warning(disable: 4291) -_Ret_bytecap_(_Size) inline void * __CRTDECL operator new(size_t _Size, const char* file, int line) - { return ::operator new(_Size, _NORMAL_BLOCK, file, line); } -_Ret_bytecap_(_Size) inline void* __CRTDECL operator new[](size_t _Size, const char* file, int line) - { return ::operator new[](_Size, _NORMAL_BLOCK, file, line); } -#define newd new(__FILE__, __LINE__) + #pragma warning(disable : 4291) +_Ret_bytecap_(_Size) inline void* __CRTDECL operator new(size_t _Size, const char* file, int line) { + return ::operator new(_Size, _NORMAL_BLOCK, file, line); +} +_Ret_bytecap_(_Size) inline void* __CRTDECL operator new[](size_t _Size, const char* file, int line) { + return ::operator new[](_Size, _NORMAL_BLOCK, file, line); +} + #define newd new (__FILE__, __LINE__) #else -#define newd new + #define newd new #endif @@ -51,7 +53,7 @@ _Ret_bytecap_(_Size) inline void* __CRTDECL operator new[](size_t _Size, const c #include #ifndef WX_PRECOMP -# include + #include #endif #include #include @@ -103,8 +105,8 @@ _Ret_bytecap_(_Size) inline void* __CRTDECL operator new[](size_t _Size, const c // Libarchive, for OTGZ #if OTGZ_SUPPORT > 0 -#include -#include + #include + #include #endif // This has annoyed me one time too many @@ -113,15 +115,15 @@ _Ret_bytecap_(_Size) inline void* __CRTDECL operator new[](size_t _Size, const c #include #define _MSG(msg) !bool(msg) #ifdef __DEBUG__ -# define ASSERT assert + #define ASSERT assert #else -# define ASSERT(...) + #define ASSERT(...) #endif // The complete STL ?, well, almost ;) #include #ifdef _WIN32 - #include + #include #endif #include #include @@ -155,9 +157,9 @@ typedef wxFileName FileName; #include "rme_forward_declarations.h" #if wxCHECK_VERSION(3, 1, 0) - #define FROM_DIP(widget, size) widget->FromDIP(size) + #define FROM_DIP(widget, size) widget->FromDIP(size) #else - #define FROM_DIP(widget, size) size + #define FROM_DIP(widget, size) size #endif #endif diff --git a/source/main_menubar.cpp b/source/main_menubar.cpp index 5f0e65fc..18a2a42e 100644 --- a/source/main_menubar.cpp +++ b/source/main_menubar.cpp @@ -41,13 +41,15 @@ BEGIN_EVENT_TABLE(MainMenuBar, wxEvtHandler) END_EVENT_TABLE() -MainMenuBar::MainMenuBar(MainFrame *frame) : frame(frame) -{ +MainMenuBar::MainMenuBar(MainFrame* frame) : + frame(frame) { using namespace MenuBar; checking_programmaticly = false; #define MAKE_ACTION(id, kind, handler) actions[#id] = new MenuBar::Action(#id, id, kind, wxCommandEventFunction(&MainMenuBar::handler)) -#define MAKE_SET_ACTION(id, kind, setting_, handler) actions[#id] = new MenuBar::Action(#id, id, kind, wxCommandEventFunction(&MainMenuBar::handler)); actions[#id].setting = setting_ +#define MAKE_SET_ACTION(id, kind, setting_, handler) \ + actions[#id] = new MenuBar::Action(#id, id, kind, wxCommandEventFunction(&MainMenuBar::handler)); \ + actions[#id].setting = setting_ MAKE_ACTION(NEW, wxITEM_NORMAL, OnNew); MAKE_ACTION(OPEN, wxITEM_NORMAL, OnOpen); @@ -63,7 +65,7 @@ MainMenuBar::MainMenuBar(MainFrame *frame) : frame(frame) MAKE_ACTION(EXPORT_MINIMAP, wxITEM_NORMAL, OnExportMinimap); MAKE_ACTION(RELOAD_DATA, wxITEM_NORMAL, OnReloadDataFiles); - //MAKE_ACTION(RECENT_FILES, wxITEM_NORMAL, OnRecent); + // MAKE_ACTION(RECENT_FILES, wxITEM_NORMAL, OnRecent); MAKE_ACTION(PREFERENCES, wxITEM_NORMAL, OnPreferences); MAKE_ACTION(EXIT, wxITEM_NORMAL, OnQuit); @@ -197,17 +199,16 @@ MainMenuBar::MainMenuBar(MainFrame *frame) : frame(frame) MAKE_ACTION(GOTO_WEBSITE, wxITEM_NORMAL, OnGotoWebsite); MAKE_ACTION(ABOUT, wxITEM_NORMAL, OnAbout); - // A deleter, this way the frame does not need // to bother deleting us. - class CustomMenuBar : public wxMenuBar - { + class CustomMenuBar : public wxMenuBar { public: - CustomMenuBar(MainMenuBar* mb) : mb(mb) {} - ~CustomMenuBar() - { + CustomMenuBar(MainMenuBar* mb) : + mb(mb) { } + ~CustomMenuBar() { delete mb; } + private: MainMenuBar* mb; }; @@ -217,96 +218,95 @@ MainMenuBar::MainMenuBar(MainFrame *frame) : frame(frame) // Tie all events to this handler! - for(std::map::iterator ai = actions.begin(); ai != actions.end(); ++ai) { - frame->Connect(MAIN_FRAME_MENU + ai->second->id, wxEVT_COMMAND_MENU_SELECTED, - (wxObjectEventFunction)(wxEventFunction)(ai->second->handler), nullptr, this); + for (std::map::iterator ai = actions.begin(); ai != actions.end(); ++ai) { + frame->Connect(MAIN_FRAME_MENU + ai->second->id, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction)(wxEventFunction)(ai->second->handler), nullptr, this); } - for(size_t i = 0; i < 10; ++i) { - frame->Connect(recentFiles.GetBaseId() + i, wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(MainMenuBar::OnOpenRecent), nullptr, this); + for (size_t i = 0; i < 10; ++i) { + frame->Connect(recentFiles.GetBaseId() + i, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainMenuBar::OnOpenRecent), nullptr, this); } } -MainMenuBar::~MainMenuBar() -{ +MainMenuBar::~MainMenuBar() { // Don't need to delete menubar, it's owned by the frame - for(std::map::iterator ai = actions.begin(); ai != actions.end(); ++ai) { + for (std::map::iterator ai = actions.begin(); ai != actions.end(); ++ai) { delete ai->second; } } -namespace OnMapRemoveItems -{ - struct RemoveItemCondition - { +namespace OnMapRemoveItems { + struct RemoveItemCondition { RemoveItemCondition(uint16_t itemId) : itemId(itemId) { } uint16_t itemId; - bool operator()(Map& map, Item* item, int64_t removed, int64_t done) { - if(done % 0x8000 == 0) + bool operator()(Map &map, Item* item, int64_t removed, int64_t done) { + if (done % 0x8000 == 0) { g_gui.SetLoadDone((uint32_t)(100 * done / map.getTileCount())); + } return item->getID() == itemId && !item->isComplex(); } }; } -void MainMenuBar::EnableItem(MenuBar::ActionID id, bool enable) -{ - std::map >::iterator fi = items.find(id); - if(fi == items.end()) +void MainMenuBar::EnableItem(MenuBar::ActionID id, bool enable) { + std::map>::iterator fi = items.find(id); + if (fi == items.end()) { return; + } - std::list& li = fi->second; + std::list &li = fi->second; - for(std::list::iterator i = li.begin(); i !=li.end(); ++i) + for (std::list::iterator i = li.begin(); i != li.end(); ++i) { (*i)->Enable(enable); + } } -void MainMenuBar::CheckItem(MenuBar::ActionID id, bool enable) -{ - std::map >::iterator fi = items.find(id); - if(fi == items.end()) +void MainMenuBar::CheckItem(MenuBar::ActionID id, bool enable) { + std::map>::iterator fi = items.find(id); + if (fi == items.end()) { return; + } - std::list& li = fi->second; + std::list &li = fi->second; checking_programmaticly = true; - for(std::list::iterator i = li.begin(); i !=li.end(); ++i) + for (std::list::iterator i = li.begin(); i != li.end(); ++i) { (*i)->Check(enable); + } checking_programmaticly = false; } -bool MainMenuBar::IsItemChecked(MenuBar::ActionID id) const -{ - std::map >::const_iterator fi = items.find(id); - if(fi == items.end()) +bool MainMenuBar::IsItemChecked(MenuBar::ActionID id) const { + std::map>::const_iterator fi = items.find(id); + if (fi == items.end()) { return false; + } - const std::list& li = fi->second; + const std::list &li = fi->second; - for(std::list::const_iterator i = li.begin(); i !=li.end(); ++i) - if((*i)->IsChecked()) + for (std::list::const_iterator i = li.begin(); i != li.end(); ++i) { + if ((*i)->IsChecked()) { return true; + } + } return false; } -void MainMenuBar::Update() -{ +void MainMenuBar::Update() { using namespace MenuBar; // This updates all buttons and sets them to proper enabled/disabled state bool enable = !g_gui.IsWelcomeDialogShown(); menubar->Enable(enable); - if (!enable) { - return; + if (!enable) { + return; } Editor* editor = g_gui.GetCurrentEditor(); - if(editor) { + if (editor) { EnableItem(UNDO, editor->canUndo()); EnableItem(REDO, editor->canRedo()); EnableItem(PASTE, editor->copybuffer.canPaste()); @@ -383,9 +383,10 @@ void MainMenuBar::Update() EnableItem(ZOOM_OUT, has_map); EnableItem(ZOOM_NORMAL, has_map); - if(has_map) + if (has_map) { CheckItem(SHOW_SPAWNS_MONSTER, g_settings.getBoolean(Config::SHOW_SPAWNS_MONSTER)); - CheckItem(SHOW_SPAWNS_NPC, g_settings.getBoolean(Config::SHOW_SPAWNS_NPC)); + } + CheckItem(SHOW_SPAWNS_NPC, g_settings.getBoolean(Config::SHOW_SPAWNS_NPC)); EnableItem(WIN_MINIMAP, loaded); EnableItem(NEW_PALETTE, loaded); @@ -408,8 +409,7 @@ void MainMenuBar::Update() UpdateIndicatorsMenu(); } -void MainMenuBar::LoadValues() -{ +void MainMenuBar::LoadValues() { using namespace MenuBar; CheckItem(VIEW_TOOLBARS_BRUSHES, g_settings.getBoolean(Config::SHOW_TOOLBAR_BRUSHES)); @@ -420,14 +420,15 @@ void MainMenuBar::LoadValues() CheckItem(SELECT_MODE_COMPENSATE, g_settings.getBoolean(Config::COMPENSATED_SELECT)); - if(IsItemChecked(MenuBar::SELECT_MODE_CURRENT)) + if (IsItemChecked(MenuBar::SELECT_MODE_CURRENT)) { g_settings.setInteger(Config::SELECTION_TYPE, SELECT_CURRENT_FLOOR); - else if(IsItemChecked(MenuBar::SELECT_MODE_LOWER)) + } else if (IsItemChecked(MenuBar::SELECT_MODE_LOWER)) { g_settings.setInteger(Config::SELECTION_TYPE, SELECT_ALL_FLOORS); - else if(IsItemChecked(MenuBar::SELECT_MODE_VISIBLE)) + } else if (IsItemChecked(MenuBar::SELECT_MODE_VISIBLE)) { g_settings.setInteger(Config::SELECTION_TYPE, SELECT_VISIBLE_FLOORS); + } - switch(g_settings.getInteger(Config::SELECTION_TYPE)) { + switch (g_settings.getInteger(Config::SELECTION_TYPE)) { case SELECT_CURRENT_FLOOR: CheckItem(SELECT_MODE_CURRENT, true); break; @@ -468,49 +469,44 @@ void MainMenuBar::LoadValues() CheckItem(SHOW_MOVEABLES, g_settings.getBoolean(Config::SHOW_MOVEABLES)); } -void MainMenuBar::LoadRecentFiles() -{ +void MainMenuBar::LoadRecentFiles() { recentFiles.Load(g_settings.getConfigObject()); } -void MainMenuBar::SaveRecentFiles() -{ +void MainMenuBar::SaveRecentFiles() { recentFiles.Save(g_settings.getConfigObject()); } -void MainMenuBar::AddRecentFile(FileName file) -{ +void MainMenuBar::AddRecentFile(FileName file) { recentFiles.AddFileToHistory(file.GetFullPath()); } -std::vector MainMenuBar::GetRecentFiles() -{ - std::vector files(recentFiles.GetCount()); - for (size_t i = 0; i < recentFiles.GetCount(); ++i) { - files[i] = recentFiles.GetHistoryFile(i); - } - return files; +std::vector MainMenuBar::GetRecentFiles() { + std::vector files(recentFiles.GetCount()); + for (size_t i = 0; i < recentFiles.GetCount(); ++i) { + files[i] = recentFiles.GetHistoryFile(i); + } + return files; } -void MainMenuBar::UpdateFloorMenu() -{ +void MainMenuBar::UpdateFloorMenu() { using namespace MenuBar; - if(!g_gui.IsEditorOpen()) { + if (!g_gui.IsEditorOpen()) { return; } - for(int i = 0; i < rme::MapLayers; ++i) + for (int i = 0; i < rme::MapLayers; ++i) { CheckItem(static_cast(MenuBar::FLOOR_0 + i), false); + } CheckItem(static_cast(MenuBar::FLOOR_0 + g_gui.GetCurrentFloor()), true); } -void MainMenuBar::UpdateIndicatorsMenu() -{ +void MainMenuBar::UpdateIndicatorsMenu() { using namespace MenuBar; - if(!g_gui.IsEditorOpen()) { + if (!g_gui.IsEditorOpen()) { return; } @@ -519,40 +515,39 @@ void MainMenuBar::UpdateIndicatorsMenu() CheckItem(SHOW_MOVEABLES, g_settings.getBoolean(Config::SHOW_MOVEABLES)); } -bool MainMenuBar::Load(const FileName& path, wxArrayString& warnings, wxString& error) -{ +bool MainMenuBar::Load(const FileName &path, wxArrayString &warnings, wxString &error) { // Open the XML file pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(path.GetFullPath().mb_str()); - if(!result) { + if (!result) { error = "Could not open " + path.GetFullName() + " (file not found or syntax error)"; return false; } pugi::xml_node node = doc.child("menubar"); - if(!node) { + if (!node) { error = path.GetFullName() + ": Invalid rootheader."; return false; } // Clear the menu - while(menubar->GetMenuCount() > 0) { + while (menubar->GetMenuCount() > 0) { menubar->Remove(0); } // Load succeded - for(pugi::xml_node menuNode = node.first_child(); menuNode; menuNode = menuNode.next_sibling()) { + for (pugi::xml_node menuNode = node.first_child(); menuNode; menuNode = menuNode.next_sibling()) { // For each child node, load it wxObject* i = LoadItem(menuNode, nullptr, warnings, error); wxMenu* m = dynamic_cast(i); - if(m) { + if (m) { menubar->Append(m, m->GetTitle()); #ifdef __APPLE__ m->SetTitle(m->GetTitle()); #else m->SetTitle(""); #endif - } else if(i) { + } else if (i) { delete i; warnings.push_back(path.GetFullName() + ": Only menus can be subitems of main menu"); } @@ -563,53 +558,53 @@ bool MainMenuBar::Load(const FileName& path, wxArrayString& warnings, wxString& wxAcceleratorEntry entries[count]; // Edit entries[0].Set(wxACCEL_CTRL, (int)'Z', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::UNDO)); - entries[1].Set(wxACCEL_CTRL | wxACCEL_SHIFT, (int)'Z', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::REDO)); - entries[2].Set(wxACCEL_CTRL, (int)'F', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::FIND_ITEM)); - entries[3].Set(wxACCEL_CTRL | wxACCEL_SHIFT, (int)'F', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::REPLACE_ITEMS)); - entries[4].Set(wxACCEL_NORMAL, (int)'A', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::AUTOMAGIC)); - entries[5].Set(wxACCEL_CTRL, (int)'B', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::BORDERIZE_SELECTION)); - entries[6].Set(wxACCEL_NORMAL, (int)'P', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::GOTO_PREVIOUS_POSITION)); - entries[7].Set(wxACCEL_CTRL, (int)'G', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::GOTO_POSITION)); - entries[8].Set(wxACCEL_NORMAL, (int)'J', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::JUMP_TO_BRUSH)); - entries[9].Set(wxACCEL_CTRL, (int)'X', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::CUT)); - entries[10].Set(wxACCEL_CTRL, (int)'C', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::COPY)); - entries[11].Set(wxACCEL_CTRL, (int)'V', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::PASTE)); - - // View - entries[12].Set(wxACCEL_CTRL, (int)'=', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::ZOOM_IN)); - entries[13].Set(wxACCEL_CTRL, (int)'-', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::ZOOM_OUT)); - entries[14].Set(wxACCEL_CTRL, (int)'0', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::ZOOM_NORMAL)); - entries[15].Set(wxACCEL_NORMAL, (int)'Q', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_SHADE)); - entries[16].Set(wxACCEL_CTRL, (int)'W', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_ALL_FLOORS)); - entries[17].Set(wxACCEL_NORMAL, (int)'Q', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::GHOST_ITEMS)); - entries[18].Set(wxACCEL_CTRL, (int)'L', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::GHOST_HIGHER_FLOORS)); - entries[19].Set(wxACCEL_SHIFT, (int)'I', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_INGAME_BOX)); - entries[20].Set(wxACCEL_SHIFT, (int)'G', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_GRID)); - entries[21].Set(wxACCEL_NORMAL, (int)'V', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::HIGHLIGHT_ITEMS)); - entries[22].Set(wxACCEL_NORMAL, (int)'F', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_MONSTERS)); - entries[23].Set(wxACCEL_NORMAL, (int)'S', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_SPAWNS_MONSTER)); - entries[24].Set(wxACCEL_NORMAL, (int)'X', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_NPCS)); - entries[25].Set(wxACCEL_NORMAL, (int)'U', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_SPAWNS_NPC)); - entries[26].Set(wxACCEL_NORMAL, (int)'E', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_SPECIAL)); - entries[27].Set(wxACCEL_SHIFT, (int)'E', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_AS_MINIMAP)); - entries[28].Set(wxACCEL_CTRL, (int)'E', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_ONLY_COLORS)); - entries[29].Set(wxACCEL_CTRL, (int)'M', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_ONLY_MODIFIED)); - entries[30].Set(wxACCEL_CTRL, (int)'H', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_HOUSES)); - entries[31].Set(wxACCEL_NORMAL, (int)'O', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_PATHING)); - entries[32].Set(wxACCEL_NORMAL, (int)'Y', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_TOOLTIPS)); - entries[33].Set(wxACCEL_NORMAL, (int)'L', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_PREVIEW)); - entries[34].Set(wxACCEL_NORMAL, (int)'K', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_WALL_HOOKS)); - - // Window - entries[33].Set(wxACCEL_NORMAL, (int)'M', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::WIN_MINIMAP)); - entries[34].Set(wxACCEL_NORMAL, (int)'T', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_TERRAIN)); - entries[35].Set(wxACCEL_NORMAL, (int)'D', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_DOODAD)); - entries[36].Set(wxACCEL_NORMAL, (int)'I', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_ITEM)); - entries[37].Set(wxACCEL_NORMAL, (int)'H', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_HOUSE)); - entries[38].Set(wxACCEL_NORMAL, (int)'C', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_MONSTER)); - entries[39].Set(wxACCEL_NORMAL, (int)'N', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_NPC)); - entries[40].Set(wxACCEL_NORMAL, (int)'W', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_WAYPOINT)); - entries[41].Set(wxACCEL_NORMAL, (int)'R', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_RAW)); + entries[1].Set(wxACCEL_CTRL | wxACCEL_SHIFT, (int)'Z', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::REDO)); + entries[2].Set(wxACCEL_CTRL, (int)'F', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::FIND_ITEM)); + entries[3].Set(wxACCEL_CTRL | wxACCEL_SHIFT, (int)'F', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::REPLACE_ITEMS)); + entries[4].Set(wxACCEL_NORMAL, (int)'A', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::AUTOMAGIC)); + entries[5].Set(wxACCEL_CTRL, (int)'B', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::BORDERIZE_SELECTION)); + entries[6].Set(wxACCEL_NORMAL, (int)'P', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::GOTO_PREVIOUS_POSITION)); + entries[7].Set(wxACCEL_CTRL, (int)'G', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::GOTO_POSITION)); + entries[8].Set(wxACCEL_NORMAL, (int)'J', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::JUMP_TO_BRUSH)); + entries[9].Set(wxACCEL_CTRL, (int)'X', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::CUT)); + entries[10].Set(wxACCEL_CTRL, (int)'C', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::COPY)); + entries[11].Set(wxACCEL_CTRL, (int)'V', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::PASTE)); + + // View + entries[12].Set(wxACCEL_CTRL, (int)'=', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::ZOOM_IN)); + entries[13].Set(wxACCEL_CTRL, (int)'-', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::ZOOM_OUT)); + entries[14].Set(wxACCEL_CTRL, (int)'0', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::ZOOM_NORMAL)); + entries[15].Set(wxACCEL_NORMAL, (int)'Q', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_SHADE)); + entries[16].Set(wxACCEL_CTRL, (int)'W', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_ALL_FLOORS)); + entries[17].Set(wxACCEL_NORMAL, (int)'Q', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::GHOST_ITEMS)); + entries[18].Set(wxACCEL_CTRL, (int)'L', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::GHOST_HIGHER_FLOORS)); + entries[19].Set(wxACCEL_SHIFT, (int)'I', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_INGAME_BOX)); + entries[20].Set(wxACCEL_SHIFT, (int)'G', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_GRID)); + entries[21].Set(wxACCEL_NORMAL, (int)'V', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::HIGHLIGHT_ITEMS)); + entries[22].Set(wxACCEL_NORMAL, (int)'F', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_MONSTERS)); + entries[23].Set(wxACCEL_NORMAL, (int)'S', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_SPAWNS_MONSTER)); + entries[24].Set(wxACCEL_NORMAL, (int)'X', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_NPCS)); + entries[25].Set(wxACCEL_NORMAL, (int)'U', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_SPAWNS_NPC)); + entries[26].Set(wxACCEL_NORMAL, (int)'E', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_SPECIAL)); + entries[27].Set(wxACCEL_SHIFT, (int)'E', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_AS_MINIMAP)); + entries[28].Set(wxACCEL_CTRL, (int)'E', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_ONLY_COLORS)); + entries[29].Set(wxACCEL_CTRL, (int)'M', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_ONLY_MODIFIED)); + entries[30].Set(wxACCEL_CTRL, (int)'H', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_HOUSES)); + entries[31].Set(wxACCEL_NORMAL, (int)'O', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_PATHING)); + entries[32].Set(wxACCEL_NORMAL, (int)'Y', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_TOOLTIPS)); + entries[33].Set(wxACCEL_NORMAL, (int)'L', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_PREVIEW)); + entries[34].Set(wxACCEL_NORMAL, (int)'K', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SHOW_WALL_HOOKS)); + + // Window + entries[33].Set(wxACCEL_NORMAL, (int)'M', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::WIN_MINIMAP)); + entries[34].Set(wxACCEL_NORMAL, (int)'T', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_TERRAIN)); + entries[35].Set(wxACCEL_NORMAL, (int)'D', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_DOODAD)); + entries[36].Set(wxACCEL_NORMAL, (int)'I', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_ITEM)); + entries[37].Set(wxACCEL_NORMAL, (int)'H', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_HOUSE)); + entries[38].Set(wxACCEL_NORMAL, (int)'C', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_MONSTER)); + entries[39].Set(wxACCEL_NORMAL, (int)'N', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_NPC)); + entries[40].Set(wxACCEL_NORMAL, (int)'W', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_WAYPOINT)); + entries[41].Set(wxACCEL_NORMAL, (int)'R', static_cast(MAIN_FRAME_MENU) + static_cast(MenuBar::SELECT_RAW)); wxAcceleratorTable accelerator(count, entries); frame->SetAcceleratorTable(accelerator); @@ -629,13 +624,12 @@ bool MainMenuBar::Load(const FileName& path, wxArrayString& warnings, wxString& return true; } -wxObject* MainMenuBar::LoadItem(pugi::xml_node node, wxMenu* parent, wxArrayString& warnings, wxString& error) -{ +wxObject* MainMenuBar::LoadItem(pugi::xml_node node, wxMenu* parent, wxArrayString &warnings, wxString &error) { pugi::xml_attribute attribute; - const std::string& nodeName = as_lower_str(node.name()); - if(nodeName == "menu") { - if(!(attribute = node.attribute("name"))) { + const std::string &nodeName = as_lower_str(node.name()); + if (nodeName == "menu") { + if (!(attribute = node.attribute("name"))) { return nullptr; } @@ -643,10 +637,10 @@ wxObject* MainMenuBar::LoadItem(pugi::xml_node node, wxMenu* parent, wxArrayStri std::replace(name.begin(), name.end(), '$', '&'); wxMenu* menu = newd wxMenu; - if((attribute = node.attribute("special")) && std::string(attribute.as_string()) == "RECENT_FILES") { + if ((attribute = node.attribute("special")) && std::string(attribute.as_string()) == "RECENT_FILES") { recentFiles.UseMenu(menu); } else { - for(pugi::xml_node menuNode = node.first_child(); menuNode; menuNode = menuNode.next_sibling()) { + for (pugi::xml_node menuNode = node.first_child(); menuNode; menuNode = menuNode.next_sibling()) { // Load an add each item in order LoadItem(menuNode, menu, warnings, error); } @@ -655,44 +649,44 @@ wxObject* MainMenuBar::LoadItem(pugi::xml_node node, wxMenu* parent, wxArrayStri // If we have a parent, add ourselves. // If not, we just return the item and the parent function // is responsible for adding us to wherever - if(parent) { + if (parent) { parent->AppendSubMenu(menu, wxstr(name)); } else { menu->SetTitle((name)); } return menu; - } else if(nodeName == "item") { + } else if (nodeName == "item") { // We must have a parent when loading items - if(!parent) { + if (!parent) { return nullptr; - } else if(!(attribute = node.attribute("name"))) { + } else if (!(attribute = node.attribute("name"))) { return nullptr; } std::string name = attribute.as_string(); std::replace(name.begin(), name.end(), '$', '&'); - if(!(attribute = node.attribute("action"))) { + if (!(attribute = node.attribute("action"))) { return nullptr; } - const std::string& action = attribute.as_string(); + const std::string &action = attribute.as_string(); std::string hotkey = node.attribute("hotkey").as_string(); - if(!hotkey.empty()) { + if (!hotkey.empty()) { hotkey = '\t' + hotkey; } - const std::string& help = node.attribute("help").as_string(); + const std::string &help = node.attribute("help").as_string(); name += hotkey; auto it = actions.find(action); - if(it == actions.end()) { + if (it == actions.end()) { warnings.push_back("Invalid action type '" + wxstr(action) + "'."); return nullptr; } - const MenuBar::Action& act = *it->second; + const MenuBar::Action &act = *it->second; wxAcceleratorEntry* entry = wxAcceleratorEntry::Create(wxstr(hotkey)); - if(entry) { + if (entry) { delete entry; // accelerators.push_back(entry); } else { warnings.push_back("Invalid hotkey."); @@ -706,9 +700,9 @@ wxObject* MainMenuBar::LoadItem(pugi::xml_node node, wxMenu* parent, wxArrayStri ); items[MenuBar::ActionID(act.id)].push_back(tmp); return tmp; - } else if(nodeName == "separator") { + } else if (nodeName == "separator") { // We must have a parent when loading items - if(!parent) { + if (!parent) { return nullptr; } return parent->AppendSeparator(); @@ -716,13 +710,11 @@ wxObject* MainMenuBar::LoadItem(pugi::xml_node node, wxMenu* parent, wxArrayStri return nullptr; } -void MainMenuBar::OnNew(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnNew(wxCommandEvent &WXUNUSED(event)) { g_gui.NewMap(); } -void MainMenuBar::OnGenerateMap(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnGenerateMap(wxCommandEvent &WXUNUSED(event)) { /* if(!DoQuerySave()) return; @@ -743,41 +735,34 @@ void MainMenuBar::OnGenerateMap(wxCommandEvent& WXUNUSED(event)) */ } -void MainMenuBar::OnOpenRecent(wxCommandEvent& event) -{ +void MainMenuBar::OnOpenRecent(wxCommandEvent &event) { FileName fn(recentFiles.GetHistoryFile(event.GetId() - recentFiles.GetBaseId())); frame->LoadMap(fn); } -void MainMenuBar::OnOpen(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnOpen(wxCommandEvent &WXUNUSED(event)) { g_gui.OpenMap(); } -void MainMenuBar::OnClose(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnClose(wxCommandEvent &WXUNUSED(event)) { frame->DoQuerySave(true); // It closes the editor too } -void MainMenuBar::OnSave(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSave(wxCommandEvent &WXUNUSED(event)) { g_gui.SaveMap(); } -void MainMenuBar::OnSaveAs(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSaveAs(wxCommandEvent &WXUNUSED(event)) { g_gui.SaveMapAs(); } -void MainMenuBar::OnPreferences(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnPreferences(wxCommandEvent &WXUNUSED(event)) { PreferencesWindow dialog(frame); dialog.ShowModal(); dialog.Destroy(); } -void MainMenuBar::OnQuit(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnQuit(wxCommandEvent &WXUNUSED(event)) { /* while(g_gui.IsEditorOpen()) if(!frame->DoQuerySave(true)) @@ -787,59 +772,56 @@ void MainMenuBar::OnQuit(wxCommandEvent& WXUNUSED(event)) g_gui.root->Close(); } -void MainMenuBar::OnImportMap(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnImportMap(wxCommandEvent &WXUNUSED(event)) { ASSERT(g_gui.GetCurrentEditor()); wxDialog* importmap = newd ImportMapWindow(frame, *g_gui.GetCurrentEditor()); importmap->ShowModal(); } -void MainMenuBar::OnImportMonsterData(wxCommandEvent& WXUNUSED(event)) -{ - wxFileDialog dlg(g_gui.root, "Import monster file", "","","*.xml", wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST); - if(dlg.ShowModal() == wxID_OK) { +void MainMenuBar::OnImportMonsterData(wxCommandEvent &WXUNUSED(event)) { + wxFileDialog dlg(g_gui.root, "Import monster file", "", "", "*.xml", wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST); + if (dlg.ShowModal() == wxID_OK) { wxArrayString paths; dlg.GetPaths(paths); - for(uint32_t i = 0; i < paths.GetCount(); ++i) { + for (uint32_t i = 0; i < paths.GetCount(); ++i) { wxString error; wxArrayString warnings; bool ok = g_monsters.importXMLFromOT(FileName(paths[i]), error, warnings); - if(ok) + if (ok) { g_gui.ListDialog("Monster loader errors", warnings); - else + } else { wxMessageBox("Error OT data file \"" + paths[i] + "\".\n" + error, "Error", wxOK | wxICON_INFORMATION, g_gui.root); + } } } } -void MainMenuBar::OnImportNpcData(wxCommandEvent& WXUNUSED(event)) -{ - wxFileDialog dlg(g_gui.root, "Import npc file", "","","*.xml", wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST); - if(dlg.ShowModal() == wxID_OK) { +void MainMenuBar::OnImportNpcData(wxCommandEvent &WXUNUSED(event)) { + wxFileDialog dlg(g_gui.root, "Import npc file", "", "", "*.xml", wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST); + if (dlg.ShowModal() == wxID_OK) { wxArrayString paths; dlg.GetPaths(paths); - for(uint32_t i = 0; i < paths.GetCount(); ++i) { + for (uint32_t i = 0; i < paths.GetCount(); ++i) { wxString error; wxArrayString warnings; bool ok = g_npcs.importXMLFromOT(FileName(paths[i]), error, warnings); - if(ok) + if (ok) { g_gui.ListDialog("Monster loader errors", warnings); - else + } else { wxMessageBox("Error OT data file \"" + paths[i] + "\".\n" + error, "Error", wxOK | wxICON_INFORMATION, g_gui.root); + } } } } -void MainMenuBar::OnImportMinimap(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnImportMinimap(wxCommandEvent &WXUNUSED(event)) { ASSERT(g_gui.IsEditorOpen()); - //wxDialog* importmap = newd ImportMapWindow(); - //importmap->ShowModal(); + // wxDialog* importmap = newd ImportMapWindow(); + // importmap->ShowModal(); } -void MainMenuBar::OnExportMinimap(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsEditorOpen()) { +void MainMenuBar::OnExportMinimap(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsEditorOpen()) { return; } @@ -847,15 +829,13 @@ void MainMenuBar::OnExportMinimap(wxCommandEvent& WXUNUSED(event)) dialog.ShowModal(); } -void MainMenuBar::OnDebugViewDat(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnDebugViewDat(wxCommandEvent &WXUNUSED(event)) { wxDialog dlg(frame, wxID_ANY, "Debug .dat file", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); new DatDebugView(&dlg); dlg.ShowModal(); } -void MainMenuBar::OnReloadDataFiles(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnReloadDataFiles(wxCommandEvent &WXUNUSED(event)) { wxString error; wxArrayString warnings; g_gui.LoadVersion(g_gui.GetCurrentVersionID(), error, warnings, true); @@ -863,77 +843,74 @@ void MainMenuBar::OnReloadDataFiles(wxCommandEvent& WXUNUSED(event)) g_gui.ListDialog("Warnings", warnings); } -void MainMenuBar::OnListExtensions(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnListExtensions(wxCommandEvent &WXUNUSED(event)) { ExtensionsDialog exts(frame); exts.ShowModal(); } -void MainMenuBar::OnGotoWebsite(wxCommandEvent& WXUNUSED(event)) -{ - ::wxLaunchDefaultBrowser("http://www.remeresmapeditor.com/", wxBROWSER_NEW_WINDOW); +void MainMenuBar::OnGotoWebsite(wxCommandEvent &WXUNUSED(event)) { + ::wxLaunchDefaultBrowser("http://www.remeresmapeditor.com/", wxBROWSER_NEW_WINDOW); } -void MainMenuBar::OnAbout(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnAbout(wxCommandEvent &WXUNUSED(event)) { AboutWindow about(frame); about.ShowModal(); } -void MainMenuBar::OnUndo(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnUndo(wxCommandEvent &WXUNUSED(event)) { g_gui.DoUndo(); } -void MainMenuBar::OnRedo(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnRedo(wxCommandEvent &WXUNUSED(event)) { g_gui.DoRedo(); } -namespace OnSearchForItem -{ - struct Finder - { +namespace OnSearchForItem { + struct Finder { Finder(uint16_t itemId, uint32_t maxCount) : - itemId(itemId), maxCount(maxCount) {} + itemId(itemId), maxCount(maxCount) { } uint16_t itemId; uint32_t maxCount; - std::vector< std::pair > result; + std::vector> result; - bool limitReached() const { return result.size() >= (size_t)maxCount; } + bool limitReached() const { + return result.size() >= (size_t)maxCount; + } - void operator()(Map& map, Tile* tile, Item* item, long long done) - { - if(result.size() >= (size_t)maxCount) + void operator()(Map &map, Tile* tile, Item* item, long long done) { + if (result.size() >= (size_t)maxCount) { return; + } - if(done % 0x8000 == 0) + if (done % 0x8000 == 0) { g_gui.SetLoadDone((unsigned int)(100 * done / map.getTileCount())); + } - if(item->getID() == itemId) + if (item->getID() == itemId) { result.push_back(std::make_pair(tile, item)); + } } }; } -void MainMenuBar::OnSearchForItem(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsEditorOpen()) +void MainMenuBar::OnSearchForItem(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsEditorOpen()) { return; + } FindItemDialog dialog(frame, "Search for Item"); dialog.setSearchMode((FindItemDialog::SearchMode)g_settings.getInteger(Config::FIND_ITEM_MODE)); - if(dialog.ShowModal() == wxID_OK) { + if (dialog.ShowModal() == wxID_OK) { OnSearchForItem::Finder finder(dialog.getResultID(), (uint32_t)g_settings.getInteger(Config::REPLACE_SIZE)); g_gui.CreateLoadBar("Searching map..."); foreach_ItemOnMap(g_gui.GetCurrentMap(), finder, false); - std::vector< std::pair >& result = finder.result; + std::vector> &result = finder.result; g_gui.DestroyLoadBar(); - if(finder.limitReached()) { + if (finder.limitReached()) { wxString msg; msg << "The configured limit has been reached. Only " << finder.maxCount << " results will be displayed."; g_gui.PopupDialog("Notice", msg, wxOK); @@ -941,7 +918,7 @@ void MainMenuBar::OnSearchForItem(wxCommandEvent& WXUNUSED(event)) SearchResultWindow* window = g_gui.ShowSearchWindow(); window->Clear(); - for(std::vector >::const_iterator iter = result.begin(); iter != result.end(); ++iter) { + for (std::vector>::const_iterator iter = result.begin(); iter != result.end(); ++iter) { Tile* tile = iter->first; Item* item = iter->second; window->AddPosition(wxstr(item->getName()), tile->getPosition()); @@ -952,156 +929,143 @@ void MainMenuBar::OnSearchForItem(wxCommandEvent& WXUNUSED(event)) dialog.Destroy(); } -void MainMenuBar::OnReplaceItems(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsVersionLoaded()) +void MainMenuBar::OnReplaceItems(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsVersionLoaded()) { return; + } - if(MapTab* tab = g_gui.GetCurrentMapTab()) { + if (MapTab* tab = g_gui.GetCurrentMapTab()) { if (MapWindow* window = tab->GetView()) { window->ShowReplaceItemsDialog(false); } } } -namespace OnSearchForStuff -{ - struct Searcher - { +namespace OnSearchForStuff { + struct Searcher { Searcher() : search_unique(false), search_action(false), search_container(false), - search_writeable(false) {} + search_writeable(false) { } bool search_unique; bool search_action; bool search_container; bool search_writeable; - std::vector > found; + std::vector> found; - void operator()(Map& map, Tile* tile, Item* item, long long done) - { - if(done % 0x8000 == 0) { + void operator()(Map &map, Tile* tile, Item* item, long long done) { + if (done % 0x8000 == 0) { g_gui.SetLoadDone((unsigned int)(100 * done / map.getTileCount())); } Container* container; - if((search_unique && item->getUniqueID() > 0) || - (search_action && item->getActionID() > 0) || - (search_container && ((container = dynamic_cast(item)) && container->getItemCount())) || - (search_writeable && item->getText().length() > 0)) { + if ((search_unique && item->getUniqueID() > 0) || (search_action && item->getActionID() > 0) || (search_container && ((container = dynamic_cast(item)) && container->getItemCount())) || (search_writeable && item->getText().length() > 0)) { found.push_back(std::make_pair(tile, item)); } } - wxString desc(Item* item) - { + wxString desc(Item* item) { wxString label; - if(item->getUniqueID() > 0) + if (item->getUniqueID() > 0) { label << "UID:" << item->getUniqueID() << " "; + } - if(item->getActionID() > 0) + if (item->getActionID() > 0) { label << "AID:" << item->getActionID() << " "; + } label << wxstr(item->getName()); - if(dynamic_cast(item)) + if (dynamic_cast(item)) { label << " (Container) "; + } - if(item->getText().length() > 0) + if (item->getText().length() > 0) { label << " (Text: " << wxstr(item->getText()) << ") "; + } return label; } - void sort() - { - if(search_unique || search_action) + void sort() { + if (search_unique || search_action) { std::sort(found.begin(), found.end(), Searcher::compare); + } } - static bool compare(const std::pair& pair1, const std::pair& pair2) - { + static bool compare(const std::pair &pair1, const std::pair &pair2) { const Item* item1 = pair1.second; const Item* item2 = pair2.second; - if(item1->getActionID() != 0 || item2->getActionID() != 0) + if (item1->getActionID() != 0 || item2->getActionID() != 0) { return item1->getActionID() < item2->getActionID(); - else if(item1->getUniqueID() != 0 || item2->getUniqueID() != 0) + } else if (item1->getUniqueID() != 0 || item2->getUniqueID() != 0) { return item1->getUniqueID() < item2->getUniqueID(); + } return false; } }; } -void MainMenuBar::OnSearchForStuffOnMap(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSearchForStuffOnMap(wxCommandEvent &WXUNUSED(event)) { SearchItems(true, true, true, true); } -void MainMenuBar::OnSearchForUniqueOnMap(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSearchForUniqueOnMap(wxCommandEvent &WXUNUSED(event)) { SearchItems(true, false, false, false); } -void MainMenuBar::OnSearchForActionOnMap(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSearchForActionOnMap(wxCommandEvent &WXUNUSED(event)) { SearchItems(false, true, false, false); } -void MainMenuBar::OnSearchForContainerOnMap(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSearchForContainerOnMap(wxCommandEvent &WXUNUSED(event)) { SearchItems(false, false, true, false); } -void MainMenuBar::OnSearchForWriteableOnMap(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSearchForWriteableOnMap(wxCommandEvent &WXUNUSED(event)) { SearchItems(false, false, false, true); } -void MainMenuBar::OnSearchForStuffOnSelection(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSearchForStuffOnSelection(wxCommandEvent &WXUNUSED(event)) { SearchItems(true, true, true, true, true); } -void MainMenuBar::OnSearchForUniqueOnSelection(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSearchForUniqueOnSelection(wxCommandEvent &WXUNUSED(event)) { SearchItems(true, false, false, false, true); } -void MainMenuBar::OnSearchForActionOnSelection(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSearchForActionOnSelection(wxCommandEvent &WXUNUSED(event)) { SearchItems(false, true, false, false, true); } -void MainMenuBar::OnSearchForContainerOnSelection(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSearchForContainerOnSelection(wxCommandEvent &WXUNUSED(event)) { SearchItems(false, false, true, false, true); } -void MainMenuBar::OnSearchForWriteableOnSelection(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSearchForWriteableOnSelection(wxCommandEvent &WXUNUSED(event)) { SearchItems(false, false, false, true, true); } -void MainMenuBar::OnSearchForItemOnSelection(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsEditorOpen()) +void MainMenuBar::OnSearchForItemOnSelection(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsEditorOpen()) { return; + } FindItemDialog dialog(frame, "Search on Selection"); dialog.setSearchMode((FindItemDialog::SearchMode)g_settings.getInteger(Config::FIND_ITEM_MODE)); - if(dialog.ShowModal() == wxID_OK) { + if (dialog.ShowModal() == wxID_OK) { OnSearchForItem::Finder finder(dialog.getResultID(), (uint32_t)g_settings.getInteger(Config::REPLACE_SIZE)); g_gui.CreateLoadBar("Searching on selected area..."); foreach_ItemOnMap(g_gui.GetCurrentMap(), finder, true); - std::vector >& result = finder.result; + std::vector> &result = finder.result; g_gui.DestroyLoadBar(); - if(finder.limitReached()) { + if (finder.limitReached()) { wxString msg; msg << "The configured limit has been reached. Only " << finder.maxCount << " results will be displayed."; g_gui.PopupDialog("Notice", msg, wxOK); @@ -1109,7 +1073,7 @@ void MainMenuBar::OnSearchForItemOnSelection(wxCommandEvent& WXUNUSED(event)) SearchResultWindow* window = g_gui.ShowSearchWindow(); window->Clear(); - for(std::vector >::const_iterator iter = result.begin(); iter != result.end(); ++iter) { + for (std::vector>::const_iterator iter = result.begin(); iter != result.end(); ++iter) { Tile* tile = iter->first; Item* item = iter->second; window->AddPosition(wxstr(item->getName()), tile->getPosition()); @@ -1121,25 +1085,25 @@ void MainMenuBar::OnSearchForItemOnSelection(wxCommandEvent& WXUNUSED(event)) dialog.Destroy(); } -void MainMenuBar::OnReplaceItemsOnSelection(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsVersionLoaded()) +void MainMenuBar::OnReplaceItemsOnSelection(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsVersionLoaded()) { return; + } - if(MapTab* tab = g_gui.GetCurrentMapTab()) { - if(MapWindow* window = tab->GetView()) { + if (MapTab* tab = g_gui.GetCurrentMapTab()) { + if (MapWindow* window = tab->GetView()) { window->ShowReplaceItemsDialog(true); } } } -void MainMenuBar::OnRemoveItemOnSelection(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsEditorOpen()) +void MainMenuBar::OnRemoveItemOnSelection(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsEditorOpen()) { return; + } FindItemDialog dialog(frame, "Remove Item on Selection"); - if(dialog.ShowModal() == wxID_OK) { + if (dialog.ShowModal() == wxID_OK) { g_gui.GetCurrentEditor()->clearActions(); g_gui.CreateLoadBar("Searching item on selection to remove..."); OnMapRemoveItems::RemoveItemCondition condition(dialog.getResultID()); @@ -1155,89 +1119,88 @@ void MainMenuBar::OnRemoveItemOnSelection(wxCommandEvent& WXUNUSED(event)) dialog.Destroy(); } -void MainMenuBar::OnSelectionTypeChange(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSelectionTypeChange(wxCommandEvent &WXUNUSED(event)) { g_settings.setInteger(Config::COMPENSATED_SELECT, IsItemChecked(MenuBar::SELECT_MODE_COMPENSATE)); - if(IsItemChecked(MenuBar::SELECT_MODE_CURRENT)) + if (IsItemChecked(MenuBar::SELECT_MODE_CURRENT)) { g_settings.setInteger(Config::SELECTION_TYPE, SELECT_CURRENT_FLOOR); - else if(IsItemChecked(MenuBar::SELECT_MODE_LOWER)) + } else if (IsItemChecked(MenuBar::SELECT_MODE_LOWER)) { g_settings.setInteger(Config::SELECTION_TYPE, SELECT_ALL_FLOORS); - else if(IsItemChecked(MenuBar::SELECT_MODE_VISIBLE)) + } else if (IsItemChecked(MenuBar::SELECT_MODE_VISIBLE)) { g_settings.setInteger(Config::SELECTION_TYPE, SELECT_VISIBLE_FLOORS); + } } -void MainMenuBar::OnCopy(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnCopy(wxCommandEvent &WXUNUSED(event)) { g_gui.DoCopy(); } -void MainMenuBar::OnCut(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnCut(wxCommandEvent &WXUNUSED(event)) { g_gui.DoCut(); } -void MainMenuBar::OnPaste(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnPaste(wxCommandEvent &WXUNUSED(event)) { g_gui.PreparePaste(); } -void MainMenuBar::OnToggleAutomagic(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnToggleAutomagic(wxCommandEvent &WXUNUSED(event)) { g_settings.setInteger(Config::USE_AUTOMAGIC, IsItemChecked(MenuBar::AUTOMAGIC)); g_settings.setInteger(Config::BORDER_IS_GROUND, IsItemChecked(MenuBar::AUTOMAGIC)); - if(g_settings.getInteger(Config::USE_AUTOMAGIC)) + if (g_settings.getInteger(Config::USE_AUTOMAGIC)) { g_gui.SetStatusText("Automagic enabled."); - else + } else { g_gui.SetStatusText("Automagic disabled."); + } } -void MainMenuBar::OnBorderizeSelection(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsEditorOpen()) +void MainMenuBar::OnBorderizeSelection(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsEditorOpen()) { return; + } g_gui.GetCurrentEditor()->borderizeSelection(); g_gui.RefreshView(); } -void MainMenuBar::OnBorderizeMap(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsEditorOpen()) +void MainMenuBar::OnBorderizeMap(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsEditorOpen()) { return; + } int ret = g_gui.PopupDialog("Borderize Map", "Are you sure you want to borderize the entire map (this action cannot be undone)?", wxYES | wxNO); - if(ret == wxID_YES) + if (ret == wxID_YES) { g_gui.GetCurrentEditor()->borderizeMap(true); + } g_gui.RefreshView(); } -void MainMenuBar::OnRandomizeSelection(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsEditorOpen()) +void MainMenuBar::OnRandomizeSelection(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsEditorOpen()) { return; + } g_gui.GetCurrentEditor()->randomizeSelection(); g_gui.RefreshView(); } -void MainMenuBar::OnRandomizeMap(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsEditorOpen()) +void MainMenuBar::OnRandomizeMap(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsEditorOpen()) { return; + } int ret = g_gui.PopupDialog("Randomize Map", "Are you sure you want to randomize the entire map (this action cannot be undone)?", wxYES | wxNO); - if(ret == wxID_YES) + if (ret == wxID_YES) { g_gui.GetCurrentEditor()->randomizeMap(true); + } g_gui.RefreshView(); } -void MainMenuBar::OnJumpToBrush(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsVersionLoaded()) +void MainMenuBar::OnJumpToBrush(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsVersionLoaded()) { return; + } // Create the jump to dialog FindDialog* dlg = newd FindBrushDialog(frame); @@ -1247,54 +1210,55 @@ void MainMenuBar::OnJumpToBrush(wxCommandEvent& WXUNUSED(event)) // Retrieve result, if null user canceled const Brush* brush = dlg->getResult(); - if(brush) { + if (brush) { g_gui.SelectBrush(brush, TILESET_UNKNOWN); } delete dlg; } -void MainMenuBar::OnJumpToItemBrush(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsVersionLoaded()) +void MainMenuBar::OnJumpToItemBrush(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsVersionLoaded()) { return; + } // Create the jump to dialog FindItemDialog dialog(frame, "Jump to Item"); dialog.setSearchMode((FindItemDialog::SearchMode)g_settings.getInteger(Config::JUMP_TO_ITEM_MODE)); - if(dialog.ShowModal() == wxID_OK) { + if (dialog.ShowModal() == wxID_OK) { // Retrieve result, if null user canceled const Brush* brush = dialog.getResult(); - if(brush) + if (brush) { g_gui.SelectBrush(brush, TILESET_RAW); + } g_settings.setInteger(Config::JUMP_TO_ITEM_MODE, (int)dialog.getSearchMode()); } dialog.Destroy(); } -void MainMenuBar::OnGotoPreviousPosition(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnGotoPreviousPosition(wxCommandEvent &WXUNUSED(event)) { MapTab* mapTab = g_gui.GetCurrentMapTab(); - if(mapTab) + if (mapTab) { mapTab->GoToPreviousCenterPosition(); + } } -void MainMenuBar::OnGotoPosition(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsEditorOpen()) +void MainMenuBar::OnGotoPosition(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsEditorOpen()) { return; + } // Display dialog, it also controls the actual jump GotoPositionDialog dlg(frame, *g_gui.GetCurrentEditor()); dlg.ShowModal(); } -void MainMenuBar::OnMapRemoveItems(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsEditorOpen()) +void MainMenuBar::OnMapRemoveItems(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsEditorOpen()) { return; + } FindItemDialog dialog(frame, "Item Type to Remove"); - if(dialog.ShowModal() == wxID_OK) { + if (dialog.ShowModal() == wxID_OK) { uint16_t itemid = dialog.getResultID(); g_gui.GetCurrentEditor()->getSelection().clear(); @@ -1317,29 +1281,28 @@ void MainMenuBar::OnMapRemoveItems(wxCommandEvent& WXUNUSED(event)) dialog.Destroy(); } -namespace OnMapRemoveCorpses -{ - struct condition - { - condition() {} +namespace OnMapRemoveCorpses { + struct condition { + condition() { } - bool operator()(Map& map, Item* item, long long removed, long long done){ - if(done % 0x800 == 0) + bool operator()(Map &map, Item* item, long long removed, long long done) { + if (done % 0x800 == 0) { g_gui.SetLoadDone((unsigned int)(100 * done / map.getTileCount())); + } return g_materials.isInTileset(item, "Corpses") & !item->isComplex(); } }; } -void MainMenuBar::OnMapRemoveCorpses(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsEditorOpen()) +void MainMenuBar::OnMapRemoveCorpses(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsEditorOpen()) { return; + } int ok = g_gui.PopupDialog("Remove Corpses", "Do you want to remove all corpses from the map?", wxYES | wxNO); - if(ok == wxID_YES) { + if (ok == wxID_YES) { g_gui.GetCurrentEditor()->getSelection().clear(); g_gui.GetCurrentEditor()->clearActions(); @@ -1357,34 +1320,33 @@ void MainMenuBar::OnMapRemoveCorpses(wxCommandEvent& WXUNUSED(event)) } } -namespace OnMapRemoveUnreachable -{ - struct condition - { - condition() {} +namespace OnMapRemoveUnreachable { + struct condition { + condition() { } - bool isReachable(Tile* tile) - { - if(tile == nullptr) + bool isReachable(Tile* tile) { + if (tile == nullptr) { return false; - if(!tile->isBlocking()) + } + if (!tile->isBlocking()) { return true; + } return false; } - bool operator()(Map& map, Tile* tile, long long removed, long long done, long long total) - { - if(done % 0x1000 == 0) + bool operator()(Map &map, Tile* tile, long long removed, long long done, long long total) { + if (done % 0x1000 == 0) { g_gui.SetLoadDone((unsigned int)(100 * done / total)); + } - const Position& pos = tile->getPosition(); + const Position &pos = tile->getPosition(); int sx = std::max(pos.x - 10, 0); int ex = std::min(pos.x + 10, 65535); - int sy = std::max(pos.y - 8, 0); - int ey = std::min(pos.y + 8, 65535); + int sy = std::max(pos.y - 8, 0); + int ey = std::min(pos.y + 8, 65535); int sz, ez; - if(pos.z < 8) { + if (pos.z < 8) { sz = 0; ez = 9; } else { @@ -1393,11 +1355,12 @@ namespace OnMapRemoveUnreachable ez = std::min(pos.z + 2, rme::MapMaxLayer); } - for(int z = sz; z <= ez; ++z) { - for(int y = sy; y <= ey; ++y) { - for(int x = sx; x <= ex; ++x) { - if(isReachable(map.getTile(x, y, z))) + for (int z = sz; z <= ez; ++z) { + for (int y = sy; y <= ey; ++y) { + for (int x = sx; x <= ex; ++x) { + if (isReachable(map.getTile(x, y, z))) { return false; + } } } } @@ -1406,14 +1369,14 @@ namespace OnMapRemoveUnreachable }; } -void MainMenuBar::OnMapRemoveUnreachable(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsEditorOpen()) +void MainMenuBar::OnMapRemoveUnreachable(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsEditorOpen()) { return; + } int ok = g_gui.PopupDialog("Remove Unreachable Tiles", "Do you want to remove all unreachable items from the map?", wxYES | wxNO); - if(ok == wxID_YES) { + if (ok == wxID_YES) { g_gui.GetCurrentEditor()->getSelection().clear(); g_gui.GetCurrentEditor()->clearActions(); @@ -1433,8 +1396,7 @@ void MainMenuBar::OnMapRemoveUnreachable(wxCommandEvent& WXUNUSED(event)) } } -void MainMenuBar::OnMapRemoveEmptyMonsterSpawns(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnMapRemoveEmptyMonsterSpawns(wxCommandEvent &WXUNUSED(event)) { if (!g_gui.IsEditorOpen()) { return; } @@ -1446,10 +1408,10 @@ void MainMenuBar::OnMapRemoveEmptyMonsterSpawns(wxCommandEvent& WXUNUSED(event)) g_gui.CreateLoadBar("Searching map for empty monsters spawns to remove..."); - Map& map = g_gui.GetCurrentMap(); + Map &map = g_gui.GetCurrentMap(); MonsterVector monster; TileVector toDeleteSpawns; - for (const auto& spawnPosition : map.spawnsMonster) { + for (const auto &spawnPosition : map.spawnsMonster) { Tile* tile = map.getTile(spawnPosition); if (!tile || !tile->spawnMonster) { continue; @@ -1483,7 +1445,7 @@ void MainMenuBar::OnMapRemoveEmptyMonsterSpawns(wxCommandEvent& WXUNUSED(event)) const size_t count = toDeleteSpawns.size(); size_t removed = 0; - for (const auto& tile : toDeleteSpawns) { + for (const auto &tile : toDeleteSpawns) { Tile* newtile = tile->deepCopy(map); map.removeSpawnMonster(newtile); delete newtile->spawnMonster; @@ -1507,8 +1469,7 @@ void MainMenuBar::OnMapRemoveEmptyMonsterSpawns(wxCommandEvent& WXUNUSED(event)) } } -void MainMenuBar::OnMapRemoveEmptyNpcSpawns(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnMapRemoveEmptyNpcSpawns(wxCommandEvent &WXUNUSED(event)) { if (!g_gui.IsEditorOpen()) { return; } @@ -1520,10 +1481,10 @@ void MainMenuBar::OnMapRemoveEmptyNpcSpawns(wxCommandEvent& WXUNUSED(event)) g_gui.CreateLoadBar("Searching map for empty npcs spawns to remove..."); - Map& map = g_gui.GetCurrentMap(); + Map &map = g_gui.GetCurrentMap(); NpcVector npc; TileVector toDeleteSpawns; - for (const auto& spawnPosition : map.spawnsNpc) { + for (const auto &spawnPosition : map.spawnsNpc) { Tile* tile = map.getTile(spawnPosition); if (!tile || !tile->spawnNpc) { continue; @@ -1557,7 +1518,7 @@ void MainMenuBar::OnMapRemoveEmptyNpcSpawns(wxCommandEvent& WXUNUSED(event)) const size_t count = toDeleteSpawns.size(); size_t removed = 0; - for (const auto& tile : toDeleteSpawns) { + for (const auto &tile : toDeleteSpawns) { Tile* newtile = tile->deepCopy(map); map.removeSpawnNpc(newtile); delete newtile->spawnNpc; @@ -1581,11 +1542,11 @@ void MainMenuBar::OnMapRemoveEmptyNpcSpawns(wxCommandEvent& WXUNUSED(event)) } } -void MainMenuBar::OnClearHouseTiles(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnClearHouseTiles(wxCommandEvent &WXUNUSED(event)) { Editor* editor = g_gui.GetCurrentEditor(); - if(!editor) + if (!editor) { return; + } int ret = g_gui.PopupDialog( "Clear Invalid House Tiles", @@ -1593,7 +1554,7 @@ void MainMenuBar::OnClearHouseTiles(wxCommandEvent& WXUNUSED(event)) wxYES | wxNO ); - if(ret == wxID_YES) { + if (ret == wxID_YES) { // Editor will do the work editor->clearInvalidHouseTiles(true); } @@ -1601,11 +1562,11 @@ void MainMenuBar::OnClearHouseTiles(wxCommandEvent& WXUNUSED(event)) g_gui.RefreshView(); } -void MainMenuBar::OnClearModifiedState(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnClearModifiedState(wxCommandEvent &WXUNUSED(event)) { Editor* editor = g_gui.GetCurrentEditor(); - if(!editor) + if (!editor) { return; + } int ret = g_gui.PopupDialog( "Clear Modified State", @@ -1613,7 +1574,7 @@ void MainMenuBar::OnClearModifiedState(wxCommandEvent& WXUNUSED(event)) wxYES | wxNO ); - if(ret == wxID_YES) { + if (ret == wxID_YES) { // Editor will do the work editor->clearModifiedTileState(true); } @@ -1621,11 +1582,11 @@ void MainMenuBar::OnClearModifiedState(wxCommandEvent& WXUNUSED(event)) g_gui.RefreshView(); } -void MainMenuBar::OnMapCleanHouseItems(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnMapCleanHouseItems(wxCommandEvent &WXUNUSED(event)) { Editor* editor = g_gui.GetCurrentEditor(); - if(!editor) + if (!editor) { return; + } int ret = g_gui.PopupDialog( "Clear Moveable House Items", @@ -1633,37 +1594,34 @@ void MainMenuBar::OnMapCleanHouseItems(wxCommandEvent& WXUNUSED(event)) wxYES | wxNO ); - if(ret == wxID_YES) { + if (ret == wxID_YES) { // Editor will do the work - //editor->removeHouseItems(true); + // editor->removeHouseItems(true); } g_gui.RefreshView(); } -void MainMenuBar::OnMapEditTowns(wxCommandEvent& WXUNUSED(event)) -{ - if(g_gui.GetCurrentEditor()) { +void MainMenuBar::OnMapEditTowns(wxCommandEvent &WXUNUSED(event)) { + if (g_gui.GetCurrentEditor()) { wxDialog* town_dialog = newd EditTownsDialog(frame, *g_gui.GetCurrentEditor()); town_dialog->ShowModal(); town_dialog->Destroy(); } } -void MainMenuBar::OnMapEditItems(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnMapEditItems(wxCommandEvent &WXUNUSED(event)) { ; } -void MainMenuBar::OnMapEditMonsters(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnMapEditMonsters(wxCommandEvent &WXUNUSED(event)) { ; } -void MainMenuBar::OnMapStatistics(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsEditorOpen()) +void MainMenuBar::OnMapStatistics(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsEditorOpen()) { return; + } g_gui.CreateLoadBar("Collecting data..."); @@ -1703,88 +1661,97 @@ void MainMenuBar::OnMapStatistics(wxCommandEvent& WXUNUSED(event)) double sqm_per_house = 0.0; double sqm_per_town = 0.0; - for(MapIterator mit = map->begin(); mit != map->end(); ++mit) { + for (MapIterator mit = map->begin(); mit != map->end(); ++mit) { Tile* tile = (*mit)->get(); - if(load_counter % 8192 == 0) { + if (load_counter % 8192 == 0) { g_gui.SetLoadDone((unsigned int)(int64_t(load_counter) * 95ll / int64_t(map->getTileCount()))); } - if(tile->empty()) + if (tile->empty()) { continue; + } tile_count += 1; bool is_detailed = false; -#define ANALYZE_ITEM(_item) {\ - item_count += 1; \ - if(!(_item)->isGroundTile() && !(_item)->isBorder()) { \ - is_detailed = true; \ - const ItemType& it = g_items.getItemType((_item)->getID()); \ - if(it.moveable) { \ - loose_item_count += 1; \ - } \ - if(it.isDepot()) { \ - depot_count += 1; \ - } \ - if((_item)->getActionID() > 0) { \ - action_item_count += 1; \ - } \ - if((_item)->getUniqueID() > 0) { \ - unique_item_count += 1; \ - } \ - if(Container* c = dynamic_cast((_item))) { \ - if(c->getVector().size()) { \ - container_count += 1; \ - } \ - } \ - } \ -} - if(tile->ground) { +#define ANALYZE_ITEM(_item) \ + { \ + item_count += 1; \ + if (!(_item)->isGroundTile() && !(_item)->isBorder()) { \ + is_detailed = true; \ + const ItemType &it = g_items.getItemType((_item)->getID()); \ + if (it.moveable) { \ + loose_item_count += 1; \ + } \ + if (it.isDepot()) { \ + depot_count += 1; \ + } \ + if ((_item)->getActionID() > 0) { \ + action_item_count += 1; \ + } \ + if ((_item)->getUniqueID() > 0) { \ + unique_item_count += 1; \ + } \ + if (Container* c = dynamic_cast((_item))) { \ + if (c->getVector().size()) { \ + container_count += 1; \ + } \ + } \ + } \ + } + if (tile->ground) { ANALYZE_ITEM(tile->ground); } - for(Item* item : tile->items) { + for (Item* item : tile->items) { ANALYZE_ITEM(item); } #undef ANALYZE_ITEM - if(tile->spawnMonster) + if (tile->spawnMonster) { spawn_monster_count += 1; + } - if(tile->spawnNpc) + if (tile->spawnNpc) { spawn_npc_count += 1; + } - if(tile->monster) + if (tile->monster) { monster_count += 1; + } - if(tile->npc) + if (tile->npc) { npc_count += 1; + } - if(tile->isBlocking()) + if (tile->isBlocking()) { blocking_tile_count += 1; - else + } else { walkable_tile_count += 1; + } - if(is_detailed) + if (is_detailed) { detailed_tile_count += 1; + } load_counter += 1; } - monsters_per_spawn = (spawn_monster_count != 0? double(monster_count) / double(spawn_monster_count) : -1.0); - npcs_per_spawn = (spawn_npc_count != 0? double(npc_count) / double(spawn_npc_count) : -1.0); - percent_pathable = 100.0*(tile_count != 0? double(walkable_tile_count) / double(tile_count) : -1.0); - percent_detailed = 100.0*(tile_count != 0? double(detailed_tile_count) / double(tile_count) : -1.0); + monsters_per_spawn = (spawn_monster_count != 0 ? double(monster_count) / double(spawn_monster_count) : -1.0); + npcs_per_spawn = (spawn_npc_count != 0 ? double(npc_count) / double(spawn_npc_count) : -1.0); + percent_pathable = 100.0 * (tile_count != 0 ? double(walkable_tile_count) / double(tile_count) : -1.0); + percent_detailed = 100.0 * (tile_count != 0 ? double(detailed_tile_count) / double(tile_count) : -1.0); load_counter = 0; - Houses& houses = map->houses; - for(HouseMap::const_iterator hit = houses.begin(); hit != houses.end(); ++hit) { + Houses &houses = map->houses; + for (HouseMap::const_iterator hit = houses.begin(); hit != houses.end(); ++hit) { const House* house = hit->second; - if(load_counter % 64) + if (load_counter % 64) { g_gui.SetLoadDone((unsigned int)(95ll + int64_t(load_counter) * 5ll / int64_t(house_count))); + } - if(house->size() > largest_house_size) { + if (house->size() > largest_house_size) { largest_house = house; largest_house_size = house->size(); } @@ -1792,20 +1759,19 @@ void MainMenuBar::OnMapStatistics(wxCommandEvent& WXUNUSED(event)) town_sqm_count[house->townid] += house->size(); } - houses_per_town = (town_count != 0? double(house_count) / double(town_count) : -1.0); - sqm_per_house = (house_count != 0? double(total_house_sqm) / double(house_count) : -1.0); - sqm_per_town = (town_count != 0? double(total_house_sqm) / double(town_count) : -1.0); + houses_per_town = (town_count != 0 ? double(house_count) / double(town_count) : -1.0); + sqm_per_house = (house_count != 0 ? double(total_house_sqm) / double(house_count) : -1.0); + sqm_per_town = (town_count != 0 ? double(total_house_sqm) / double(town_count) : -1.0); - Towns& towns = map->towns; - for(std::map::iterator town_iter = town_sqm_count.begin(); - town_iter != town_sqm_count.end(); - ++town_iter) - { + Towns &towns = map->towns; + for (std::map::iterator town_iter = town_sqm_count.begin(); + town_iter != town_sqm_count.end(); + ++town_iter) { // No load bar for this, load is non-existant uint32_t town_id = town_iter->first; uint32_t town_sqm = town_iter->second; Town* town = towns.getTown(town_id); - if(town && town_sqm > largest_town_size) { + if (town && town_sqm > largest_town_size) { largest_town = town; largest_town_size = town_sqm; } else { @@ -1823,11 +1789,13 @@ void MainMenuBar::OnMapStatistics(wxCommandEvent& WXUNUSED(event)) os << "\t\tTotal number of tiles: " << tile_count << "\n"; os << "\t\tNumber of pathable tiles: " << walkable_tile_count << "\n"; os << "\t\tNumber of unpathable tiles: " << blocking_tile_count << "\n"; - if(percent_pathable >= 0.0) + if (percent_pathable >= 0.0) { os << "\t\tPercent walkable tiles: " << percent_pathable << "%\n"; + } os << "\t\tDetailed tiles: " << detailed_tile_count << "\n"; - if(percent_detailed >= 0.0) + if (percent_detailed >= 0.0) { os << "\t\tPercent detailed tiles: " << percent_detailed << "%\n"; + } os << "\tItem data:\n"; os << "\t\tTotal number of items: " << item_count << "\n"; @@ -1842,33 +1810,39 @@ void MainMenuBar::OnMapStatistics(wxCommandEvent& WXUNUSED(event)) os << "\t\tTotal monster spawn count: " << spawn_monster_count << "\n"; os << "\t\tTotal npc count: " << npc_count << "\n"; os << "\t\tTotal npc spawn count: " << spawn_npc_count << "\n"; - if(monsters_per_spawn >= 0) + if (monsters_per_spawn >= 0) { os << "\t\tMean monsters per spawn: " << monsters_per_spawn << "\n"; + } - if(npcs_per_spawn >= 0) + if (npcs_per_spawn >= 0) { os << "\t\tMean npcs per spawn: " << npcs_per_spawn << "\n"; + } os << "\tTown/House data:\n"; os << "\t\tTotal number of towns: " << town_count << "\n"; os << "\t\tTotal number of houses: " << house_count << "\n"; - if(houses_per_town >= 0) + if (houses_per_town >= 0) { os << "\t\tMean houses per town: " << houses_per_town << "\n"; + } os << "\t\tTotal amount of housetiles: " << total_house_sqm << "\n"; - if(sqm_per_house >= 0) + if (sqm_per_house >= 0) { os << "\t\tMean tiles per house: " << sqm_per_house << "\n"; - if(sqm_per_town >= 0) + } + if (sqm_per_town >= 0) { os << "\t\tMean tiles per town: " << sqm_per_town << "\n"; + } - if(largest_town) + if (largest_town) { os << "\t\tLargest Town: \"" << largest_town->getName() << "\" (" << largest_town_size << " sqm)\n"; - if(largest_house) + } + if (largest_house) { os << "\t\tLargest House: \"" << largest_house->name << "\" (" << largest_house_size << " sqm)\n"; + } os << "\n"; os << "Generated by Remere's Map Editor version " + __RME_VERSION__ + "\n"; - - wxDialog* dg = newd wxDialog(frame, wxID_ANY, "Map Statistics", wxDefaultPosition, wxDefaultSize, wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX); + wxDialog* dg = newd wxDialog(frame, wxID_ANY, "Map Statistics", wxDefaultPosition, wxDefaultSize, wxRESIZE_BORDER | wxCAPTION | wxCLOSE_BOX); wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); wxTextCtrl* text_field = newd wxTextCtrl(dg, wxID_ANY, wxstr(os.str()), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY); text_field->SetMinSize(wxSize(400, 300)); @@ -1885,37 +1859,36 @@ void MainMenuBar::OnMapStatistics(wxCommandEvent& WXUNUSED(event)) int ret = dg->ShowModal(); - if(ret == wxID_OK) { - //std::cout << "XML EXPORT"; - } else if(ret == wxID_CANCEL) { - //std::cout << "OK"; + if (ret == wxID_OK) { + // std::cout << "XML EXPORT"; + } else if (ret == wxID_CANCEL) { + // std::cout << "OK"; } } -void MainMenuBar::OnMapCleanup(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnMapCleanup(wxCommandEvent &WXUNUSED(event)) { int ok = g_gui.PopupDialog("Clean map", "Do you want to remove all invalid items from the map?", wxYES | wxNO); - if(ok == wxID_YES) + if (ok == wxID_YES) { g_gui.GetCurrentMap().cleanInvalidTiles(true); + } } -void MainMenuBar::OnMapProperties(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnMapProperties(wxCommandEvent &WXUNUSED(event)) { wxDialog* properties = newd MapPropertiesWindow( frame, static_cast(g_gui.GetCurrentTab()), - *g_gui.GetCurrentEditor()); + *g_gui.GetCurrentEditor() + ); - if(properties->ShowModal() == 0) { + if (properties->ShowModal() == 0) { // FAIL! g_gui.CloseAllEditors(); } properties->Destroy(); } -void MainMenuBar::OnToolbars(wxCommandEvent& event) -{ +void MainMenuBar::OnToolbars(wxCommandEvent &event) { using namespace MenuBar; ActionID id = static_cast(event.GetId() - (wxID_HIGHEST + 1)); @@ -1940,57 +1913,51 @@ void MainMenuBar::OnToolbars(wxCommandEvent& event) g_gui.ShowToolbar(TOOLBAR_STANDARD, event.IsChecked()); g_settings.setInteger(Config::SHOW_TOOLBAR_STANDARD, event.IsChecked()); break; - default: - break; + default: + break; } } -void MainMenuBar::OnNewView(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnNewView(wxCommandEvent &WXUNUSED(event)) { g_gui.NewMapView(); } -void MainMenuBar::OnToggleFullscreen(wxCommandEvent& WXUNUSED(event)) -{ - if(frame->IsFullScreen()) +void MainMenuBar::OnToggleFullscreen(wxCommandEvent &WXUNUSED(event)) { + if (frame->IsFullScreen()) { frame->ShowFullScreen(false); - else + } else { frame->ShowFullScreen(true, wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION); + } } -void MainMenuBar::OnTakeScreenshot(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnTakeScreenshot(wxCommandEvent &WXUNUSED(event)) { wxString path = wxstr(g_settings.getString(Config::SCREENSHOT_DIRECTORY)); - if(path.size() > 0 && (path.Last() == '/' || path.Last() == '\\')) + if (path.size() > 0 && (path.Last() == '/' || path.Last() == '\\')) { path = path + "/"; + } g_gui.GetCurrentMapTab()->GetView()->GetCanvas()->TakeScreenshot( path, wxstr(g_settings.getString(Config::SCREENSHOT_FORMAT)) ); - } -void MainMenuBar::OnZoomIn(wxCommandEvent& event) -{ +void MainMenuBar::OnZoomIn(wxCommandEvent &event) { double zoom = g_gui.GetCurrentZoom(); g_gui.SetCurrentZoom(zoom - 0.1); } -void MainMenuBar::OnZoomOut(wxCommandEvent& event) -{ +void MainMenuBar::OnZoomOut(wxCommandEvent &event) { double zoom = g_gui.GetCurrentZoom(); g_gui.SetCurrentZoom(zoom + 0.1); } -void MainMenuBar::OnZoomNormal(wxCommandEvent& event) -{ +void MainMenuBar::OnZoomNormal(wxCommandEvent &event) { g_gui.SetCurrentZoom(1.0); } -void MainMenuBar::OnChangeViewSettings(wxCommandEvent& event) -{ +void MainMenuBar::OnChangeViewSettings(wxCommandEvent &event) { g_settings.setInteger(Config::SHOW_ALL_FLOORS, IsItemChecked(MenuBar::SHOW_ALL_FLOORS)); - if(IsItemChecked(MenuBar::SHOW_ALL_FLOORS)) { + if (IsItemChecked(MenuBar::SHOW_ALL_FLOORS)) { EnableItem(MenuBar::SELECT_MODE_VISIBLE, true); EnableItem(MenuBar::SELECT_MODE_LOWER, true); } else { @@ -2028,82 +1995,70 @@ void MainMenuBar::OnChangeViewSettings(wxCommandEvent& event) g_gui.root->GetAuiToolBar()->UpdateIndicators(); } -void MainMenuBar::OnChangeFloor(wxCommandEvent& event) -{ +void MainMenuBar::OnChangeFloor(wxCommandEvent &event) { // Workaround to stop events from looping - if(checking_programmaticly) + if (checking_programmaticly) { return; + } - for(int i = 0; i < 16; ++i) { - if(IsItemChecked(MenuBar::ActionID(MenuBar::FLOOR_0 + i))) { + for (int i = 0; i < 16; ++i) { + if (IsItemChecked(MenuBar::ActionID(MenuBar::FLOOR_0 + i))) { g_gui.ChangeFloor(i); } } } -void MainMenuBar::OnMinimapWindow(wxCommandEvent& event) -{ +void MainMenuBar::OnMinimapWindow(wxCommandEvent &event) { g_gui.CreateMinimap(); } -void MainMenuBar::OnActionsHistoryWindow(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnActionsHistoryWindow(wxCommandEvent &WXUNUSED(event)) { g_gui.ShowActionsWindow(); } -void MainMenuBar::OnNewPalette(wxCommandEvent& event) -{ +void MainMenuBar::OnNewPalette(wxCommandEvent &event) { g_gui.NewPalette(); } -void MainMenuBar::OnSelectTerrainPalette(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSelectTerrainPalette(wxCommandEvent &WXUNUSED(event)) { g_gui.SelectPalettePage(TILESET_TERRAIN); } -void MainMenuBar::OnSelectDoodadPalette(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSelectDoodadPalette(wxCommandEvent &WXUNUSED(event)) { g_gui.SelectPalettePage(TILESET_DOODAD); } -void MainMenuBar::OnSelectItemPalette(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSelectItemPalette(wxCommandEvent &WXUNUSED(event)) { g_gui.SelectPalettePage(TILESET_ITEM); } -void MainMenuBar::OnSelectHousePalette(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSelectHousePalette(wxCommandEvent &WXUNUSED(event)) { g_gui.SelectPalettePage(TILESET_HOUSE); } -void MainMenuBar::OnSelectMonsterPalette(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSelectMonsterPalette(wxCommandEvent &WXUNUSED(event)) { g_gui.SelectPalettePage(TILESET_MONSTER); } -void MainMenuBar::OnSelectNpcPalette(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSelectNpcPalette(wxCommandEvent &WXUNUSED(event)) { g_gui.SelectPalettePage(TILESET_NPC); } -void MainMenuBar::OnSelectWaypointPalette(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSelectWaypointPalette(wxCommandEvent &WXUNUSED(event)) { g_gui.SelectPalettePage(TILESET_WAYPOINT); } -void MainMenuBar::OnSelectRawPalette(wxCommandEvent& WXUNUSED(event)) -{ +void MainMenuBar::OnSelectRawPalette(wxCommandEvent &WXUNUSED(event)) { g_gui.SelectPalettePage(TILESET_RAW); } -void MainMenuBar::OnStartLive(wxCommandEvent& event) -{ +void MainMenuBar::OnStartLive(wxCommandEvent &event) { Editor* editor = g_gui.GetCurrentEditor(); - if(!editor) { + if (!editor) { g_gui.PopupDialog("Error", "You need to have a map open to start a live mapping session.", wxOK); return; } - if(editor->IsLive()) { + if (editor->IsLive()) { g_gui.PopupDialog("Error", "You can not start two live servers on the same map (or a server using a remote map).", wxOK); return; } @@ -2142,37 +2097,37 @@ void MainMenuBar::OnStartLive(wxCommandEvent& event) live_host_dlg->SetSizerAndFit(top_sizer); - while(true) { + while (true) { int ret = live_host_dlg->ShowModal(); - if(ret == wxID_OK) { + if (ret == wxID_OK) { LiveServer* liveServer = editor->StartLiveServer(); liveServer->setName(hostname->GetValue()); liveServer->setPassword(password->GetValue()); liveServer->setPort(port->GetValue()); - const wxString& error = liveServer->getLastError(); - if(!error.empty()) { + const wxString &error = liveServer->getLastError(); + if (!error.empty()) { g_gui.PopupDialog(live_host_dlg, "Error", error, wxOK); editor->CloseLiveServer(); continue; } - if(!liveServer->bind()) { + if (!liveServer->bind()) { g_gui.PopupDialog("Socket Error", "Could not bind socket! Try another port?", wxOK); editor->CloseLiveServer(); } else { liveServer->createLogWindow(g_gui.tabbook); } break; - } else + } else { break; + } } live_host_dlg->Destroy(); Update(); } -void MainMenuBar::OnJoinLive(wxCommandEvent& event) -{ +void MainMenuBar::OnJoinLive(wxCommandEvent &event) { wxDialog* live_join_dlg = newd wxDialog(frame, wxID_ANY, "Join Live Server", wxDefaultPosition, wxDefaultSize); wxSizer* top_sizer = newd wxBoxSizer(wxVERTICAL); @@ -2207,63 +2162,66 @@ void MainMenuBar::OnJoinLive(wxCommandEvent& event) live_join_dlg->SetSizerAndFit(top_sizer); - while(true) { + while (true) { int ret = live_join_dlg->ShowModal(); - if(ret == wxID_OK) { + if (ret == wxID_OK) { LiveClient* liveClient = newd LiveClient(); liveClient->setPassword(password->GetValue()); wxString tmp = name->GetValue(); - if(tmp.empty()) { + if (tmp.empty()) { tmp = "User"; } liveClient->setName(tmp); - const wxString& error = liveClient->getLastError(); - if(!error.empty()) { + const wxString &error = liveClient->getLastError(); + if (!error.empty()) { g_gui.PopupDialog(live_join_dlg, "Error", error, wxOK); delete liveClient; continue; } - const wxString& address = ip->GetValue(); + const wxString &address = ip->GetValue(); int32_t portNumber = port->GetValue(); liveClient->createLogWindow(g_gui.tabbook); - if(!liveClient->connect(nstr(address), portNumber)) { + if (!liveClient->connect(nstr(address), portNumber)) { g_gui.PopupDialog("Connection Error", liveClient->getLastError(), wxOK); delete liveClient; } break; - } else + } else { break; + } } live_join_dlg->Destroy(); Update(); } -void MainMenuBar::OnCloseLive(wxCommandEvent& event) -{ +void MainMenuBar::OnCloseLive(wxCommandEvent &event) { Editor* editor = g_gui.GetCurrentEditor(); - if(editor && editor->IsLive()) + if (editor && editor->IsLive()) { g_gui.CloseLiveEditors(&editor->GetLive()); + } Update(); } -void MainMenuBar::SearchItems(bool unique, bool action, bool container, bool writable, bool onSelection/* = false*/) -{ - if (!unique && !action && !container && !writable) +void MainMenuBar::SearchItems(bool unique, bool action, bool container, bool writable, bool onSelection /* = false*/) { + if (!unique && !action && !container && !writable) { return; + } - if(!g_gui.IsEditorOpen()) + if (!g_gui.IsEditorOpen()) { return; + } - if(onSelection) + if (onSelection) { g_gui.CreateLoadBar("Searching on selected area..."); - else + } else { g_gui.CreateLoadBar("Searching on map..."); + } OnSearchForStuff::Searcher searcher; searcher.search_unique = unique; @@ -2273,13 +2231,13 @@ void MainMenuBar::SearchItems(bool unique, bool action, bool container, bool wri foreach_ItemOnMap(g_gui.GetCurrentMap(), searcher, onSelection); searcher.sort(); - std::vector >& found = searcher.found; + std::vector> &found = searcher.found; g_gui.DestroyLoadBar(); SearchResultWindow* result = g_gui.ShowSearchWindow(); result->Clear(); - for(std::vector >::iterator iter = found.begin(); iter != found.end(); ++iter) { + for (std::vector>::iterator iter = found.begin(); iter != found.end(); ++iter) { result->AddPosition(searcher.desc(iter->second), iter->first->getPosition()); } } diff --git a/source/main_menubar.h b/source/main_menubar.h index 5b3e8634..a7039b6f 100644 --- a/source/main_menubar.h +++ b/source/main_menubar.h @@ -15,14 +15,12 @@ // along with this program. If not, see . ////////////////////////////////////////////////////////////////////// - #ifndef RME_MAIN_BAR_H_ #define RME_MAIN_BAR_H_ #include -namespace MenuBar -{ +namespace MenuBar { struct Action; enum ActionID { @@ -162,13 +160,12 @@ namespace MenuBar class MainFrame; -class MainMenuBar : public wxEvtHandler -{ +class MainMenuBar : public wxEvtHandler { public: MainMenuBar(MainFrame* frame); virtual ~MainMenuBar(); - bool Load(const FileName&, wxArrayString& warnings, wxString& error); + bool Load(const FileName &, wxArrayString &warnings, wxString &error); // Update // Turn on/off all buttons according to current editor state @@ -188,127 +185,127 @@ class MainMenuBar : public wxEvtHandler // Event handlers for all menu buttons // File Menu - void OnNew(wxCommandEvent& event); - void OnOpen(wxCommandEvent& event); - void OnGenerateMap(wxCommandEvent& event); - void OnOpenRecent(wxCommandEvent& event); - void OnSave(wxCommandEvent& event); - void OnSaveAs(wxCommandEvent& event); - void OnClose(wxCommandEvent& event); - void OnPreferences(wxCommandEvent& event); - void OnQuit(wxCommandEvent& event); + void OnNew(wxCommandEvent &event); + void OnOpen(wxCommandEvent &event); + void OnGenerateMap(wxCommandEvent &event); + void OnOpenRecent(wxCommandEvent &event); + void OnSave(wxCommandEvent &event); + void OnSaveAs(wxCommandEvent &event); + void OnClose(wxCommandEvent &event); + void OnPreferences(wxCommandEvent &event); + void OnQuit(wxCommandEvent &event); // Import Menu // Export Menu - void OnImportMap(wxCommandEvent& event); - void OnImportMonsterData(wxCommandEvent& event); - void OnImportNpcData(wxCommandEvent& event); - void OnImportMinimap(wxCommandEvent& event); - void OnExportMinimap(wxCommandEvent& event); - void OnReloadDataFiles(wxCommandEvent& event); + void OnImportMap(wxCommandEvent &event); + void OnImportMonsterData(wxCommandEvent &event); + void OnImportNpcData(wxCommandEvent &event); + void OnImportMinimap(wxCommandEvent &event); + void OnExportMinimap(wxCommandEvent &event); + void OnReloadDataFiles(wxCommandEvent &event); // Edit Menu - void OnUndo(wxCommandEvent& event); - void OnRedo(wxCommandEvent& event); - void OnBorderizeSelection(wxCommandEvent& event); - void OnBorderizeMap(wxCommandEvent& event); - void OnRandomizeSelection(wxCommandEvent& event); - void OnRandomizeMap(wxCommandEvent& event); - void OnJumpToBrush(wxCommandEvent& event); - void OnJumpToItemBrush(wxCommandEvent& event); - void OnGotoPreviousPosition(wxCommandEvent& event); - void OnGotoPosition(wxCommandEvent& event); - void OnMapRemoveItems(wxCommandEvent& event); - void OnMapRemoveCorpses(wxCommandEvent& event); - void OnMapRemoveUnreachable(wxCommandEvent& event); - void OnMapRemoveEmptyMonsterSpawns(wxCommandEvent& event); - void OnMapRemoveEmptyNpcSpawns(wxCommandEvent& event); - void OnClearHouseTiles(wxCommandEvent& event); - void OnClearModifiedState(wxCommandEvent& event); - void OnToggleAutomagic(wxCommandEvent& event); - void OnSelectionTypeChange(wxCommandEvent& event); - void OnCut(wxCommandEvent& event); - void OnCopy(wxCommandEvent& event); - void OnPaste(wxCommandEvent& event); - void OnSearchForItem(wxCommandEvent& event); - void OnReplaceItems(wxCommandEvent& event); - void OnSearchForStuffOnMap(wxCommandEvent& event); - void OnSearchForUniqueOnMap(wxCommandEvent& event); - void OnSearchForActionOnMap(wxCommandEvent& event); - void OnSearchForContainerOnMap(wxCommandEvent& event); - void OnSearchForWriteableOnMap(wxCommandEvent& event); + void OnUndo(wxCommandEvent &event); + void OnRedo(wxCommandEvent &event); + void OnBorderizeSelection(wxCommandEvent &event); + void OnBorderizeMap(wxCommandEvent &event); + void OnRandomizeSelection(wxCommandEvent &event); + void OnRandomizeMap(wxCommandEvent &event); + void OnJumpToBrush(wxCommandEvent &event); + void OnJumpToItemBrush(wxCommandEvent &event); + void OnGotoPreviousPosition(wxCommandEvent &event); + void OnGotoPosition(wxCommandEvent &event); + void OnMapRemoveItems(wxCommandEvent &event); + void OnMapRemoveCorpses(wxCommandEvent &event); + void OnMapRemoveUnreachable(wxCommandEvent &event); + void OnMapRemoveEmptyMonsterSpawns(wxCommandEvent &event); + void OnMapRemoveEmptyNpcSpawns(wxCommandEvent &event); + void OnClearHouseTiles(wxCommandEvent &event); + void OnClearModifiedState(wxCommandEvent &event); + void OnToggleAutomagic(wxCommandEvent &event); + void OnSelectionTypeChange(wxCommandEvent &event); + void OnCut(wxCommandEvent &event); + void OnCopy(wxCommandEvent &event); + void OnPaste(wxCommandEvent &event); + void OnSearchForItem(wxCommandEvent &event); + void OnReplaceItems(wxCommandEvent &event); + void OnSearchForStuffOnMap(wxCommandEvent &event); + void OnSearchForUniqueOnMap(wxCommandEvent &event); + void OnSearchForActionOnMap(wxCommandEvent &event); + void OnSearchForContainerOnMap(wxCommandEvent &event); + void OnSearchForWriteableOnMap(wxCommandEvent &event); // Select menu - void OnSearchForStuffOnSelection(wxCommandEvent& event); - void OnSearchForUniqueOnSelection(wxCommandEvent& event); - void OnSearchForActionOnSelection(wxCommandEvent& event); - void OnSearchForContainerOnSelection(wxCommandEvent& event); - void OnSearchForWriteableOnSelection(wxCommandEvent& event); - void OnSearchForItemOnSelection(wxCommandEvent& event); - void OnReplaceItemsOnSelection(wxCommandEvent& event); - void OnRemoveItemOnSelection(wxCommandEvent& event); + void OnSearchForStuffOnSelection(wxCommandEvent &event); + void OnSearchForUniqueOnSelection(wxCommandEvent &event); + void OnSearchForActionOnSelection(wxCommandEvent &event); + void OnSearchForContainerOnSelection(wxCommandEvent &event); + void OnSearchForWriteableOnSelection(wxCommandEvent &event); + void OnSearchForItemOnSelection(wxCommandEvent &event); + void OnReplaceItemsOnSelection(wxCommandEvent &event); + void OnRemoveItemOnSelection(wxCommandEvent &event); // Map menu - void OnMapEditTowns(wxCommandEvent& event); - void OnMapEditItems(wxCommandEvent& event); - void OnMapEditMonsters(wxCommandEvent& event); - void OnMapCleanHouseItems(wxCommandEvent& event); - void OnMapCleanup(wxCommandEvent& event); - void OnMapProperties(wxCommandEvent& event); - void OnMapStatistics(wxCommandEvent& event); + void OnMapEditTowns(wxCommandEvent &event); + void OnMapEditItems(wxCommandEvent &event); + void OnMapEditMonsters(wxCommandEvent &event); + void OnMapCleanHouseItems(wxCommandEvent &event); + void OnMapCleanup(wxCommandEvent &event); + void OnMapProperties(wxCommandEvent &event); + void OnMapStatistics(wxCommandEvent &event); // View Menu - void OnToolbars(wxCommandEvent& event); - void OnNewView(wxCommandEvent& event); - void OnToggleFullscreen(wxCommandEvent& event); - void OnZoomIn(wxCommandEvent& event); - void OnZoomOut(wxCommandEvent& event); - void OnZoomNormal(wxCommandEvent& event); - void OnChangeViewSettings(wxCommandEvent& event); + void OnToolbars(wxCommandEvent &event); + void OnNewView(wxCommandEvent &event); + void OnToggleFullscreen(wxCommandEvent &event); + void OnZoomIn(wxCommandEvent &event); + void OnZoomOut(wxCommandEvent &event); + void OnZoomNormal(wxCommandEvent &event); + void OnChangeViewSettings(wxCommandEvent &event); // Network menu - void OnStartLive(wxCommandEvent& event); - void OnJoinLive(wxCommandEvent& event); - void OnCloseLive(wxCommandEvent& event); + void OnStartLive(wxCommandEvent &event); + void OnJoinLive(wxCommandEvent &event); + void OnCloseLive(wxCommandEvent &event); // Window Menu - void OnMinimapWindow(wxCommandEvent& event); - void OnActionsHistoryWindow(wxCommandEvent& event); - void OnNewPalette(wxCommandEvent& event); - void OnTakeScreenshot(wxCommandEvent& event); - void OnSelectTerrainPalette(wxCommandEvent& event); - void OnSelectDoodadPalette(wxCommandEvent& event); - void OnSelectItemPalette(wxCommandEvent& event); - void OnSelectHousePalette(wxCommandEvent& event); - void OnSelectMonsterPalette(wxCommandEvent& event); - void OnSelectNpcPalette(wxCommandEvent& event); - void OnSelectWaypointPalette(wxCommandEvent& event); - void OnSelectRawPalette(wxCommandEvent& event); + void OnMinimapWindow(wxCommandEvent &event); + void OnActionsHistoryWindow(wxCommandEvent &event); + void OnNewPalette(wxCommandEvent &event); + void OnTakeScreenshot(wxCommandEvent &event); + void OnSelectTerrainPalette(wxCommandEvent &event); + void OnSelectDoodadPalette(wxCommandEvent &event); + void OnSelectItemPalette(wxCommandEvent &event); + void OnSelectHousePalette(wxCommandEvent &event); + void OnSelectMonsterPalette(wxCommandEvent &event); + void OnSelectNpcPalette(wxCommandEvent &event); + void OnSelectWaypointPalette(wxCommandEvent &event); + void OnSelectRawPalette(wxCommandEvent &event); // Floor menu - void OnChangeFloor(wxCommandEvent& event); + void OnChangeFloor(wxCommandEvent &event); // About Menu - void OnDebugViewDat(wxCommandEvent& event); - void OnListExtensions(wxCommandEvent& event); - void OnGotoWebsite(wxCommandEvent& event); - void OnAbout(wxCommandEvent& event); + void OnDebugViewDat(wxCommandEvent &event); + void OnListExtensions(wxCommandEvent &event); + void OnGotoWebsite(wxCommandEvent &event); + void OnAbout(wxCommandEvent &event); protected: // Load and returns a menu item, also sets accelerator - wxObject* LoadItem(pugi::xml_node node, wxMenu* parent, wxArrayString& warnings, wxString& error); + wxObject* LoadItem(pugi::xml_node node, wxMenu* parent, wxArrayString &warnings, wxString &error); // Checks the items in the menus according to the settings (in config) void LoadValues(); void SearchItems(bool unique, bool action, bool container, bool writable, bool onSelection = false); -protected: +protected: MainFrame* frame; wxMenuBar* menubar; // Used so that calling Check on menu items don't trigger events (avoids infinite recursion) bool checking_programmaticly; - std::map > items; + std::map> items; // Hardcoded recent files wxFileHistory recentFiles; @@ -318,13 +315,12 @@ class MainMenuBar : public wxEvtHandler DECLARE_EVENT_TABLE(); }; -namespace MenuBar -{ - struct Action - { - Action() : id(0), kind(wxITEM_NORMAL) {} - Action(std::string s, int id, wxItemKind kind, wxCommandEventFunction handler) - : id(id), setting(0), name(s), kind(kind), handler(handler) {} +namespace MenuBar { + struct Action { + Action() : + id(0), kind(wxITEM_NORMAL) { } + Action(std::string s, int id, wxItemKind kind, wxCommandEventFunction handler) : + id(id), setting(0), name(s), kind(kind), handler(handler) { } int id; int setting; diff --git a/source/main_toolbar.cpp b/source/main_toolbar.cpp index ddf3a9d3..02a74d1b 100644 --- a/source/main_toolbar.cpp +++ b/source/main_toolbar.cpp @@ -31,16 +31,16 @@ const wxString MainToolBar::SIZES_BAR_NAME = "sizes_toolbar"; const wxString MainToolBar::INDICATORS_BAR_NAME = "indicators_toolbar"; #define loadPNGFile(name) _wxGetBitmapFromMemory(name, sizeof(name)) -inline wxBitmap* _wxGetBitmapFromMemory(const unsigned char* data, int length) -{ +inline wxBitmap* _wxGetBitmapFromMemory(const unsigned char* data, int length) { wxMemoryInputStream is(data, length); wxImage img(is, "image/png"); - if (!img.IsOk()) return nullptr; + if (!img.IsOk()) { + return nullptr; + } return newd wxBitmap(img, -1); } -MainToolBar::MainToolBar(wxWindow* parent, wxAuiManager* manager) -{ +MainToolBar::MainToolBar(wxWindow* parent, wxAuiManager* manager) { wxSize icon_size = FROM_DIP(parent, wxSize(16, 16)); wxBitmap new_bitmap = wxArtProvider::GetBitmap(wxART_NEW, wxART_TOOLBAR, icon_size); wxBitmap open_bitmap = wxArtProvider::GetBitmap(wxART_FILE_OPEN, wxART_TOOLBAR, icon_size); @@ -178,8 +178,7 @@ MainToolBar::MainToolBar(wxWindow* parent, wxAuiManager* manager) HideAll(); } -MainToolBar::~MainToolBar() -{ +MainToolBar::~MainToolBar() { standard_toolbar->Unbind(wxEVT_COMMAND_MENU_SELECTED, &MainToolBar::OnStandardButtonClick, this); brushes_toolbar->Unbind(wxEVT_COMMAND_MENU_SELECTED, &MainToolBar::OnBrushesButtonClick, this); x_control->Unbind(wxEVT_TEXT_PASTE, &MainToolBar::OnPastePositionText, this); @@ -193,10 +192,9 @@ MainToolBar::~MainToolBar() indicators_toolbar->Unbind(wxEVT_COMMAND_MENU_SELECTED, &MainToolBar::OnIndicatorsButtonClick, this); } -void MainToolBar::UpdateButtons() -{ +void MainToolBar::UpdateButtons() { Editor* editor = g_gui.GetCurrentEditor(); - if(editor) { + if (editor) { standard_toolbar->EnableTool(wxID_UNDO, editor->canUndo()); standard_toolbar->EnableTool(wxID_REDO, editor->canRedo()); standard_toolbar->EnableTool(wxID_PASTE, editor->copybuffer.canPaste()); @@ -251,8 +249,7 @@ void MainToolBar::UpdateButtons() sizes_toolbar->Refresh(); } -void MainToolBar::UpdateBrushButtons() -{ +void MainToolBar::UpdateBrushButtons() { Brush* brush = g_gui.GetCurrentBrush(); if (brush) { brushes_toolbar->ToggleTool(PALETTE_TERRAIN_OPTIONAL_BORDER_TOOL, brush == g_gui.optional_brush); @@ -284,8 +281,7 @@ void MainToolBar::UpdateBrushButtons() g_gui.GetAuiManager()->Update(); } -void MainToolBar::UpdateIndicators() -{ +void MainToolBar::UpdateIndicators() { indicators_toolbar->ToggleTool(TOOLBAR_HOOKS, g_settings.getBoolean(Config::SHOW_WALL_HOOKS)); indicators_toolbar->ToggleTool(TOOLBAR_PICKUPABLES, g_settings.getBoolean(Config::SHOW_PICKUPABLES)); indicators_toolbar->ToggleTool(TOOLBAR_MOVEABLES, g_settings.getBoolean(Config::SHOW_MOVEABLES)); @@ -293,8 +289,7 @@ void MainToolBar::UpdateIndicators() g_gui.GetAuiManager()->Update(); } -void MainToolBar::UpdateBrushSize(BrushShape shape, int size) -{ +void MainToolBar::UpdateBrushSize(BrushShape shape, int size) { if (shape == BRUSHSHAPE_CIRCLE) { sizes_toolbar->ToggleTool(TOOLBAR_SIZES_CIRCULAR, true); sizes_toolbar->ToggleTool(TOOLBAR_SIZES_RECTANGULAR, false); @@ -332,11 +327,10 @@ void MainToolBar::UpdateBrushSize(BrushShape shape, int size) g_gui.GetAuiManager()->Update(); } -void MainToolBar::Show(ToolBarID id, bool show) -{ +void MainToolBar::Show(ToolBarID id, bool show) { wxAuiManager* manager = g_gui.GetAuiManager(); if (manager) { - wxAuiPaneInfo& pane = GetPane(id); + wxAuiPaneInfo &pane = GetPane(id); if (pane.IsOk()) { pane.Show(show); manager->Update(); @@ -344,76 +338,88 @@ void MainToolBar::Show(ToolBarID id, bool show) } } -void MainToolBar::HideAll(bool update) -{ +void MainToolBar::HideAll(bool update) { wxAuiManager* manager = g_gui.GetAuiManager(); - if (!manager) + if (!manager) { return; + } - wxAuiPaneInfoArray& panes = manager->GetAllPanes(); + wxAuiPaneInfoArray &panes = manager->GetAllPanes(); for (int i = 0, count = panes.GetCount(); i < count; ++i) { - if (!panes.Item(i).IsToolbar()) + if (!panes.Item(i).IsToolbar()) { panes.Item(i).Hide(); + } } - if (update) + if (update) { manager->Update(); + } } -void MainToolBar::LoadPerspective() -{ +void MainToolBar::LoadPerspective() { wxAuiManager* manager = g_gui.GetAuiManager(); - if (!manager) + if (!manager) { return; + } if (g_settings.getBoolean(Config::SHOW_TOOLBAR_STANDARD)) { std::string info = g_settings.getString(Config::TOOLBAR_STANDARD_LAYOUT); - if (!info.empty()) + if (!info.empty()) { manager->LoadPaneInfo(wxString(info), GetPane(TOOLBAR_STANDARD)); + } GetPane(TOOLBAR_STANDARD).Show(); - } else + } else { GetPane(TOOLBAR_STANDARD).Hide(); + } if (g_settings.getBoolean(Config::SHOW_TOOLBAR_BRUSHES)) { std::string info = g_settings.getString(Config::TOOLBAR_BRUSHES_LAYOUT); - if (!info.empty()) + if (!info.empty()) { manager->LoadPaneInfo(wxString(info), GetPane(TOOLBAR_BRUSHES)); + } GetPane(TOOLBAR_BRUSHES).Show(); - } else + } else { GetPane(TOOLBAR_BRUSHES).Hide(); + } if (g_settings.getBoolean(Config::SHOW_TOOLBAR_POSITION)) { std::string info = g_settings.getString(Config::TOOLBAR_POSITION_LAYOUT); - if (!info.empty()) + if (!info.empty()) { manager->LoadPaneInfo(wxString(info), GetPane(TOOLBAR_POSITION)); + } GetPane(TOOLBAR_POSITION).Show(); - } else + } else { GetPane(TOOLBAR_POSITION).Hide(); + } if (g_settings.getBoolean(Config::SHOW_TOOLBAR_SIZES)) { std::string info = g_settings.getString(Config::TOOLBAR_SIZES_LAYOUT); - if (!info.empty()) + if (!info.empty()) { manager->LoadPaneInfo(wxString(info), GetPane(TOOLBAR_SIZES)); + } GetPane(TOOLBAR_SIZES).Show(); - } else + } else { GetPane(TOOLBAR_SIZES).Hide(); + } if (g_settings.getBoolean(Config::SHOW_TOOLBAR_INDICATORS)) { std::string info = g_settings.getString(Config::TOOLBAR_INDICATORS_LAYOUT); - if (!info.empty()) + if (!info.empty()) { manager->LoadPaneInfo(wxString(info), GetPane(TOOLBAR_INDICATORS)); + } GetPane(TOOLBAR_INDICATORS).Show(); - } else + } else { GetPane(TOOLBAR_INDICATORS).Hide(); + } manager->Update(); } -void MainToolBar::SavePerspective() -{ +void MainToolBar::SavePerspective() { wxAuiManager* manager = g_gui.GetAuiManager(); - if (!manager) + if (!manager) { return; + } if (g_settings.getBoolean(Config::SHOW_TOOLBAR_STANDARD)) { wxString info = manager->SavePaneInfo(GetPane(TOOLBAR_STANDARD)); @@ -441,8 +447,7 @@ void MainToolBar::SavePerspective() } } -void MainToolBar::OnStandardButtonClick(wxCommandEvent& event) -{ +void MainToolBar::OnStandardButtonClick(wxCommandEvent &event) { switch (event.GetId()) { case wxID_NEW: g_gui.NewMap(); @@ -476,10 +481,10 @@ void MainToolBar::OnStandardButtonClick(wxCommandEvent& event) } } -void MainToolBar::OnBrushesButtonClick(wxCommandEvent& event) -{ - if (!g_gui.IsEditorOpen()) +void MainToolBar::OnBrushesButtonClick(wxCommandEvent &event) { + if (!g_gui.IsEditorOpen()) { return; + } switch (event.GetId()) { case PALETTE_TERRAIN_OPTIONAL_BORDER_TOOL: @@ -523,20 +528,20 @@ void MainToolBar::OnBrushesButtonClick(wxCommandEvent& event) } } -void MainToolBar::OnPositionButtonClick(wxCommandEvent& event) -{ - if (!g_gui.IsEditorOpen()) +void MainToolBar::OnPositionButtonClick(wxCommandEvent &event) { + if (!g_gui.IsEditorOpen()) { return; + } if (event.GetId() == TOOLBAR_POSITION_GO) { Position pos(x_control->GetIntValue(), y_control->GetIntValue(), z_control->GetIntValue()); - if (pos.isValid()) + if (pos.isValid()) { g_gui.SetScreenCenterPosition(pos); + } } } -void MainToolBar::OnPositionKeyUp(wxKeyEvent& event) -{ +void MainToolBar::OnPositionKeyUp(wxKeyEvent &event) { if (event.GetKeyCode() == WXK_TAB) { if (x_control->HasFocus()) { y_control->SelectAll(); @@ -549,27 +554,28 @@ void MainToolBar::OnPositionKeyUp(wxKeyEvent& event) } } else if (event.GetKeyCode() == WXK_NUMPAD_ENTER || event.GetKeyCode() == WXK_RETURN) { Position pos(x_control->GetIntValue(), y_control->GetIntValue(), z_control->GetIntValue()); - if (pos.isValid()) + if (pos.isValid()) { g_gui.SetScreenCenterPosition(pos); + } } event.Skip(); } -void MainToolBar::OnPastePositionText(wxClipboardTextEvent& event) -{ +void MainToolBar::OnPastePositionText(wxClipboardTextEvent &event) { Position position; if (posFromClipboard(position.x, position.y, position.z)) { x_control->SetIntValue(position.x); y_control->SetIntValue(position.y); z_control->SetIntValue(position.z); - } else + } else { event.Skip(); + } } -void MainToolBar::OnSizesButtonClick(wxCommandEvent& event) -{ - if (!g_gui.IsEditorOpen()) +void MainToolBar::OnSizesButtonClick(wxCommandEvent &event) { + if (!g_gui.IsEditorOpen()) { return; + } switch (event.GetId()) { case TOOLBAR_SIZES_CIRCULAR: @@ -604,8 +610,7 @@ void MainToolBar::OnSizesButtonClick(wxCommandEvent& event) } } -void MainToolBar::OnIndicatorsButtonClick(wxCommandEvent& event) -{ +void MainToolBar::OnIndicatorsButtonClick(wxCommandEvent &event) { bool toggled = indicators_toolbar->GetToolToggled(event.GetId()); switch (event.GetId()) { case TOOLBAR_HOOKS: @@ -628,11 +633,11 @@ void MainToolBar::OnIndicatorsButtonClick(wxCommandEvent& event) } } -wxAuiPaneInfo& MainToolBar::GetPane(ToolBarID id) -{ +wxAuiPaneInfo &MainToolBar::GetPane(ToolBarID id) { wxAuiManager* manager = g_gui.GetAuiManager(); - if (!manager) + if (!manager) { return wxAuiNullPaneInfo; + } switch (id) { case TOOLBAR_STANDARD: diff --git a/source/main_toolbar.h b/source/main_toolbar.h index 238acc88..fad083a5 100644 --- a/source/main_toolbar.h +++ b/source/main_toolbar.h @@ -25,13 +25,12 @@ #include "gui_ids.h" #include "numbertextctrl.h" -class MainToolBar : public wxEvtHandler -{ +class MainToolBar : public wxEvtHandler { public: MainToolBar(wxWindow* parent, wxAuiManager* manager); ~MainToolBar(); - wxAuiPaneInfo& GetPane(ToolBarID id); + wxAuiPaneInfo &GetPane(ToolBarID id); void UpdateButtons(); void UpdateBrushButtons(); void UpdateBrushSize(BrushShape shape, int size); @@ -41,13 +40,13 @@ class MainToolBar : public wxEvtHandler void LoadPerspective(); void SavePerspective(); - void OnStandardButtonClick(wxCommandEvent& event); - void OnBrushesButtonClick(wxCommandEvent& event); - void OnPositionButtonClick(wxCommandEvent& event); - void OnPositionKeyUp(wxKeyEvent& event); - void OnPastePositionText(wxClipboardTextEvent& event); - void OnSizesButtonClick(wxCommandEvent& event); - void OnIndicatorsButtonClick(wxCommandEvent& event); + void OnStandardButtonClick(wxCommandEvent &event); + void OnBrushesButtonClick(wxCommandEvent &event); + void OnPositionButtonClick(wxCommandEvent &event); + void OnPositionKeyUp(wxKeyEvent &event); + void OnPastePositionText(wxClipboardTextEvent &event); + void OnSizesButtonClick(wxCommandEvent &event); + void OnIndicatorsButtonClick(wxCommandEvent &event); private: static const wxString STANDARD_BAR_NAME; diff --git a/source/map.cpp b/source/map.cpp index ed8a253c..e65e3051 100644 --- a/source/map.cpp +++ b/source/map.cpp @@ -21,29 +21,28 @@ #include "map.h" -Map::Map() : BaseMap(), +Map::Map() : + BaseMap(), width(512), height(512), houses(*this), has_changed(false), unnamed(false), - waypoints(*this) -{ + waypoints(*this) { // Earliest version possible // Caller is responsible for converting us to proper version mapVersion.otbm = MAP_OTBM_1; mapVersion.client = CLIENT_VERSION_NONE; } -Map::~Map() -{ +Map::~Map() { //// } -bool Map::open(const std::string file) -{ - if(file == filename) +bool Map::open(const std::string file) { + if (file == filename) { return true; // Do not reopen ourselves! + } tilecount = 0; @@ -55,7 +54,7 @@ bool Map::open(const std::string file) warnings = maploader.getWarnings(); - if(!success) { + if (!success) { error = maploader.getError(); return false; } @@ -113,9 +112,8 @@ bool Map::open(const std::string file) return true; } -bool Map::convert(MapVersion to, bool showdialog) -{ - if(mapVersion.client == to.client) { +bool Map::convert(MapVersion to, bool showdialog) { + if (mapVersion.client == to.client) { // Only OTBM version differs // No changes necessary mapVersion = to; @@ -141,89 +139,94 @@ bool Map::convert(MapVersion to, bool showdialog) return true; } -bool Map::convert(const ConversionMap& rm, bool showdialog) -{ - if(showdialog) +bool Map::convert(const ConversionMap &rm, bool showdialog) { + if (showdialog) { g_gui.CreateLoadBar("Converting map ..."); + } uint64_t tiles_done = 0; std::vector id_list; - //std::ofstream conversions("converted_items.txt"); + // std::ofstream conversions("converted_items.txt"); - for(MapIterator miter = begin(); miter != end(); ++miter) { + for (MapIterator miter = begin(); miter != end(); ++miter) { Tile* tile = (*miter)->get(); ASSERT(tile); - if(tile->size() == 0) + if (tile->size() == 0) { continue; + } // id_list try MTM conversion id_list.clear(); - if(tile->ground) + if (tile->ground) { id_list.push_back(tile->ground->getID()); - for(ItemVector::const_iterator item_iter = tile->items.begin(); item_iter != tile->items.end(); ++item_iter) - if((*item_iter)->isBorder()) + } + for (ItemVector::const_iterator item_iter = tile->items.begin(); item_iter != tile->items.end(); ++item_iter) { + if ((*item_iter)->isBorder()) { id_list.push_back((*item_iter)->getID()); + } + } std::sort(id_list.begin(), id_list.end()); ConversionMap::MTM::const_iterator cfmtm = rm.mtm.end(); - while(id_list.size()) { + while (id_list.size()) { cfmtm = rm.mtm.find(id_list); - if(cfmtm != rm.mtm.end()) + if (cfmtm != rm.mtm.end()) { break; + } id_list.pop_back(); } // Keep track of how many items have been inserted at the bottom size_t inserted_items = 0; - if(cfmtm != rm.mtm.end()) { - const std::vector& v = cfmtm->first; + if (cfmtm != rm.mtm.end()) { + const std::vector &v = cfmtm->first; - if(tile->ground && std::find(v.begin(), v.end(), tile->ground->getID()) != v.end()) { + if (tile->ground && std::find(v.begin(), v.end(), tile->ground->getID()) != v.end()) { delete tile->ground; tile->ground = nullptr; } - for(ItemVector::iterator item_iter = tile->items.begin(); item_iter != tile->items.end(); ) { - if(std::find(v.begin(), v.end(), (*item_iter)->getID()) != v.end()) { + for (ItemVector::iterator item_iter = tile->items.begin(); item_iter != tile->items.end();) { + if (std::find(v.begin(), v.end(), (*item_iter)->getID()) != v.end()) { delete *item_iter; item_iter = tile->items.erase(item_iter); - } - else + } else { ++item_iter; + } } - const std::vector& new_items = cfmtm->second; - for(std::vector::const_iterator iit = new_items.begin(); iit != new_items.end(); ++iit) { + const std::vector &new_items = cfmtm->second; + for (std::vector::const_iterator iit = new_items.begin(); iit != new_items.end(); ++iit) { Item* item = Item::Create(*iit); - if(item->isGroundTile()) + if (item->isGroundTile()) { tile->ground = item; - else { + } else { tile->items.insert(tile->items.begin(), item); ++inserted_items; } } } - if(tile->ground) { + if (tile->ground) { ConversionMap::STM::const_iterator cfstm = rm.stm.find(tile->ground->getID()); - if(cfstm != rm.stm.end()) { + if (cfstm != rm.stm.end()) { uint16_t aid = tile->ground->getActionID(); uint16_t uid = tile->ground->getUniqueID(); delete tile->ground; tile->ground = nullptr; - const std::vector& v = cfstm->second; - //conversions << "Converted " << tile->getX() << ":" << tile->getY() << ":" << tile->getZ() << " " << id << " -> "; - for(std::vector::const_iterator iit = v.begin(); iit != v.end(); ++iit) { + const std::vector &v = cfstm->second; + // conversions << "Converted " << tile->getX() << ":" << tile->getY() << ":" << tile->getZ() << " " << id << " -> "; + for (std::vector::const_iterator iit = v.begin(); iit != v.end(); ++iit) { Item* item = Item::Create(*iit); - //conversions << *iit << " "; - if(item->isGroundTile()) { + // conversions << *iit << " "; + if (item->isGroundTile()) { item->setActionID(aid); item->setUniqueID(uid); tile->addItem(item); @@ -232,143 +235,139 @@ bool Map::convert(const ConversionMap& rm, bool showdialog) ++inserted_items; } } - //conversions << std::endl; + // conversions << std::endl; } } - for(ItemVector::iterator replace_item_iter = tile->items.begin() + inserted_items; replace_item_iter != tile->items.end(); ) { + for (ItemVector::iterator replace_item_iter = tile->items.begin() + inserted_items; replace_item_iter != tile->items.end();) { uint16_t id = (*replace_item_iter)->getID(); ConversionMap::STM::const_iterator cf = rm.stm.find(id); - if(cf != rm.stm.end()) { - //uint16_t aid = (*replace_item_iter)->getActionID(); - //uint16_t uid = (*replace_item_iter)->getUniqueID(); + if (cf != rm.stm.end()) { + // uint16_t aid = (*replace_item_iter)->getActionID(); + // uint16_t uid = (*replace_item_iter)->getUniqueID(); delete *replace_item_iter; replace_item_iter = tile->items.erase(replace_item_iter); - const std::vector& v = cf->second; - for(std::vector::const_iterator iit = v.begin(); iit != v.end(); ++iit) { + const std::vector &v = cf->second; + for (std::vector::const_iterator iit = v.begin(); iit != v.end(); ++iit) { replace_item_iter = tile->items.insert(replace_item_iter, Item::Create(*iit)); - //conversions << "Converted " << tile->getX() << ":" << tile->getY() << ":" << tile->getZ() << " " << id << " -> " << *iit << std::endl; + // conversions << "Converted " << tile->getX() << ":" << tile->getY() << ":" << tile->getZ() << " " << id << " -> " << *iit << std::endl; ++replace_item_iter; } - } - else + } else { ++replace_item_iter; + } } ++tiles_done; - if(showdialog && tiles_done % 0x10000 == 0) { + if (showdialog && tiles_done % 0x10000 == 0) { g_gui.SetLoadDone(int(tiles_done / double(getTileCount()) * 100.0)); } } - if(showdialog) + if (showdialog) { g_gui.DestroyLoadBar(); + } return true; } -void Map::cleanInvalidTiles(bool showdialog) -{ - if(showdialog) +void Map::cleanInvalidTiles(bool showdialog) { + if (showdialog) { g_gui.CreateLoadBar("Removing invalid tiles..."); + } uint64_t tiles_done = 0; - for(MapIterator miter = begin(); miter != end(); ++miter) { + for (MapIterator miter = begin(); miter != end(); ++miter) { Tile* tile = (*miter)->get(); ASSERT(tile); - if(tile->size() == 0) + if (tile->size() == 0) { continue; + } - for(ItemVector::iterator item_iter = tile->items.begin(); item_iter != tile->items.end();) { - if(g_items.isValidID((*item_iter)->getID())) + for (ItemVector::iterator item_iter = tile->items.begin(); item_iter != tile->items.end();) { + if (g_items.isValidID((*item_iter)->getID())) { ++item_iter; - else { + } else { delete *item_iter; item_iter = tile->items.erase(item_iter); } } ++tiles_done; - if(showdialog && tiles_done % 0x10000 == 0) { + if (showdialog && tiles_done % 0x10000 == 0) { g_gui.SetLoadDone(int(tiles_done / double(getTileCount()) * 100.0)); } } - if(showdialog) + if (showdialog) { g_gui.DestroyLoadBar(); + } } -bool Map::doChange() -{ +bool Map::doChange() { bool doupdate = !has_changed; has_changed = true; return doupdate; } -bool Map::clearChanges() -{ +bool Map::clearChanges() { bool doupdate = has_changed; has_changed = false; return doupdate; } -void Map::setWidth(int new_width) -{ - if(new_width > 65000) +void Map::setWidth(int new_width) { + if (new_width > 65000) { width = 65000; - else if(new_width < 64) + } else if (new_width < 64) { width = 64; - else + } else { width = new_width; + } } -void Map::setHeight(int new_height) -{ - if(new_height > 65000) +void Map::setHeight(int new_height) { + if (new_height > 65000) { height = 65000; - else if(new_height < 64) + } else if (new_height < 64) { height = 64; - else + } else { height = new_height; + } } -void Map::setMapDescription(const std::string& new_description) -{ +void Map::setMapDescription(const std::string &new_description) { description = new_description; } -void Map::setHouseFilename(const std::string& new_housefile) -{ +void Map::setHouseFilename(const std::string &new_housefile) { housefile = new_housefile; unnamed = false; } -void Map::setSpawnMonsterFilename(const std::string& new_spawnmonsterfile) -{ +void Map::setSpawnMonsterFilename(const std::string &new_spawnmonsterfile) { spawnmonsterfile = new_spawnmonsterfile; unnamed = false; } -void Map::setSpawnNpcFilename(const std::string& new_spawnnpcfile) -{ +void Map::setSpawnNpcFilename(const std::string &new_spawnnpcfile) { spawnnpcfile = new_spawnnpcfile; unnamed = false; } -bool Map::addSpawnMonster(Tile* tile) -{ +bool Map::addSpawnMonster(Tile* tile) { SpawnMonster* spawnMonster = tile->spawnMonster; - if(spawnMonster) { + if (spawnMonster) { int z = tile->getZ(); int start_x = tile->getX() - spawnMonster->getSize(); int start_y = tile->getY() - spawnMonster->getSize(); int end_x = tile->getX() + spawnMonster->getSize(); int end_y = tile->getY() + spawnMonster->getSize(); - for(int y = start_y; y <= end_y; ++y) { - for(int x = start_x; x <= end_x; ++x) { + for (int y = start_y; y <= end_y; ++y) { + for (int x = start_x; x <= end_x; ++x) { TileLocation* ctile_loc = createTileL(x, y, z); ctile_loc->increaseSpawnCount(); } @@ -379,8 +378,7 @@ bool Map::addSpawnMonster(Tile* tile) return false; } -void Map::removeSpawnMonsterInternal(Tile* tile) -{ +void Map::removeSpawnMonsterInternal(Tile* tile) { SpawnMonster* spawnMonster = tile->spawnMonster; ASSERT(spawnMonster); @@ -390,81 +388,83 @@ void Map::removeSpawnMonsterInternal(Tile* tile) int end_x = tile->getX() + spawnMonster->getSize(); int end_y = tile->getY() + spawnMonster->getSize(); - for(int y = start_y; y <= end_y; ++y) { - for(int x = start_x; x <= end_x; ++x) { + for (int y = start_y; y <= end_y; ++y) { + for (int x = start_x; x <= end_x; ++x) { TileLocation* ctile_loc = getTileL(x, y, z); - if(ctile_loc != nullptr && ctile_loc->getSpawnMonsterCount() > 0) + if (ctile_loc != nullptr && ctile_loc->getSpawnMonsterCount() > 0) { ctile_loc->decreaseSpawnMonsterCount(); + } } } } -void Map::removeSpawnMonster(Tile* tile) -{ - if(tile->spawnMonster) { +void Map::removeSpawnMonster(Tile* tile) { + if (tile->spawnMonster) { removeSpawnMonsterInternal(tile); spawnsMonster.removeSpawnMonster(tile); } } -SpawnMonsterList Map::getSpawnMonsterList(const Tile* tile) const -{ +SpawnMonsterList Map::getSpawnMonsterList(const Tile* tile) const { SpawnMonsterList list; - if(!tile) return list; + if (!tile) { + return list; + } const TileLocation* location = tile->getLocation(); - if(!location || location->getSpawnMonsterCount() == 0) + if (!location || location->getSpawnMonsterCount() == 0) { return list; + } uint32_t found = 0; - if(tile->spawnMonster) { + if (tile->spawnMonster) { ++found; list.push_back(tile->spawnMonster); } // Scans the border tiles in an expanding square around the original spawn - const Position& position = tile->getPosition(); + const Position &position = tile->getPosition(); int start_x = position.x - 1; int end_x = position.x + 1; int start_y = position.y - 1; int end_y = position.y + 1; - while(found != location->getSpawnMonsterCount()) { - for(int x = start_x; x <= end_x; ++x) { + while (found != location->getSpawnMonsterCount()) { + for (int x = start_x; x <= end_x; ++x) { const Tile* start_tile = getTile(x, start_y, position.z); - if(start_tile && start_tile->spawnMonster) { + if (start_tile && start_tile->spawnMonster) { list.push_back(start_tile->spawnMonster); ++found; } const Tile* end_tile = getTile(x, end_y, position.z); - if(end_tile && end_tile->spawnMonster) { + if (end_tile && end_tile->spawnMonster) { list.push_back(end_tile->spawnMonster); ++found; } } - for(int y = start_y + 1; y < end_y; ++y) { + for (int y = start_y + 1; y < end_y; ++y) { const Tile* start_tile = getTile(start_x, y, position.z); - if(start_tile && start_tile->spawnMonster) { + if (start_tile && start_tile->spawnMonster) { list.push_back(start_tile->spawnMonster); ++found; } const Tile* end_tile = getTile(end_x, y, position.z); - if(end_tile && end_tile->spawnMonster) { + if (end_tile && end_tile->spawnMonster) { list.push_back(end_tile->spawnMonster); ++found; } } - for(int y = start_y + 1; y < end_y; ++y) { + for (int y = start_y + 1; y < end_y; ++y) { const Tile* start_tile = getTile(start_x, y, position.z); - if(start_tile && start_tile->spawnMonster) { + if (start_tile && start_tile->spawnMonster) { list.push_back(start_tile->spawnMonster); ++found; } const Tile* end_tile = getTile(end_x, y, position.z); - if(end_tile && end_tile->spawnMonster) { + if (end_tile && end_tile->spawnMonster) { list.push_back(end_tile->spawnMonster); ++found; } @@ -477,30 +477,27 @@ SpawnMonsterList Map::getSpawnMonsterList(const Tile* tile) const return list; } -SpawnMonsterList Map::getSpawnMonsterList(const Position& position) const -{ +SpawnMonsterList Map::getSpawnMonsterList(const Position &position) const { const Tile* tile = getTile(position); return getSpawnMonsterList(tile); } -SpawnMonsterList Map::getSpawnMonsterList(int x, int y, int z) const -{ +SpawnMonsterList Map::getSpawnMonsterList(int x, int y, int z) const { const Tile* tile = getTile(x, y, z); return getSpawnMonsterList(tile); } -bool Map::addSpawnNpc(Tile* tile) -{ +bool Map::addSpawnNpc(Tile* tile) { SpawnNpc* spawnNpc = tile->spawnNpc; - if(spawnNpc) { + if (spawnNpc) { int z = tile->getZ(); int start_x = tile->getX() - spawnNpc->getSize(); int start_y = tile->getY() - spawnNpc->getSize(); int end_x = tile->getX() + spawnNpc->getSize(); int end_y = tile->getY() + spawnNpc->getSize(); - for(int y = start_y; y <= end_y; ++y) { - for(int x = start_x; x <= end_x; ++x) { + for (int y = start_y; y <= end_y; ++y) { + for (int x = start_x; x <= end_x; ++x) { TileLocation* ctile_loc = createTileL(x, y, z); ctile_loc->increaseSpawnNpcCount(); } @@ -511,8 +508,7 @@ bool Map::addSpawnNpc(Tile* tile) return false; } -void Map::removeSpawnNpcInternal(Tile* tile) -{ +void Map::removeSpawnNpcInternal(Tile* tile) { SpawnNpc* spawnNpc = tile->spawnNpc; ASSERT(spawnNpc); @@ -522,68 +518,70 @@ void Map::removeSpawnNpcInternal(Tile* tile) int end_x = tile->getX() + spawnNpc->getSize(); int end_y = tile->getY() + spawnNpc->getSize(); - for(int y = start_y; y <= end_y; ++y) { - for(int x = start_x; x <= end_x; ++x) { + for (int y = start_y; y <= end_y; ++y) { + for (int x = start_x; x <= end_x; ++x) { TileLocation* ctile_loc = getTileL(x, y, z); - if(ctile_loc != nullptr && ctile_loc->getSpawnNpcCount() > 0) + if (ctile_loc != nullptr && ctile_loc->getSpawnNpcCount() > 0) { ctile_loc->decreaseSpawnNpcCount(); + } } } } -void Map::removeSpawnNpc(Tile* tile) -{ - if(tile->spawnNpc) { +void Map::removeSpawnNpc(Tile* tile) { + if (tile->spawnNpc) { removeSpawnNpcInternal(tile); spawnsNpc.removeSpawnNpc(tile); } } -SpawnNpcList Map::getSpawnNpcList(const Tile* tile) const -{ +SpawnNpcList Map::getSpawnNpcList(const Tile* tile) const { SpawnNpcList listNpc; - if(!tile) return listNpc; + if (!tile) { + return listNpc; + } const TileLocation* location = tile->getLocation(); - if(!location || location->getSpawnNpcCount() == 0) + if (!location || location->getSpawnNpcCount() == 0) { return listNpc; + } uint32_t found = 0; - if(tile->spawnNpc) { + if (tile->spawnNpc) { ++found; listNpc.push_back(tile->spawnNpc); } // Scans the border tiles in an expanding square around the original spawn - const Position& position = tile->getPosition(); + const Position &position = tile->getPosition(); int start_x = position.x - 1; int end_x = position.x + 1; int start_y = position.y - 1; int end_y = position.y + 1; - while(found != location->getSpawnNpcCount()) { - for(int x = start_x; x <= end_x; ++x) { + while (found != location->getSpawnNpcCount()) { + for (int x = start_x; x <= end_x; ++x) { const Tile* start_tile = getTile(x, start_y, position.z); - if(start_tile && start_tile->spawnNpc) { + if (start_tile && start_tile->spawnNpc) { listNpc.push_back(start_tile->spawnNpc); ++found; } const Tile* end_tile = getTile(x, end_y, position.z); - if(end_tile && end_tile->spawnNpc) { + if (end_tile && end_tile->spawnNpc) { listNpc.push_back(end_tile->spawnNpc); ++found; } } - for(int y = start_y + 1; y < end_y; ++y) { + for (int y = start_y + 1; y < end_y; ++y) { const Tile* start_tile = getTile(start_x, y, position.z); - if(start_tile && start_tile->spawnNpc) { + if (start_tile && start_tile->spawnNpc) { listNpc.push_back(start_tile->spawnNpc); ++found; } const Tile* end_tile = getTile(end_x, y, position.z); - if(end_tile && end_tile->spawnNpc) { + if (end_tile && end_tile->spawnNpc) { listNpc.push_back(end_tile->spawnNpc); ++found; } @@ -596,91 +594,97 @@ SpawnNpcList Map::getSpawnNpcList(const Tile* tile) const return listNpc; } -SpawnNpcList Map::getSpawnNpcList(const Position& position) const -{ +SpawnNpcList Map::getSpawnNpcList(const Position &position) const { const Tile* tile = getTile(position); return getSpawnNpcList(tile); } -SpawnNpcList Map::getSpawnNpcList(int x, int y, int z) const -{ +SpawnNpcList Map::getSpawnNpcList(int x, int y, int z) const { const Tile* tile = getTile(x, y, z); return getSpawnNpcList(tile); } -bool Map::exportMinimap(FileName filename, int floor /*= rme::MapGroundLayer*/, bool displaydialog) -{ +bool Map::exportMinimap(FileName filename, int floor /*= rme::MapGroundLayer*/, bool displaydialog) { uint8_t* pic = nullptr; - try - { + try { int min_x = 0x10000, min_y = 0x10000; int max_x = 0x00000, max_y = 0x00000; - if(size() == 0) + if (size() == 0) { return true; + } uint32_t minimap_colors[256]; - for(int i = 0; i < 256; ++i) + for (int i = 0; i < 256; ++i) { minimap_colors[i] = colorFromEightBit(i).GetRGB(); + } - for(MapIterator mit = begin(); mit != end(); ++mit) { - if((*mit)->get() == nullptr || (*mit)->empty()) + for (MapIterator mit = begin(); mit != end(); ++mit) { + if ((*mit)->get() == nullptr || (*mit)->empty()) { continue; + } Position pos = (*mit)->getPosition(); - if(pos.x < min_x) + if (pos.x < min_x) { min_x = pos.x; + } - if(pos.y < min_y) + if (pos.y < min_y) { min_y = pos.y; + } - if(pos.x > max_x) + if (pos.x > max_x) { max_x = pos.x; + } - if(pos.y > max_y) + if (pos.y > max_y) { max_y = pos.y; - + } } - int minimap_width = max_x - min_x+1; - int minimap_height = max_y - min_y+1; + int minimap_width = max_x - min_x + 1; + int minimap_height = max_y - min_y + 1; - pic = newd uint8_t[minimap_width*minimap_height]; // 1 byte per pixel + pic = newd uint8_t[minimap_width * minimap_height]; // 1 byte per pixel - memset(pic, 0, minimap_width*minimap_height); + memset(pic, 0, minimap_width * minimap_height); int tiles_iterated = 0; - for(MapIterator mit = begin(); mit != end(); ++mit) { + for (MapIterator mit = begin(); mit != end(); ++mit) { Tile* tile = (*mit)->get(); ++tiles_iterated; - if(tiles_iterated % 8192 == 0 && displaydialog) + if (tiles_iterated % 8192 == 0 && displaydialog) { g_gui.SetLoadDone(int(tiles_iterated / double(tilecount) * 90.0)); + } - if(tile->empty() || tile->getZ() != floor) + if (tile->empty() || tile->getZ() != floor) { continue; + } - //std::cout << "Pixel : " << (tile->getY() - min_y) * width + (tile->getX() - min_x) << std::endl; + // std::cout << "Pixel : " << (tile->getY() - min_y) * width + (tile->getX() - min_x) << std::endl; uint32_t pixelpos = (tile->getY() - min_y) * minimap_width + (tile->getX() - min_x); - uint8_t& pixel = pic[pixelpos]; + uint8_t &pixel = pic[pixelpos]; - for(ItemVector::const_reverse_iterator item_iter = tile->items.rbegin(); item_iter != tile->items.rend(); ++item_iter) { - if((*item_iter)->getMiniMapColor()) { + for (ItemVector::const_reverse_iterator item_iter = tile->items.rbegin(); item_iter != tile->items.rend(); ++item_iter) { + if ((*item_iter)->getMiniMapColor()) { pixel = (*item_iter)->getMiniMapColor(); break; } } - if(pixel == 0) + if (pixel == 0) { // check ground too - if(tile->hasGround()) + if (tile->hasGround()) { pixel = tile->ground->getMiniMapColor(); + } + } } // Create a file for writing FileWriteHandle fh(nstr(filename.GetFullPath())); - if(!fh.isOpen()) { + if (!fh.isOpen()) { delete[] pic; return false; } @@ -689,11 +693,10 @@ bool Map::exportMinimap(FileName filename, int floor /*= rme::MapGroundLayer*/, // Store the file size // We need to predict how large it will be - uint32_t file_size = - 14 // header - +40 // image data header - +256*4 // color palette - +((minimap_width + 3) / 4 * 4) * height; // pixels + uint32_t file_size = 14 // header + + 40 // image data header + + 256 * 4 // color palette + + ((minimap_width + 3) / 4 * 4) * height; // pixels fh.addU32(file_size); // Two values reserved, must always be 0. @@ -701,7 +704,7 @@ bool Map::exportMinimap(FileName filename, int floor /*= rme::MapGroundLayer*/, fh.addU16(0); // Bitmapdata offset - fh.addU32(14 + 40 + 256*4); + fh.addU32(14 + 40 + 256 * 4); // Header size fh.addU32(40); @@ -732,62 +735,62 @@ bool Map::exportMinimap(FileName filename, int floor /*= rme::MapGroundLayer*/, fh.addU32(0); // Write the color palette - for(int i = 0; i < 256; ++i) + for (int i = 0; i < 256; ++i) { fh.addU32(minimap_colors[i]); + } // Bitmap width must be divisible by four, calculate how much padding we need - int padding = ((minimap_width & 3) != 0? 4-(minimap_width & 3) : 0); + int padding = ((minimap_width & 3) != 0 ? 4 - (minimap_width & 3) : 0); // Bitmap rows are saved in reverse order - for(int y = minimap_height-1; y >= 0; --y) { - fh.addRAW(pic + y*minimap_width, minimap_width); - for(int i = 0; i < padding; ++i) { + for (int y = minimap_height - 1; y >= 0; --y) { + fh.addRAW(pic + y * minimap_width, minimap_width); + for (int i = 0; i < padding; ++i) { fh.addU8(0); } - if(y % 100 == 0 && displaydialog) { - g_gui.SetLoadDone(90 + int((minimap_height-y) / double(minimap_height) * 10.0)); + if (y % 100 == 0 && displaydialog) { + g_gui.SetLoadDone(90 + int((minimap_height - y) / double(minimap_height) * 10.0)); } } delete[] pic; - //fclose(file); + // fclose(file); fh.close(); - } - catch(...) - { + } catch (...) { delete[] pic; } return true; } -void Map::updateUniqueIds(Tile* old_tile, Tile* new_tile) -{ - if(old_tile && old_tile->hasUniqueItem()) { - if(old_tile->ground) { +void Map::updateUniqueIds(Tile* old_tile, Tile* new_tile) { + if (old_tile && old_tile->hasUniqueItem()) { + if (old_tile->ground) { uint16_t uid = old_tile->ground->getUniqueID(); - if(uid != 0) + if (uid != 0) { removeUniqueId(uid); + } } - for(const Item* item : old_tile->items) { - if(item) { + for (const Item* item : old_tile->items) { + if (item) { uint16_t uid = item->getUniqueID(); - if(uid != 0) { + if (uid != 0) { removeUniqueId(uid); } } } } - if(new_tile && new_tile->hasUniqueItem()) { - if(new_tile->ground) { + if (new_tile && new_tile->hasUniqueItem()) { + if (new_tile->ground) { uint16_t uid = new_tile->ground->getUniqueID(); - if(uid != 0) + if (uid != 0) { addUniqueId(uid); + } } - for(const Item* item : new_tile->items) { - if(item) { + for (const Item* item : new_tile->items) { + if (item) { uint16_t uid = item->getUniqueID(); - if(uid != 0) { + if (uid != 0) { addUniqueId(uid); } } @@ -795,26 +798,24 @@ void Map::updateUniqueIds(Tile* old_tile, Tile* new_tile) } } -void Map::addUniqueId(uint16_t uid) -{ +void Map::addUniqueId(uint16_t uid) { auto it = std::find(uniqueIds.begin(), uniqueIds.end(), uid); if (it == uniqueIds.end()) { uniqueIds.push_back(uid); } } -void Map::removeUniqueId(uint16_t uid) -{ +void Map::removeUniqueId(uint16_t uid) { auto it = std::find(uniqueIds.begin(), uniqueIds.end(), uid); if (it != uniqueIds.end()) { uniqueIds.erase(it); } } -bool Map::hasUniqueId(uint16_t uid) const -{ - if (uid < rme::MinUniqueId || uniqueIds.empty()) +bool Map::hasUniqueId(uint16_t uid) const { + if (uid < rme::MinUniqueId || uniqueIds.empty()) { return false; + } auto it = std::find(uniqueIds.begin(), uniqueIds.end(), uid); return it != uniqueIds.end(); diff --git a/source/map.h b/source/map.h index d7e06650..2ee57ba5 100644 --- a/source/map.h +++ b/source/map.h @@ -28,8 +28,7 @@ #include "templates.h" #include "spawn_npc.h" -class Map : public BaseMap -{ +class Map : public BaseMap { public: // ctor and dtor Map(); @@ -41,68 +40,106 @@ class Map : public BaseMap bool exportMinimap(FileName filename, int floor = rme::MapGroundLayer, bool showdialog = false); // bool convert(MapVersion to, bool showdialog = false); - bool convert(const ConversionMap& cm, bool showdialog = false); + bool convert(const ConversionMap &cm, bool showdialog = false); // Query information about the map - MapVersion getVersion() const noexcept { return mapVersion; } + MapVersion getVersion() const noexcept { + return mapVersion; + } // Returns true if any change has been done since last save - bool hasChanged() const noexcept { return has_changed; } + bool hasChanged() const noexcept { + return has_changed; + } // Makes a change, doesn't matter what. Just so that it asks when saving (Also adds a * to the window title) bool doChange(); // Clears any changes bool clearChanges(); // Errors/warnings - bool hasWarnings() const {return warnings.size() != 0;} - const wxArrayString& getWarnings() const {return warnings;} - bool hasError() const {return error.size() != 0;} - wxString getError() const {return error;} + bool hasWarnings() const { + return warnings.size() != 0; + } + const wxArrayString &getWarnings() const { + return warnings; + } + bool hasError() const { + return error.size() != 0; + } + wxString getError() const { + return error; + } // Mess with spawnsMonster bool addSpawnMonster(Tile* spawnMonster); void removeSpawnMonster(Tile* tile); - void removeSpawnMonster(const Position& position) { removeSpawnMonster(getTile(position)); } + void removeSpawnMonster(const Position &position) { + removeSpawnMonster(getTile(position)); + } // Returns all possible spawnsMonster on the target tile SpawnMonsterList getSpawnMonsterList(const Tile* tile) const; - SpawnMonsterList getSpawnMonsterList(const Position& position) const; + SpawnMonsterList getSpawnMonsterList(const Position &position) const; SpawnMonsterList getSpawnMonsterList(int x, int y, int z) const; // Mess with npc spawns bool addSpawnNpc(Tile* spawnMonster); void removeSpawnNpc(Tile* tile); - void removeSpawnNpc(const Position& position) { removeSpawnNpc(getTile(position)); } + void removeSpawnNpc(const Position &position) { + removeSpawnNpc(getTile(position)); + } // Returns all possible npc spawns on the target tile SpawnNpcList getSpawnNpcList(const Tile* tile) const; - SpawnNpcList getSpawnNpcList(const Position& position) const; + SpawnNpcList getSpawnNpcList(const Position &position) const; SpawnNpcList getSpawnNpcList(int x, int y, int z) const; // Returns true if the map has been saved // ie. it knows which file it should be saved to - bool hasFile() const noexcept { return !filename.empty(); } - const std::string& getFilename() const noexcept { return filename; } - const std::string& getName() const noexcept { return name; } - void setName(const std::string& _name) noexcept { name = _name; } + bool hasFile() const noexcept { + return !filename.empty(); + } + const std::string &getFilename() const noexcept { + return filename; + } + const std::string &getName() const noexcept { + return name; + } + void setName(const std::string &_name) noexcept { + name = _name; + } // Get map data - int getWidth() const {return width;} - int getHeight() const {return height;} - std::string getMapDescription() const {return description;} - std::string getHouseFilename() const {return housefile;} - std::string getSpawnFilename() const {return spawnmonsterfile;} - std::string getSpawnNpcFilename() const {return spawnnpcfile;} + int getWidth() const { + return width; + } + int getHeight() const { + return height; + } + std::string getMapDescription() const { + return description; + } + std::string getHouseFilename() const { + return housefile; + } + std::string getSpawnFilename() const { + return spawnmonsterfile; + } + std::string getSpawnNpcFilename() const { + return spawnnpcfile; + } // Set some map data void setWidth(int new_width); void setHeight(int new_height); - void setMapDescription(const std::string& new_description); - void setHouseFilename(const std::string& new_housefile); - void setSpawnMonsterFilename(const std::string& new_spawnmonsterfile); - void setSpawnNpcFilename(const std::string& new_npcfile); + void setMapDescription(const std::string &new_description); + void setHouseFilename(const std::string &new_housefile); + void setSpawnMonsterFilename(const std::string &new_spawnmonsterfile); + void setSpawnNpcFilename(const std::string &new_npcfile); - void flagAsNamed() noexcept { unnamed = false; } + void flagAsNamed() noexcept { + unnamed = false; + } bool hasUniqueId(uint16_t uid) const; @@ -156,45 +193,47 @@ class Map : public BaseMap }; template -inline void foreach_ItemOnMap(Map& map, ForeachType& foreach, bool selectedTiles) -{ +inline void foreach_ItemOnMap(Map &map, ForeachType &foreach, bool selectedTiles) { MapIterator tileiter = map.begin(); MapIterator end = map.end(); long long done = 0; - while(tileiter != end) { + while (tileiter != end) { ++done; Tile* tile = (*tileiter)->get(); - if(selectedTiles && !tile->isSelected()) { + if (selectedTiles && !tile->isSelected()) { ++tileiter; continue; } - if(tile->ground) { - foreach(map, tile, tile->ground, done); + if (tile->ground) { + foreach (map, tile, tile->ground, done) + ; } std::queue containers; - for(ItemVector::iterator itemiter = tile->items.begin(); itemiter != tile->items.end(); ++itemiter) { + for (ItemVector::iterator itemiter = tile->items.begin(); itemiter != tile->items.end(); ++itemiter) { Item* item = *itemiter; Container* container = dynamic_cast(item); - foreach(map, tile, item, done); - if(container) { + foreach (map, tile, item, done) + ; + if (container) { containers.push(container); do { container = containers.front(); - ItemVector& v = container->getVector(); - for(ItemVector::iterator containeriter = v.begin(); containeriter != v.end(); ++containeriter) { + ItemVector &v = container->getVector(); + for (ItemVector::iterator containeriter = v.begin(); containeriter != v.end(); ++containeriter) { Item* i = *containeriter; Container* c = dynamic_cast(i); - foreach(map, tile, i, done); - if(c) { + foreach (map, tile, i, done) + ; + if (c) { containers.push(c); } } containers.pop(); - } while(containers.size()); + } while (containers.size()); } } ++tileiter; @@ -202,28 +241,28 @@ inline void foreach_ItemOnMap(Map& map, ForeachType& foreach, bool selectedTiles } template -inline void foreach_TileOnMap(Map& map, ForeachType& foreach) -{ +inline void foreach_TileOnMap(Map &map, ForeachType &foreach) { MapIterator tileiter = map.begin(); MapIterator end = map.end(); long long done = 0; - while(tileiter != end) - foreach(map, (*tileiter++)->get(), ++done); + while (tileiter != end) { + foreach (map, (*tileiter++)->get(), ++done) + ; + } } template -inline long long remove_if_TileOnMap(Map& map, RemoveIfType& remove_if) -{ +inline long long remove_if_TileOnMap(Map &map, RemoveIfType &remove_if) { MapIterator tileiter = map.begin(); MapIterator end = map.end(); long long done = 0; long long removed = 0; long long total = map.getTileCount(); - while(tileiter != end) { + while (tileiter != end) { Tile* tile = (*tileiter)->get(); - if(remove_if(map, tile, removed, done, total)) { + if (remove_if(map, tile, removed, done, total)) { map.setTile(tile->getPosition(), nullptr, true); ++removed; } @@ -235,38 +274,38 @@ inline long long remove_if_TileOnMap(Map& map, RemoveIfType& remove_if) } template -inline int64_t RemoveItemOnMap(Map& map, RemoveIfType& condition, bool selectedOnly) { +inline int64_t RemoveItemOnMap(Map &map, RemoveIfType &condition, bool selectedOnly) { int64_t done = 0; int64_t removed = 0; MapIterator it = map.begin(); MapIterator end = map.end(); - while(it != end) { + while (it != end) { ++done; Tile* tile = (*it)->get(); - if(selectedOnly && !tile->isSelected()) { + if (selectedOnly && !tile->isSelected()) { ++it; continue; } - if(tile->ground) { - if(condition(map, tile->ground, removed, done)) { + if (tile->ground) { + if (condition(map, tile->ground, removed, done)) { delete tile->ground; tile->ground = nullptr; ++removed; } } - for(auto iit = tile->items.begin(); iit != tile->items.end();) { + for (auto iit = tile->items.begin(); iit != tile->items.end();) { Item* item = *iit; - if(condition(map, item, removed, done)) { + if (condition(map, item, removed, done)) { iit = tile->items.erase(iit); delete item; ++removed; - } - else + } else { ++iit; + } } ++it; } diff --git a/source/map_allocator.h b/source/map_allocator.h index 41ffef36..9154a38f 100644 --- a/source/map_allocator.h +++ b/source/map_allocator.h @@ -23,12 +23,11 @@ class BaseMap; -class MapAllocator -{ +class MapAllocator { public: - MapAllocator() {} - ~MapAllocator() {} + MapAllocator() { } + ~MapAllocator() { } // shorthands for tiles Tile* operator()(TileLocation* location) { @@ -56,7 +55,7 @@ class MapAllocator } // - QTreeNode* allocateNode(BaseMap& map) { + QTreeNode* allocateNode(BaseMap &map) { return newd QTreeNode(map); } void freeNode(QTreeNode* qt) { diff --git a/source/map_display.cpp b/source/map_display.cpp index 69f81339..e8ff360c 100644 --- a/source/map_display.cpp +++ b/source/map_display.cpp @@ -47,63 +47,63 @@ #include "npc_brush.h" BEGIN_EVENT_TABLE(MapCanvas, wxGLCanvas) - EVT_KEY_DOWN(MapCanvas::OnKeyDown) - EVT_KEY_DOWN(MapCanvas::OnKeyUp) - - // Mouse events - EVT_MOTION(MapCanvas::OnMouseMove) - EVT_LEFT_UP(MapCanvas::OnMouseLeftRelease) - EVT_LEFT_DOWN(MapCanvas::OnMouseLeftClick) - EVT_LEFT_DCLICK(MapCanvas::OnMouseLeftDoubleClick) - EVT_MIDDLE_DOWN(MapCanvas::OnMouseCenterClick) - EVT_MIDDLE_UP(MapCanvas::OnMouseCenterRelease) - EVT_RIGHT_DOWN(MapCanvas::OnMouseRightClick) - EVT_RIGHT_UP(MapCanvas::OnMouseRightRelease) - EVT_MOUSEWHEEL(MapCanvas::OnWheel) - EVT_ENTER_WINDOW(MapCanvas::OnGainMouse) - EVT_LEAVE_WINDOW(MapCanvas::OnLoseMouse) - - //Drawing events - EVT_PAINT(MapCanvas::OnPaint) - EVT_ERASE_BACKGROUND(MapCanvas::OnEraseBackground) - - // Menu events - EVT_MENU(MAP_POPUP_MENU_CUT, MapCanvas::OnCut) - EVT_MENU(MAP_POPUP_MENU_COPY, MapCanvas::OnCopy) - EVT_MENU(MAP_POPUP_MENU_COPY_POSITION, MapCanvas::OnCopyPosition) - EVT_MENU(MAP_POPUP_MENU_PASTE, MapCanvas::OnPaste) - EVT_MENU(MAP_POPUP_MENU_DELETE, MapCanvas::OnDelete) - //---- - EVT_MENU(MAP_POPUP_MENU_COPY_SERVER_ID, MapCanvas::OnCopyServerId) - EVT_MENU(MAP_POPUP_MENU_COPY_CLIENT_ID, MapCanvas::OnCopyClientId) - EVT_MENU(MAP_POPUP_MENU_COPY_NAME, MapCanvas::OnCopyName) - // ---- - EVT_MENU(MAP_POPUP_MENU_ROTATE, MapCanvas::OnRotateItem) - EVT_MENU(MAP_POPUP_MENU_GOTO, MapCanvas::OnGotoDestination) - EVT_MENU(MAP_POPUP_MENU_COPY_DESTINATION, MapCanvas::OnCopyDestination) - EVT_MENU(MAP_POPUP_MENU_SWITCH_DOOR, MapCanvas::OnSwitchDoor) - // ---- - EVT_MENU(MAP_POPUP_MENU_SELECT_RAW_BRUSH, MapCanvas::OnSelectRAWBrush) - EVT_MENU(MAP_POPUP_MENU_SELECT_GROUND_BRUSH, MapCanvas::OnSelectGroundBrush) - EVT_MENU(MAP_POPUP_MENU_SELECT_DOODAD_BRUSH, MapCanvas::OnSelectDoodadBrush) - EVT_MENU(MAP_POPUP_MENU_SELECT_DOOR_BRUSH, MapCanvas::OnSelectDoorBrush) - EVT_MENU(MAP_POPUP_MENU_SELECT_WALL_BRUSH, MapCanvas::OnSelectWallBrush) - EVT_MENU(MAP_POPUP_MENU_SELECT_CARPET_BRUSH, MapCanvas::OnSelectCarpetBrush) - EVT_MENU(MAP_POPUP_MENU_SELECT_TABLE_BRUSH, MapCanvas::OnSelectTableBrush) - EVT_MENU(MAP_POPUP_MENU_SELECT_MONSTER_BRUSH, MapCanvas::OnSelectMonsterBrush) - EVT_MENU(MAP_POPUP_MENU_SELECT_SPAWN_BRUSH, MapCanvas::OnSelectSpawnBrush) - EVT_MENU(MAP_POPUP_MENU_SELECT_NPC_BRUSH, MapCanvas::OnSelectNpcBrush) - EVT_MENU(MAP_POPUP_MENU_SELECT_SPAWN_NPC_BRUSH, MapCanvas::OnSelectSpawnNpcBrush) - EVT_MENU(MAP_POPUP_MENU_SELECT_HOUSE_BRUSH, MapCanvas::OnSelectHouseBrush) - // ---- - EVT_MENU(MAP_POPUP_MENU_PROPERTIES, MapCanvas::OnProperties) - // ---- - EVT_MENU(MAP_POPUP_MENU_BROWSE_TILE, MapCanvas::OnBrowseTile) +EVT_KEY_DOWN(MapCanvas::OnKeyDown) +EVT_KEY_DOWN(MapCanvas::OnKeyUp) + +// Mouse events +EVT_MOTION(MapCanvas::OnMouseMove) +EVT_LEFT_UP(MapCanvas::OnMouseLeftRelease) +EVT_LEFT_DOWN(MapCanvas::OnMouseLeftClick) +EVT_LEFT_DCLICK(MapCanvas::OnMouseLeftDoubleClick) +EVT_MIDDLE_DOWN(MapCanvas::OnMouseCenterClick) +EVT_MIDDLE_UP(MapCanvas::OnMouseCenterRelease) +EVT_RIGHT_DOWN(MapCanvas::OnMouseRightClick) +EVT_RIGHT_UP(MapCanvas::OnMouseRightRelease) +EVT_MOUSEWHEEL(MapCanvas::OnWheel) +EVT_ENTER_WINDOW(MapCanvas::OnGainMouse) +EVT_LEAVE_WINDOW(MapCanvas::OnLoseMouse) + +// Drawing events +EVT_PAINT(MapCanvas::OnPaint) +EVT_ERASE_BACKGROUND(MapCanvas::OnEraseBackground) + +// Menu events +EVT_MENU(MAP_POPUP_MENU_CUT, MapCanvas::OnCut) +EVT_MENU(MAP_POPUP_MENU_COPY, MapCanvas::OnCopy) +EVT_MENU(MAP_POPUP_MENU_COPY_POSITION, MapCanvas::OnCopyPosition) +EVT_MENU(MAP_POPUP_MENU_PASTE, MapCanvas::OnPaste) +EVT_MENU(MAP_POPUP_MENU_DELETE, MapCanvas::OnDelete) +//---- +EVT_MENU(MAP_POPUP_MENU_COPY_SERVER_ID, MapCanvas::OnCopyServerId) +EVT_MENU(MAP_POPUP_MENU_COPY_CLIENT_ID, MapCanvas::OnCopyClientId) +EVT_MENU(MAP_POPUP_MENU_COPY_NAME, MapCanvas::OnCopyName) +// ---- +EVT_MENU(MAP_POPUP_MENU_ROTATE, MapCanvas::OnRotateItem) +EVT_MENU(MAP_POPUP_MENU_GOTO, MapCanvas::OnGotoDestination) +EVT_MENU(MAP_POPUP_MENU_COPY_DESTINATION, MapCanvas::OnCopyDestination) +EVT_MENU(MAP_POPUP_MENU_SWITCH_DOOR, MapCanvas::OnSwitchDoor) +// ---- +EVT_MENU(MAP_POPUP_MENU_SELECT_RAW_BRUSH, MapCanvas::OnSelectRAWBrush) +EVT_MENU(MAP_POPUP_MENU_SELECT_GROUND_BRUSH, MapCanvas::OnSelectGroundBrush) +EVT_MENU(MAP_POPUP_MENU_SELECT_DOODAD_BRUSH, MapCanvas::OnSelectDoodadBrush) +EVT_MENU(MAP_POPUP_MENU_SELECT_DOOR_BRUSH, MapCanvas::OnSelectDoorBrush) +EVT_MENU(MAP_POPUP_MENU_SELECT_WALL_BRUSH, MapCanvas::OnSelectWallBrush) +EVT_MENU(MAP_POPUP_MENU_SELECT_CARPET_BRUSH, MapCanvas::OnSelectCarpetBrush) +EVT_MENU(MAP_POPUP_MENU_SELECT_TABLE_BRUSH, MapCanvas::OnSelectTableBrush) +EVT_MENU(MAP_POPUP_MENU_SELECT_MONSTER_BRUSH, MapCanvas::OnSelectMonsterBrush) +EVT_MENU(MAP_POPUP_MENU_SELECT_SPAWN_BRUSH, MapCanvas::OnSelectSpawnBrush) +EVT_MENU(MAP_POPUP_MENU_SELECT_NPC_BRUSH, MapCanvas::OnSelectNpcBrush) +EVT_MENU(MAP_POPUP_MENU_SELECT_SPAWN_NPC_BRUSH, MapCanvas::OnSelectSpawnNpcBrush) +EVT_MENU(MAP_POPUP_MENU_SELECT_HOUSE_BRUSH, MapCanvas::OnSelectHouseBrush) +// ---- +EVT_MENU(MAP_POPUP_MENU_PROPERTIES, MapCanvas::OnProperties) +// ---- +EVT_MENU(MAP_POPUP_MENU_BROWSE_TILE, MapCanvas::OnBrowseTile) END_EVENT_TABLE() -bool MapCanvas::processed[] = {0}; +bool MapCanvas::processed[] = { 0 }; -MapCanvas::MapCanvas(MapWindow* parent, Editor& editor, int* attriblist) : +MapCanvas::MapCanvas(MapWindow* parent, Editor &editor, int* attriblist) : wxGLCanvas(parent, wxID_ANY, nullptr, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS), editor(editor), floor(rme::MapGroundLayer), @@ -136,40 +136,38 @@ MapCanvas::MapCanvas(MapWindow* parent, Editor& editor, int* attriblist) : last_click_y(-1), last_mmb_click_x(-1), - last_mmb_click_y(-1) -{ + last_mmb_click_y(-1) { popup_menu = newd MapPopupMenu(editor); animation_timer = newd AnimationTimer(this); drawer = new MapDrawer(this); keyCode = WXK_NONE; } -MapCanvas::~MapCanvas() -{ +MapCanvas::~MapCanvas() { delete popup_menu; delete animation_timer; delete drawer; free(screenshot_buffer); } -void MapCanvas::Refresh() -{ - if(refresh_watch.Time() > g_settings.getInteger(Config::HARD_REFRESH_RATE)) { +void MapCanvas::Refresh() { + if (refresh_watch.Time() > g_settings.getInteger(Config::HARD_REFRESH_RATE)) { refresh_watch.Start(); wxGLCanvas::Update(); } wxGLCanvas::Refresh(); } -void MapCanvas::SetZoom(double value) -{ - if(value < 0.125) +void MapCanvas::SetZoom(double value) { + if (value < 0.125) { value = 0.125; + } - if(value > 25.00) + if (value > 25.00) { value = 25.0; + } - if(zoom != value) { + if (zoom != value) { int center_x, center_y; GetScreenCenter(¢er_x, ¢er_y); @@ -182,20 +180,18 @@ void MapCanvas::SetZoom(double value) } } -void MapCanvas::GetViewBox(int* view_scroll_x, int* view_scroll_y, int* screensize_x, int* screensize_y) const -{ +void MapCanvas::GetViewBox(int* view_scroll_x, int* view_scroll_y, int* screensize_x, int* screensize_y) const { MapWindow* window = GetMapWindow(); window->GetViewSize(screensize_x, screensize_y); window->GetViewStart(view_scroll_x, view_scroll_y); } -void MapCanvas::OnPaint(wxPaintEvent& event) -{ +void MapCanvas::OnPaint(wxPaintEvent &event) { SetCurrent(*g_gui.GetGLContext(this)); - if(g_gui.IsRenderingEnabled()) { - DrawingOptions& options = drawer->getOptions(); - if(screenshot_buffer) { + if (g_gui.IsRenderingEnabled()) { + DrawingOptions &options = drawer->getOptions(); + if (screenshot_buffer) { options.SetIngame(); } else { options.transparent_floors = g_settings.getBoolean(Config::TRANSPARENT_FLOORS); @@ -228,17 +224,19 @@ void MapCanvas::OnPaint(wxPaintEvent& event) options.dragging = boundbox_selection; - if(options.show_preview) + if (options.show_preview) { animation_timer->Start(); - else + } else { animation_timer->Stop(); + } drawer->SetupVars(); drawer->SetupGL(); drawer->Draw(); - if(screenshot_buffer) + if (screenshot_buffer) { drawer->TakeScreenshot(screenshot_buffer); + } drawer->Release(); } @@ -253,14 +251,13 @@ void MapCanvas::OnPaint(wxPaintEvent& event) editor.SendNodeRequests(); } -void MapCanvas::ShowPositionIndicator(const Position& position) -{ - if (drawer) +void MapCanvas::ShowPositionIndicator(const Position &position) { + if (drawer) { drawer->ShowPositionIndicator(position); + } } -void MapCanvas::TakeScreenshot(wxFileName path, wxString format) -{ +void MapCanvas::TakeScreenshot(wxFileName path, wxString format) { int screensize_x, screensize_y; GetViewBox(&view_scroll_x, &view_scroll_y, &screensize_x, &screensize_y); @@ -272,7 +269,7 @@ void MapCanvas::TakeScreenshot(wxFileName path, wxString format) wxGLCanvas::Update(); // Forces immediate redraws the window. // screenshot_buffer should now contain the screenbuffer - if(screenshot_buffer == nullptr) { + if (screenshot_buffer == nullptr) { g_gui.PopupDialog("Capture failed", "Image capture failed. Old Video Driver?", wxOK); } else { // We got the shit @@ -291,10 +288,11 @@ void MapCanvas::TakeScreenshot(wxFileName path, wxString format) wxString date; date << "screenshot_"; date << (1900 + current_time.tm_year); - if (current_time.tm_mon < 9) + if (current_time.tm_mon < 9) { date << "-0" << (current_time.tm_mon + 1); - else + } else { date << "-" << (current_time.tm_mon + 1); + } date << "-" << current_time.tm_mday; date << "-" << current_time.tm_hour; date << "-" << current_time.tm_min; @@ -304,35 +302,36 @@ void MapCanvas::TakeScreenshot(wxFileName path, wxString format) int type = 0; path.SetName(date); - if(format == "bmp") { + if (format == "bmp") { path.SetExt(format); type = wxBITMAP_TYPE_BMP; - } else if(format == "png") { + } else if (format == "png") { path.SetExt(format); type = wxBITMAP_TYPE_PNG; - } else if(format == "jpg" || format == "jpeg") { + } else if (format == "jpg" || format == "jpeg") { path.SetExt(format); type = wxBITMAP_TYPE_JPEG; - } else if(format == "tga") { + } else if (format == "tga") { path.SetExt(format); type = wxBITMAP_TYPE_TGA; } else { g_gui.SetStatusText("Unknown screenshot format \'" + format + "\", switching to default (png)"); - path.SetExt("png");; + path.SetExt("png"); + ; type = wxBITMAP_TYPE_PNG; } path.Mkdir(0755, wxPATH_MKDIR_FULL); wxFileOutputStream of(path.GetFullPath()); - if(of.IsOk()) { - if(screenshot.SaveFile(of, static_cast(type))) + if (of.IsOk()) { + if (screenshot.SaveFile(of, static_cast(type))) { g_gui.SetStatusText("Took screenshot and saved as " + path.GetFullName()); - else + } else { g_gui.PopupDialog("File error", "Couldn't save image file correctly.", wxOK); + } } else { g_gui.PopupDialog("File error", "Couldn't open file " + path.GetFullPath() + " for writing.", wxOK); } - } Refresh(); @@ -340,87 +339,91 @@ void MapCanvas::TakeScreenshot(wxFileName path, wxString format) screenshot_buffer = nullptr; } -void MapCanvas::ScreenToMap(int screen_x, int screen_y, int* map_x, int* map_y) -{ +void MapCanvas::ScreenToMap(int screen_x, int screen_y, int* map_x, int* map_y) { int start_x, start_y; GetMapWindow()->GetViewStart(&start_x, &start_y); screen_x *= GetContentScaleFactor(); screen_y *= GetContentScaleFactor(); - if(screen_x < 0) { + if (screen_x < 0) { *map_x = (start_x + screen_x) / rme::TileSize; } else { *map_x = int(start_x + (screen_x * zoom)) / rme::TileSize; } - if(screen_y < 0) { + if (screen_y < 0) { *map_y = (start_y + screen_y) / rme::TileSize; } else { *map_y = int(start_y + (screen_y * zoom)) / rme::TileSize; } - if(floor <= rme::MapGroundLayer) { + if (floor <= rme::MapGroundLayer) { *map_x += rme::MapGroundLayer - floor; *map_y += rme::MapGroundLayer - floor; - }/* else { - *map_x += rme::MapMaxLayer - floor; - *map_y += rme::MapMaxLayer - floor; - }*/ + } /* else { + *map_x += rme::MapMaxLayer - floor; + *map_y += rme::MapMaxLayer - floor; + }*/ } -MapWindow* MapCanvas::GetMapWindow() const -{ +MapWindow* MapCanvas::GetMapWindow() const { wxWindow* window = GetParent(); - if(window) + if (window) { return static_cast(window); + } return nullptr; } -void MapCanvas::GetScreenCenter(int* map_x, int* map_y) -{ +void MapCanvas::GetScreenCenter(int* map_x, int* map_y) { int width, height; GetMapWindow()->GetViewSize(&width, &height); - return ScreenToMap(width/2, height/2, map_x, map_y); + return ScreenToMap(width / 2, height / 2, map_x, map_y); } -Position MapCanvas::GetCursorPosition() const -{ +Position MapCanvas::GetCursorPosition() const { return Position(last_cursor_map_x, last_cursor_map_y, floor); } -void MapCanvas::UpdatePositionStatus(int x, int y) -{ - if(x == -1) x = cursor_x; - if(y == -1) y = cursor_y; +void MapCanvas::UpdatePositionStatus(int x, int y) { + if (x == -1) { + x = cursor_x; + } + if (y == -1) { + y = cursor_y; + } int map_x, map_y; ScreenToMap(x, y, &map_x, &map_y); wxString ss; ss << "x: " << map_x << " y:" << map_y << " z:" << floor; - g_gui.root->SetStatusText(ss,2); + g_gui.root->SetStatusText(ss, 2); ss = ""; Tile* tile = editor.getMap().getTile(map_x, map_y, floor); - if(tile) { - if(tile->spawnMonster && g_settings.getInteger(Config::SHOW_SPAWNS_MONSTER)) { + if (tile) { + if (tile->spawnMonster && g_settings.getInteger(Config::SHOW_SPAWNS_MONSTER)) { ss << "Monster spawn radius: " << tile->spawnMonster->getSize(); - } else if(tile->monster && g_settings.getInteger(Config::SHOW_MONSTERS)) { + } else if (tile->monster && g_settings.getInteger(Config::SHOW_MONSTERS)) { ss << ("Monster"); ss << " \"" << wxstr(tile->monster->getName()) << "\" spawntime: " << tile->monster->getSpawnMonsterTime(); - } else if(tile->spawnNpc && g_settings.getInteger(Config::SHOW_SPAWNS_NPC)) { + } else if (tile->spawnNpc && g_settings.getInteger(Config::SHOW_SPAWNS_NPC)) { ss << "Npc spawn radius: " << tile->spawnNpc->getSize(); - } else if(tile->npc && g_settings.getInteger(Config::SHOW_NPCS)) { + } else if (tile->npc && g_settings.getInteger(Config::SHOW_NPCS)) { ss << ("NPC"); ss << " \"" << wxstr(tile->npc->getName()) << "\" spawntime: " << tile->npc->getSpawnNpcTime(); - } else if(Item* item = tile->getTopItem()) { + } else if (Item* item = tile->getTopItem()) { ss << "Item \"" << wxstr(item->getName()) << "\""; ss << " id:" << item->getID(); ss << " cid:" << item->getClientID(); - if(item->getUniqueID()) ss << " uid:" << item->getUniqueID(); - if(item->getActionID()) ss << " aid:" << item->getActionID(); - if(item->hasWeight()) { + if (item->getUniqueID()) { + ss << " uid:" << item->getUniqueID(); + } + if (item->getActionID()) { + ss << " aid:" << item->getActionID(); + } + if (item->hasWeight()) { wxString s; s.Printf("%.2f", item->getWeight()); ss << " weight: " << s; @@ -432,25 +435,23 @@ void MapCanvas::UpdatePositionStatus(int x, int y) ss << "Nothing"; } - if(editor.IsLive()) { + if (editor.IsLive()) { editor.GetLive().updateCursor(Position(map_x, map_y, floor)); } g_gui.root->SetStatusText(ss, 1); } -void MapCanvas::UpdateZoomStatus() -{ +void MapCanvas::UpdateZoomStatus() { int percentage = (int)((1.0 / zoom) * 100); wxString ss; ss << "zoom: " << percentage << "%"; g_gui.root->SetStatusText(ss, 3); } -void MapCanvas::OnMouseMove(wxMouseEvent& event) -{ - if(screendragging) { - GetMapWindow()->ScrollRelative(int(g_settings.getFloat(Config::SCROLL_SPEED) * zoom*(event.GetX() - cursor_x)), int(g_settings.getFloat(Config::SCROLL_SPEED) * zoom*(event.GetY() - cursor_y))); +void MapCanvas::OnMouseMove(wxMouseEvent &event) { + if (screendragging) { + GetMapWindow()->ScrollRelative(int(g_settings.getFloat(Config::SCROLL_SPEED) * zoom * (event.GetX() - cursor_x)), int(g_settings.getFloat(Config::SCROLL_SPEED) * zoom * (event.GetY() - cursor_y))); Refresh(); } @@ -458,25 +459,25 @@ void MapCanvas::OnMouseMove(wxMouseEvent& event) cursor_y = event.GetY(); int mouse_map_x, mouse_map_y; - MouseToMap(&mouse_map_x,&mouse_map_y); + MouseToMap(&mouse_map_x, &mouse_map_y); bool map_update = false; - if(last_cursor_map_x != mouse_map_x || last_cursor_map_y != mouse_map_y || last_cursor_map_z != floor) { + if (last_cursor_map_x != mouse_map_x || last_cursor_map_y != mouse_map_y || last_cursor_map_z != floor) { map_update = true; } last_cursor_map_x = mouse_map_x; last_cursor_map_y = mouse_map_y; last_cursor_map_z = floor; - if(map_update) { + if (map_update) { UpdatePositionStatus(cursor_x, cursor_y); UpdateZoomStatus(); } - if(g_gui.IsSelectionMode()) { - if(map_update && isPasting()) { + if (g_gui.IsSelectionMode()) { + if (map_update && isPasting()) { Refresh(); - } else if(map_update && dragging) { + } else if (map_update && dragging) { wxString ss; int move_x = drag_start_x - mouse_map_x; @@ -486,13 +487,13 @@ void MapCanvas::OnMouseMove(wxMouseEvent& event) g_gui.SetStatusText(ss); Refresh(); - } else if(boundbox_selection) { - if(map_update) { + } else if (boundbox_selection) { + if (map_update) { wxString ss; int move_x = std::abs(last_click_map_x - mouse_map_x); int move_y = std::abs(last_click_map_y - mouse_map_y); - ss << "Selection " << move_x+1 << ":" << move_y+1; + ss << "Selection " << move_x + 1 << ":" << move_y + 1; g_gui.SetStatusText(ss); } @@ -500,17 +501,17 @@ void MapCanvas::OnMouseMove(wxMouseEvent& event) } } else { // Drawing mode Brush* brush = g_gui.GetCurrentBrush(); - if(map_update && drawing && brush) { - if(brush->isDoodad()) { - if(event.ControlDown()) { + if (map_update && drawing && brush) { + if (brush->isDoodad()) { + if (event.ControlDown()) { PositionVector tilestodraw; getTilesToDraw(mouse_map_x, mouse_map_y, floor, &tilestodraw, nullptr); editor.undraw(tilestodraw, event.ShiftDown() || event.AltDown()); } else { editor.draw(Position(mouse_map_x, mouse_map_y, floor), event.ShiftDown() || event.AltDown()); } - } else if(brush->isDoor()) { - if(!brush->canDraw(&editor.getMap(), Position(mouse_map_x, mouse_map_y, floor))) { + } else if (brush->isDoor()) { + if (!brush->canDraw(&editor.getMap(), Position(mouse_map_x, mouse_map_y, floor))) { // We don't have to waste an action in this case... } else { PositionVector tilestodraw; @@ -518,33 +519,33 @@ void MapCanvas::OnMouseMove(wxMouseEvent& event) tilestodraw.push_back(Position(mouse_map_x, mouse_map_y, floor)); - tilestoborder.push_back(Position(mouse_map_x , mouse_map_y - 1, floor)); - tilestoborder.push_back(Position(mouse_map_x - 1, mouse_map_y , floor)); - tilestoborder.push_back(Position(mouse_map_x , mouse_map_y + 1, floor)); - tilestoborder.push_back(Position(mouse_map_x + 1, mouse_map_y , floor)); + tilestoborder.push_back(Position(mouse_map_x, mouse_map_y - 1, floor)); + tilestoborder.push_back(Position(mouse_map_x - 1, mouse_map_y, floor)); + tilestoborder.push_back(Position(mouse_map_x, mouse_map_y + 1, floor)); + tilestoborder.push_back(Position(mouse_map_x + 1, mouse_map_y, floor)); - if(event.ControlDown()) { + if (event.ControlDown()) { editor.undraw(tilestodraw, tilestoborder, event.AltDown()); } else { editor.draw(tilestodraw, tilestoborder, event.AltDown()); } } - } else if(brush->needBorders()) { + } else if (brush->needBorders()) { PositionVector tilestodraw, tilestoborder; getTilesToDraw(mouse_map_x, mouse_map_y, floor, &tilestodraw, &tilestoborder); - if(event.ControlDown()) { + if (event.ControlDown()) { editor.undraw(tilestodraw, tilestoborder, event.AltDown()); } else { editor.draw(tilestodraw, tilestoborder, event.AltDown()); } - } else if(brush->oneSizeFitsAll()) { + } else if (brush->oneSizeFitsAll()) { drawing = true; PositionVector tilestodraw; - tilestodraw.push_back(Position(mouse_map_x,mouse_map_y, floor)); + tilestodraw.push_back(Position(mouse_map_x, mouse_map_y, floor)); - if(event.ControlDown()) { + if (event.ControlDown()) { editor.undraw(tilestodraw, event.AltDown()); } else { editor.draw(tilestodraw, event.AltDown()); @@ -552,19 +553,19 @@ void MapCanvas::OnMouseMove(wxMouseEvent& event) } else { // No borders PositionVector tilestodraw; - for(int y = -g_gui.GetBrushSize(); y <= g_gui.GetBrushSize(); y++) { - for(int x = -g_gui.GetBrushSize(); x <= g_gui.GetBrushSize(); x++) { - if(g_gui.GetBrushShape() == BRUSHSHAPE_SQUARE) { - tilestodraw.push_back(Position(mouse_map_x+x,mouse_map_y+y, floor)); - } else if(g_gui.GetBrushShape() == BRUSHSHAPE_CIRCLE) { - double distance = sqrt(double(x*x) + double(y*y)); - if(distance < g_gui.GetBrushSize()+0.005) { - tilestodraw.push_back(Position(mouse_map_x+x,mouse_map_y+y, floor)); + for (int y = -g_gui.GetBrushSize(); y <= g_gui.GetBrushSize(); y++) { + for (int x = -g_gui.GetBrushSize(); x <= g_gui.GetBrushSize(); x++) { + if (g_gui.GetBrushShape() == BRUSHSHAPE_SQUARE) { + tilestodraw.push_back(Position(mouse_map_x + x, mouse_map_y + y, floor)); + } else if (g_gui.GetBrushShape() == BRUSHSHAPE_CIRCLE) { + double distance = sqrt(double(x * x) + double(y * y)); + if (distance < g_gui.GetBrushSize() + 0.005) { + tilestodraw.push_back(Position(mouse_map_x + x, mouse_map_y + y, floor)); } } } } - if(event.ControlDown()) { + if (event.ControlDown()) { editor.undraw(tilestodraw, event.AltDown()); } else { editor.draw(tilestodraw, event.AltDown()); @@ -575,7 +576,7 @@ void MapCanvas::OnMouseMove(wxMouseEvent& event) g_gui.FillDoodadPreviewBuffer(); g_gui.RefreshView(); - } else if(dragging_draw) { + } else if (dragging_draw) { g_gui.RefreshView(); } else if (map_update && brush) { Refresh(); @@ -583,54 +584,55 @@ void MapCanvas::OnMouseMove(wxMouseEvent& event) } } -void MapCanvas::OnMouseLeftRelease(wxMouseEvent& event) -{ +void MapCanvas::OnMouseLeftRelease(wxMouseEvent &event) { OnMouseActionRelease(event); } -void MapCanvas::OnMouseLeftClick(wxMouseEvent& event) -{ +void MapCanvas::OnMouseLeftClick(wxMouseEvent &event) { OnMouseActionClick(event); } -void MapCanvas::OnMouseLeftDoubleClick(wxMouseEvent& event) -{ - if(!g_settings.getInteger(Config::DOUBLECLICK_PROPERTIES)) { +void MapCanvas::OnMouseLeftDoubleClick(wxMouseEvent &event) { + if (!g_settings.getInteger(Config::DOUBLECLICK_PROPERTIES)) { return; } - Map& map = editor.getMap(); + Map &map = editor.getMap(); int mouse_map_x, mouse_map_y; ScreenToMap(event.GetX(), event.GetY(), &mouse_map_x, &mouse_map_y); const Tile* tile = map.getTile(mouse_map_x, mouse_map_y, floor); - if(tile && tile->size() > 0) { + if (tile && tile->size() > 0) { Tile* new_tile = tile->deepCopy(map); wxDialog* dialog = nullptr; - // Show monster spawn - if(new_tile->spawnMonster && g_settings.getInteger(Config::SHOW_SPAWNS_MONSTER)) - dialog = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, new_tile->spawnMonster); - // Show monster - else if(new_tile->monster && g_settings.getInteger(Config::SHOW_MONSTERS)) - dialog = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, new_tile->monster); - // Show npc - else if(new_tile->npc && g_settings.getInteger(Config::SHOW_NPCS)) - dialog = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, new_tile->npc); - // Show npc spawn - else if(new_tile->spawnNpc && g_settings.getInteger(Config::SHOW_SPAWNS_NPC)) - dialog = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, new_tile->spawnNpc); - else if(Item* item = new_tile->getTopItem()) { - if(editor.getMap().getVersion().otbm >= MAP_OTBM_4) - dialog = newd PropertiesWindow(g_gui.root, &editor.getMap(), new_tile, item); - else - dialog = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, item); + // Show monster spawn + if (new_tile->spawnMonster && g_settings.getInteger(Config::SHOW_SPAWNS_MONSTER)) { + dialog = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, new_tile->spawnMonster); + } + // Show monster + else if (new_tile->monster && g_settings.getInteger(Config::SHOW_MONSTERS)) { + dialog = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, new_tile->monster); + } + // Show npc + else if (new_tile->npc && g_settings.getInteger(Config::SHOW_NPCS)) { + dialog = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, new_tile->npc); + } + // Show npc spawn + else if (new_tile->spawnNpc && g_settings.getInteger(Config::SHOW_SPAWNS_NPC)) { + dialog = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, new_tile->spawnNpc); + } else if (Item* item = new_tile->getTopItem()) { + if (editor.getMap().getVersion().otbm >= MAP_OTBM_4) { + dialog = newd PropertiesWindow(g_gui.root, &editor.getMap(), new_tile, item); } else { + dialog = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, item); + } + } else { delete new_tile; return; } int ret = dialog->ShowModal(); - if(ret != 0) { + if (ret != 0) { Action* action = editor.createAction(ACTION_CHANGE_PROPERTIES); action->addChange(newd Change(new_tile)); editor.addAction(action); @@ -642,59 +644,55 @@ void MapCanvas::OnMouseLeftDoubleClick(wxMouseEvent& event) } } -void MapCanvas::OnMouseCenterClick(wxMouseEvent& event) -{ - if(g_settings.getInteger(Config::SWITCH_MOUSEBUTTONS)) { +void MapCanvas::OnMouseCenterClick(wxMouseEvent &event) { + if (g_settings.getInteger(Config::SWITCH_MOUSEBUTTONS)) { OnMousePropertiesClick(event); } else { OnMouseCameraClick(event); } } -void MapCanvas::OnMouseCenterRelease(wxMouseEvent& event) -{ - if(g_settings.getInteger(Config::SWITCH_MOUSEBUTTONS)) { +void MapCanvas::OnMouseCenterRelease(wxMouseEvent &event) { + if (g_settings.getInteger(Config::SWITCH_MOUSEBUTTONS)) { OnMousePropertiesRelease(event); } else { OnMouseCameraRelease(event); } } -void MapCanvas::OnMouseRightClick(wxMouseEvent& event) -{ - if(g_settings.getInteger(Config::SWITCH_MOUSEBUTTONS)) { +void MapCanvas::OnMouseRightClick(wxMouseEvent &event) { + if (g_settings.getInteger(Config::SWITCH_MOUSEBUTTONS)) { OnMouseCameraClick(event); } else { OnMousePropertiesClick(event); } } -void MapCanvas::OnMouseRightRelease(wxMouseEvent& event) -{ - if(g_settings.getInteger(Config::SWITCH_MOUSEBUTTONS)) { +void MapCanvas::OnMouseRightRelease(wxMouseEvent &event) { + if (g_settings.getInteger(Config::SWITCH_MOUSEBUTTONS)) { OnMouseCameraRelease(event); } else { OnMousePropertiesRelease(event); } } -void MapCanvas::OnMouseActionClick(wxMouseEvent& event) -{ +void MapCanvas::OnMouseActionClick(wxMouseEvent &event) { SetFocus(); int mouse_map_x, mouse_map_y; ScreenToMap(event.GetX(), event.GetY(), &mouse_map_x, &mouse_map_y); - if(event.ControlDown() && event.AltDown()) { + if (event.ControlDown() && event.AltDown()) { Tile* tile = editor.getMap().getTile(mouse_map_x, mouse_map_y, floor); - if(tile && tile->size() > 0) { + if (tile && tile->size() > 0) { Item* item = tile->getTopItem(); - if(item && item->getRAWBrush()) + if (item && item->getRAWBrush()) { g_gui.SelectBrush(item->getRAWBrush(), TILESET_RAW); + } } - } else if(g_gui.IsSelectionMode()) { - Selection& selection = editor.getSelection(); - if(isPasting()) { + } else if (g_gui.IsSelectionMode()) { + Selection &selection = editor.getSelection(); + if (isPasting()) { // Set paste to false (no rendering etc.) EndPasting(); @@ -706,160 +704,162 @@ void MapCanvas::OnMouseActionClick(wxMouseEvent& event) drag_start_x = mouse_map_x; drag_start_y = mouse_map_y; drag_start_z = floor; - } else do { - boundbox_selection = false; - if(event.ShiftDown()) { - boundbox_selection = true; - - if(!event.ControlDown()) { - selection.start(Selection::NONE, ACTION_UNSELECT); // Start selection session - selection.clear(); // Clear out selection - selection.finish(); // End selection session - selection.updateSelectionCount(); - } - } else if(event.ControlDown()) { - Tile* tile = editor.getMap().getTile(mouse_map_x, mouse_map_y, floor); - if(tile) { - // Show monster spawn - if(tile->spawnMonster && g_settings.getInteger(Config::SHOW_SPAWNS_MONSTER)) { - selection.start(); // Start selection session - if(tile->spawnMonster->isSelected()) { - selection.remove(tile, tile->spawnMonster); - } else { - selection.add(tile, tile->spawnMonster); - } - selection.finish(); // Finish selection session - selection.updateSelectionCount(); - // Show monsters - } else if(tile->monster && g_settings.getInteger(Config::SHOW_MONSTERS)) { - selection.start(); // Start selection session - if(tile->monster->isSelected()) { - selection.remove(tile, tile->monster); - } else { - selection.add(tile, tile->monster); - } - selection.finish(); // Finish selection session + } else { + do { + boundbox_selection = false; + if (event.ShiftDown()) { + boundbox_selection = true; + + if (!event.ControlDown()) { + selection.start(Selection::NONE, ACTION_UNSELECT); // Start selection session + selection.clear(); // Clear out selection + selection.finish(); // End selection session selection.updateSelectionCount(); - } else { - Item* item = tile->getTopItem(); - if(item) { + } + } else if (event.ControlDown()) { + Tile* tile = editor.getMap().getTile(mouse_map_x, mouse_map_y, floor); + if (tile) { + // Show monster spawn + if (tile->spawnMonster && g_settings.getInteger(Config::SHOW_SPAWNS_MONSTER)) { selection.start(); // Start selection session - if(item->isSelected()) { - selection.remove(tile, item); + if (tile->spawnMonster->isSelected()) { + selection.remove(tile, tile->spawnMonster); } else { - selection.add(tile, item); + selection.add(tile, tile->spawnMonster); + } + selection.finish(); // Finish selection session + selection.updateSelectionCount(); + // Show monsters + } else if (tile->monster && g_settings.getInteger(Config::SHOW_MONSTERS)) { + selection.start(); // Start selection session + if (tile->monster->isSelected()) { + selection.remove(tile, tile->monster); + } else { + selection.add(tile, tile->monster); } selection.finish(); // Finish selection session selection.updateSelectionCount(); - } - } - // Show npcs - if(tile->spawnNpc && g_settings.getInteger(Config::SHOW_SPAWNS_NPC)) { - selection.start(); // Start selection session - if(tile->spawnNpc->isSelected()) { - selection.remove(tile, tile->spawnNpc); - } else { - selection.add(tile, tile->spawnNpc); - } - selection.finish(); // Finish selection session - selection.updateSelectionCount(); - } else if(tile->npc && g_settings.getInteger(Config::SHOW_NPCS)) { - selection.start(); // Start selection session - if(tile->npc->isSelected()) { - selection.remove(tile, tile->npc); } else { - selection.add(tile, tile->npc); + Item* item = tile->getTopItem(); + if (item) { + selection.start(); // Start selection session + if (item->isSelected()) { + selection.remove(tile, item); + } else { + selection.add(tile, item); + } + selection.finish(); // Finish selection session + selection.updateSelectionCount(); + } } - selection.finish(); // Finish selection session - selection.updateSelectionCount(); - // Show npc spawn - } else { - Item* item = tile->getTopItem(); - if(item) { + // Show npcs + if (tile->spawnNpc && g_settings.getInteger(Config::SHOW_SPAWNS_NPC)) { selection.start(); // Start selection session - if(item->isSelected()) { - selection.remove(tile, item); + if (tile->spawnNpc->isSelected()) { + selection.remove(tile, tile->spawnNpc); } else { - selection.add(tile, item); + selection.add(tile, tile->spawnNpc); } selection.finish(); // Finish selection session selection.updateSelectionCount(); + } else if (tile->npc && g_settings.getInteger(Config::SHOW_NPCS)) { + selection.start(); // Start selection session + if (tile->npc->isSelected()) { + selection.remove(tile, tile->npc); + } else { + selection.add(tile, tile->npc); + } + selection.finish(); // Finish selection session + selection.updateSelectionCount(); + // Show npc spawn + } else { + Item* item = tile->getTopItem(); + if (item) { + selection.start(); // Start selection session + if (item->isSelected()) { + selection.remove(tile, item); + } else { + selection.add(tile, item); + } + selection.finish(); // Finish selection session + selection.updateSelectionCount(); + } } } - } - } else { - Tile* tile = editor.getMap().getTile(mouse_map_x, mouse_map_y, floor); - if(!tile) { - selection.start(Selection::NONE, ACTION_UNSELECT); // Start selection session - selection.clear(); // Clear out selection - selection.finish(); // End selection session - selection.updateSelectionCount(); - } else if(tile->isSelected()) { - dragging = true; - drag_start_x = mouse_map_x; - drag_start_y = mouse_map_y; - drag_start_z = floor; } else { - selection.start(); // Start a selection session - selection.clear(); - selection.commit(); - // Show monster spawn - if(tile->spawnMonster && g_settings.getInteger(Config::SHOW_SPAWNS_MONSTER)) { - selection.add(tile, tile->spawnMonster); - dragging = true; - drag_start_x = mouse_map_x; - drag_start_y = mouse_map_y; - drag_start_z = floor; - // Show monsters - } else if(tile->monster && g_settings.getInteger(Config::SHOW_MONSTERS)) { - selection.add(tile, tile->monster); - dragging = true; - drag_start_x = mouse_map_x; - drag_start_y = mouse_map_y; - drag_start_z = floor; - // Show npc spawns - } else if(tile->spawnNpc && g_settings.getInteger(Config::SHOW_SPAWNS_NPC)) { - selection.add(tile, tile->spawnNpc); - dragging = true; - drag_start_x = mouse_map_x; - drag_start_y = mouse_map_y; - drag_start_z = floor; - // Show npcs - } else if(tile->npc && g_settings.getInteger(Config::SHOW_NPCS)) { - selection.add(tile, tile->npc); + Tile* tile = editor.getMap().getTile(mouse_map_x, mouse_map_y, floor); + if (!tile) { + selection.start(Selection::NONE, ACTION_UNSELECT); // Start selection session + selection.clear(); // Clear out selection + selection.finish(); // End selection session + selection.updateSelectionCount(); + } else if (tile->isSelected()) { dragging = true; drag_start_x = mouse_map_x; drag_start_y = mouse_map_y; drag_start_z = floor; } else { - Item* item = tile->getTopItem(); - if(item) { - selection.add(tile, item); + selection.start(); // Start a selection session + selection.clear(); + selection.commit(); + // Show monster spawn + if (tile->spawnMonster && g_settings.getInteger(Config::SHOW_SPAWNS_MONSTER)) { + selection.add(tile, tile->spawnMonster); + dragging = true; + drag_start_x = mouse_map_x; + drag_start_y = mouse_map_y; + drag_start_z = floor; + // Show monsters + } else if (tile->monster && g_settings.getInteger(Config::SHOW_MONSTERS)) { + selection.add(tile, tile->monster); + dragging = true; + drag_start_x = mouse_map_x; + drag_start_y = mouse_map_y; + drag_start_z = floor; + // Show npc spawns + } else if (tile->spawnNpc && g_settings.getInteger(Config::SHOW_SPAWNS_NPC)) { + selection.add(tile, tile->spawnNpc); + dragging = true; + drag_start_x = mouse_map_x; + drag_start_y = mouse_map_y; + drag_start_z = floor; + // Show npcs + } else if (tile->npc && g_settings.getInteger(Config::SHOW_NPCS)) { + selection.add(tile, tile->npc); dragging = true; drag_start_x = mouse_map_x; drag_start_y = mouse_map_y; drag_start_z = floor; + } else { + Item* item = tile->getTopItem(); + if (item) { + selection.add(tile, item); + dragging = true; + drag_start_x = mouse_map_x; + drag_start_y = mouse_map_y; + drag_start_z = floor; + } } + selection.finish(); // Finish the selection session + selection.updateSelectionCount(); } - selection.finish(); // Finish the selection session - selection.updateSelectionCount(); } - } - } while(false); - } else if(g_gui.GetCurrentBrush()) { // Drawing mode + } while (false); + } + } else if (g_gui.GetCurrentBrush()) { // Drawing mode Brush* brush = g_gui.GetCurrentBrush(); - if(event.ShiftDown() && brush->canDrag()) { + if (event.ShiftDown() && brush->canDrag()) { dragging_draw = true; } else { - if(g_gui.GetBrushSize() == 0 && !brush->oneSizeFitsAll()) { + if (g_gui.GetBrushSize() == 0 && !brush->oneSizeFitsAll()) { drawing = true; } else { drawing = g_gui.GetCurrentBrush()->canSmear(); } - if(brush->isWall()) { - if(event.AltDown() && g_gui.GetBrushSize() == 0) { + if (brush->isWall()) { + if (event.AltDown() && g_gui.GetBrushSize() == 0) { // z0mg, just clicked a tile, shift variaton. - if(event.ControlDown()) { + if (event.ControlDown()) { editor.undraw(Position(mouse_map_x, mouse_map_y, floor), event.AltDown()); } else { editor.draw(Position(mouse_map_x, mouse_map_y, floor), event.AltDown()); @@ -870,45 +870,44 @@ void MapCanvas::OnMouseActionClick(wxMouseEvent& event) int start_map_x = mouse_map_x - g_gui.GetBrushSize(); int start_map_y = mouse_map_y - g_gui.GetBrushSize(); - int end_map_x = mouse_map_x + g_gui.GetBrushSize(); - int end_map_y = mouse_map_y + g_gui.GetBrushSize(); + int end_map_x = mouse_map_x + g_gui.GetBrushSize(); + int end_map_y = mouse_map_y + g_gui.GetBrushSize(); - for(int y = start_map_y -1; y <= end_map_y + 1; ++y) { - for(int x = start_map_x - 1; x <= end_map_x + 1; ++x) { - if((x <= start_map_x+1 || x >= end_map_x-1) || (y <= start_map_y+1 || y >= end_map_y-1)) { - tilestoborder.push_back(Position(x,y,floor)); + for (int y = start_map_y - 1; y <= end_map_y + 1; ++y) { + for (int x = start_map_x - 1; x <= end_map_x + 1; ++x) { + if ((x <= start_map_x + 1 || x >= end_map_x - 1) || (y <= start_map_y + 1 || y >= end_map_y - 1)) { + tilestoborder.push_back(Position(x, y, floor)); } - if(((x == start_map_x || x == end_map_x) || (y == start_map_y || y == end_map_y)) && - ((x >= start_map_x && x <= end_map_x) && (y >= start_map_y && y <= end_map_y))) { - tilestodraw.push_back(Position(x,y,floor)); + if (((x == start_map_x || x == end_map_x) || (y == start_map_y || y == end_map_y)) && ((x >= start_map_x && x <= end_map_x) && (y >= start_map_y && y <= end_map_y))) { + tilestodraw.push_back(Position(x, y, floor)); } } } - if(event.ControlDown()) { + if (event.ControlDown()) { editor.undraw(tilestodraw, tilestoborder, event.AltDown()); } else { editor.draw(tilestodraw, tilestoborder, event.AltDown()); } } - } else if(brush->isDoor()) { + } else if (brush->isDoor()) { PositionVector tilestodraw; PositionVector tilestoborder; tilestodraw.push_back(Position(mouse_map_x, mouse_map_y, floor)); - tilestoborder.push_back(Position(mouse_map_x , mouse_map_y - 1, floor)); - tilestoborder.push_back(Position(mouse_map_x - 1, mouse_map_y , floor)); - tilestoborder.push_back(Position(mouse_map_x , mouse_map_y + 1, floor)); - tilestoborder.push_back(Position(mouse_map_x + 1, mouse_map_y , floor)); + tilestoborder.push_back(Position(mouse_map_x, mouse_map_y - 1, floor)); + tilestoborder.push_back(Position(mouse_map_x - 1, mouse_map_y, floor)); + tilestoborder.push_back(Position(mouse_map_x, mouse_map_y + 1, floor)); + tilestoborder.push_back(Position(mouse_map_x + 1, mouse_map_y, floor)); - if(event.ControlDown()) { + if (event.ControlDown()) { editor.undraw(tilestodraw, tilestoborder, event.AltDown()); } else { editor.draw(tilestodraw, tilestoborder, event.AltDown()); } - } else if(brush->isDoodad() || brush->isSpawnMonster() || brush->isMonster()) { - if(event.ControlDown()) { - if(brush->isDoodad()) { + } else if (brush->isDoodad() || brush->isSpawnMonster() || brush->isMonster()) { + if (event.ControlDown()) { + if (brush->isDoodad()) { PositionVector tilestodraw; getTilesToDraw(mouse_map_x, mouse_map_y, floor, &tilestodraw, nullptr); editor.undraw(tilestodraw, event.AltDown()); @@ -917,10 +916,10 @@ void MapCanvas::OnMouseActionClick(wxMouseEvent& event) } } else { bool will_show_spawn = false; - if(brush->isSpawnMonster() || brush->isMonster()) { - if(!g_settings.getBoolean(Config::SHOW_SPAWNS_MONSTER)) { + if (brush->isSpawnMonster() || brush->isMonster()) { + if (!g_settings.getBoolean(Config::SHOW_SPAWNS_MONSTER)) { Tile* tile = editor.getMap().getTile(mouse_map_x, mouse_map_y, floor); - if(!tile || !tile->spawnMonster) { + if (!tile || !tile->spawnMonster) { will_show_spawn = true; } } @@ -928,17 +927,17 @@ void MapCanvas::OnMouseActionClick(wxMouseEvent& event) editor.draw(Position(mouse_map_x, mouse_map_y, floor), event.ShiftDown() || event.AltDown()); - if(will_show_spawn) { + if (will_show_spawn) { Tile* tile = editor.getMap().getTile(mouse_map_x, mouse_map_y, floor); - if(tile && tile->spawnMonster) { + if (tile && tile->spawnMonster) { g_settings.setInteger(Config::SHOW_SPAWNS_MONSTER, true); g_gui.UpdateMenubar(); } } } - } else if(brush->isDoodad() || brush->isSpawnNpc() || brush->isNpc()) { - if(event.ControlDown()) { - if(brush->isDoodad()) { + } else if (brush->isDoodad() || brush->isSpawnNpc() || brush->isNpc()) { + if (event.ControlDown()) { + if (brush->isDoodad()) { PositionVector tilestodraw; getTilesToDraw(mouse_map_x, mouse_map_y, floor, &tilestodraw, nullptr); editor.undraw(tilestodraw, event.AltDown()); @@ -947,10 +946,10 @@ void MapCanvas::OnMouseActionClick(wxMouseEvent& event) } } else { bool will_show_spawn_npc = false; - if(brush->isSpawnNpc() || brush->isNpc()) { - if(!g_settings.getBoolean(Config::SHOW_SPAWNS_NPC)) { + if (brush->isSpawnNpc() || brush->isNpc()) { + if (!g_settings.getBoolean(Config::SHOW_SPAWNS_NPC)) { Tile* tile = editor.getMap().getTile(mouse_map_x, mouse_map_y, floor); - if(!tile || !tile->spawnNpc) { + if (!tile || !tile->spawnNpc) { will_show_spawn_npc = true; } } @@ -958,44 +957,44 @@ void MapCanvas::OnMouseActionClick(wxMouseEvent& event) editor.draw(Position(mouse_map_x, mouse_map_y, floor), event.ShiftDown() || event.AltDown()); - if(will_show_spawn_npc) { + if (will_show_spawn_npc) { Tile* tile = editor.getMap().getTile(mouse_map_x, mouse_map_y, floor); - if(tile && tile->spawnNpc) { + if (tile && tile->spawnNpc) { g_settings.setInteger(Config::SHOW_SPAWNS_NPC, true); g_gui.UpdateMenubar(); } } } } else { - if(brush->isGround() && event.AltDown()) { + if (brush->isGround() && event.AltDown()) { replace_dragging = true; Tile* draw_tile = editor.getMap().getTile(mouse_map_x, mouse_map_y, floor); - if(draw_tile) { + if (draw_tile) { editor.replace_brush = draw_tile->getGroundBrush(); } else { editor.replace_brush = nullptr; } } - if(brush->needBorders()) { + if (brush->needBorders()) { PositionVector tilestodraw; PositionVector tilestoborder; bool fill = keyCode == WXK_CONTROL_D && event.ControlDown() && brush->isGround(); getTilesToDraw(mouse_map_x, mouse_map_y, floor, &tilestodraw, &tilestoborder, fill); - if(!fill && event.ControlDown()) { + if (!fill && event.ControlDown()) { editor.undraw(tilestodraw, tilestoborder, event.AltDown()); } else { editor.draw(tilestodraw, tilestoborder, event.AltDown()); } - } else if(brush->oneSizeFitsAll()) { - if(brush->isHouseExit() || brush->isWaypoint()) { + } else if (brush->oneSizeFitsAll()) { + if (brush->isHouseExit() || brush->isWaypoint()) { editor.draw(Position(mouse_map_x, mouse_map_y, floor), event.AltDown()); } else { PositionVector tilestodraw; - tilestodraw.push_back(Position(mouse_map_x,mouse_map_y, floor)); - if(event.ControlDown()) { + tilestodraw.push_back(Position(mouse_map_x, mouse_map_y, floor)); + if (event.ControlDown()) { editor.undraw(tilestodraw, event.AltDown()); } else { editor.draw(tilestodraw, event.AltDown()); @@ -1006,7 +1005,7 @@ void MapCanvas::OnMouseActionClick(wxMouseEvent& event) getTilesToDraw(mouse_map_x, mouse_map_y, floor, &tilestodraw, nullptr); - if(event.ControlDown()) { + if (event.ControlDown()) { editor.undraw(tilestodraw, event.AltDown()); } else { editor.draw(tilestodraw, event.AltDown()); @@ -1017,8 +1016,8 @@ void MapCanvas::OnMouseActionClick(wxMouseEvent& event) g_gui.FillDoodadPreviewBuffer(); } } - last_click_x = int(event.GetX()*zoom); - last_click_y = int(event.GetY()*zoom); + last_click_x = int(event.GetX() * zoom); + last_click_y = int(event.GetY() * zoom); int start_x, start_y; GetMapWindow()->GetViewStart(&start_x, &start_y); @@ -1032,8 +1031,7 @@ void MapCanvas::OnMouseActionClick(wxMouseEvent& event) g_gui.UpdateMinimap(); } -void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) -{ +void MapCanvas::OnMouseActionRelease(wxMouseEvent &event) { int mouse_map_x, mouse_map_y; ScreenToMap(event.GetX(), event.GetY(), &mouse_map_x, &mouse_map_y); @@ -1041,18 +1039,18 @@ void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) int move_y = last_click_map_y - mouse_map_y; int move_z = last_click_map_z - floor; - if(g_gui.IsSelectionMode()) { - if(dragging && (move_x != 0 || move_y != 0 || move_z != 0)) { + if (g_gui.IsSelectionMode()) { + if (dragging && (move_x != 0 || move_y != 0 || move_z != 0)) { editor.moveSelection(Position(move_x, move_y, move_z)); } else { - Selection& selection = editor.getSelection(); - if(boundbox_selection) { - if(mouse_map_x == last_click_map_x && mouse_map_y == last_click_map_y && event.ControlDown()) { + Selection &selection = editor.getSelection(); + if (boundbox_selection) { + if (mouse_map_x == last_click_map_x && mouse_map_y == last_click_map_y && event.ControlDown()) { // Mouse hasn't moved, do control+shift thingy! Tile* tile = editor.getMap().getTile(mouse_map_x, mouse_map_y, floor); - if(tile) { + if (tile) { selection.start(); // Start a selection session - if(tile->isSelected()) { + if (tile->isSelected()) { selection.remove(tile); } else { selection.add(tile); @@ -1062,12 +1060,12 @@ void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) } } else { // The cursor has moved, do some boundboxing! - if(last_click_map_x > mouse_map_x) { + if (last_click_map_x > mouse_map_x) { int tmp = mouse_map_x; mouse_map_x = last_click_map_x; last_click_map_x = tmp; } - if(last_click_map_y > mouse_map_y) { + if (last_click_map_y > mouse_map_y) { int tmp = mouse_map_y; mouse_map_y = last_click_map_y; last_click_map_y = tmp; @@ -1079,7 +1077,7 @@ void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) int start_x = 0, start_y = 0, start_z = 0; int end_x = 0, end_y = 0, end_z = 0; - switch(g_settings.getInteger(Config::SELECTION_TYPE)) { + switch (g_settings.getInteger(Config::SELECTION_TYPE)) { case SELECT_CURRENT_FLOOR: { start_z = end_z = floor; start_x = last_click_map_x; @@ -1096,7 +1094,7 @@ void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) end_y = mouse_map_y; end_z = floor; - if(g_settings.getInteger(Config::COMPENSATED_SELECT)) { + if (g_settings.getInteger(Config::COMPENSATED_SELECT)) { start_x -= (floor < rme::MapGroundLayer ? rme::MapGroundLayer - floor : 0); start_y -= (floor < rme::MapGroundLayer ? rme::MapGroundLayer - floor : 0); @@ -1110,7 +1108,7 @@ void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) case SELECT_VISIBLE_FLOORS: { start_x = last_click_map_x; start_y = last_click_map_y; - if(floor < 8) { + if (floor < 8) { start_z = rme::MapGroundLayer; } else { start_z = std::min(rme::MapMaxLayer, floor + 2); @@ -1119,7 +1117,7 @@ void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) end_y = mouse_map_y; end_z = floor; - if(g_settings.getInteger(Config::COMPENSATED_SELECT)) { + if (g_settings.getInteger(Config::COMPENSATED_SELECT)) { start_x -= (floor < rme::MapGroundLayer ? rme::MapGroundLayer - floor : 0); start_y -= (floor < rme::MapGroundLayer ? rme::MapGroundLayer - floor : 0); @@ -1130,27 +1128,27 @@ void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) } } - if(numtiles < 500) { + if (numtiles < 500) { // No point in threading for such a small set. threadcount = 1; } // Subdivide the selection area // We know it's a square, just split it into several areas int width = end_x - start_x; - if(width < threadcount) { + if (width < threadcount) { threadcount = std::min(1, width); } // Let's divide! int remainder = width; int cleared = 0; std::vector threads; - if(width == 0) { + if (width == 0) { threads.push_back(newd SelectionThread(editor, Position(start_x, start_y, start_z), Position(start_x, end_y, end_z))); } else { - for(int i = 0; i < threadcount; ++i) { + for (int i = 0; i < threadcount; ++i) { int chunksize = width / threadcount; // The last threads takes all the remainder - if(i == threadcount - 1) { + if (i == threadcount - 1) { chunksize = remainder; } threads.push_back(newd SelectionThread(editor, Position(start_x + cleared, start_y, start_z), Position(start_x + cleared + chunksize, end_y, end_z))); @@ -1162,44 +1160,44 @@ void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) ASSERT(remainder == 0); selection.start(); // Start a selection session - for(SelectionThread* thread : threads) { + for (SelectionThread* thread : threads) { thread->Execute(); } - for(SelectionThread* thread : threads) { + for (SelectionThread* thread : threads) { selection.join(thread); } selection.finish(); // Finish the selection session selection.updateSelectionCount(); } - } else if(event.ControlDown()) { + } else if (event.ControlDown()) { //// } else { // User hasn't moved anything, meaning selection/deselection Tile* tile = editor.getMap().getTile(mouse_map_x, mouse_map_y, floor); - if(tile) { - if(tile->spawnMonster && g_settings.getInteger(Config::SHOW_SPAWNS_MONSTER)) { - if(!tile->spawnMonster->isSelected()) { + if (tile) { + if (tile->spawnMonster && g_settings.getInteger(Config::SHOW_SPAWNS_MONSTER)) { + if (!tile->spawnMonster->isSelected()) { selection.start(); // Start a selection session selection.add(tile, tile->spawnMonster); selection.finish(); // Finish the selection session selection.updateSelectionCount(); } - } else if(tile->monster && g_settings.getInteger(Config::SHOW_MONSTERS)) { - if(!tile->monster->isSelected()) { + } else if (tile->monster && g_settings.getInteger(Config::SHOW_MONSTERS)) { + if (!tile->monster->isSelected()) { selection.start(); // Start a selection session selection.add(tile, tile->monster); selection.finish(); // Finish the selection session selection.updateSelectionCount(); } - } else if(tile->spawnNpc && g_settings.getInteger(Config::SHOW_SPAWNS_NPC)) { - if(!tile->spawnNpc->isSelected()) { + } else if (tile->spawnNpc && g_settings.getInteger(Config::SHOW_SPAWNS_NPC)) { + if (!tile->spawnNpc->isSelected()) { selection.start(); // Start a selection session selection.add(tile, tile->spawnNpc); selection.finish(); // Finish the selection session selection.updateSelectionCount(); } - } else if(tile->npc && g_settings.getInteger(Config::SHOW_NPCS)) { - if(!tile->npc->isSelected()) { + } else if (tile->npc && g_settings.getInteger(Config::SHOW_NPCS)) { + if (!tile->npc->isSelected()) { selection.start(); // Start a selection session selection.add(tile, tile->monster); selection.finish(); // Finish the selection session @@ -1207,7 +1205,7 @@ void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) } } else { Item* item = tile->getTopItem(); - if(item && !item->isSelected()) { + if (item && !item->isSelected()) { selection.start(); // Start a selection session selection.add(tile, item); selection.finish(); // Finish the selection session @@ -1221,33 +1219,33 @@ void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) editor.updateActions(); dragging = false; boundbox_selection = false; - } else if(g_gui.GetCurrentBrush()){ // Drawing mode + } else if (g_gui.GetCurrentBrush()) { // Drawing mode Brush* brush = g_gui.GetCurrentBrush(); - if(dragging_draw) { - if(brush->isSpawnMonster()) { + if (dragging_draw) { + if (brush->isSpawnMonster()) { int start_map_x = std::min(last_click_map_x, mouse_map_x); int start_map_y = std::min(last_click_map_y, mouse_map_y); - int end_map_x = std::max(last_click_map_x, mouse_map_x); - int end_map_y = std::max(last_click_map_y, mouse_map_y); + int end_map_x = std::max(last_click_map_x, mouse_map_x); + int end_map_y = std::max(last_click_map_y, mouse_map_y); - int map_x = start_map_x + (end_map_x - start_map_x)/2; - int map_y = start_map_y + (end_map_y - start_map_y)/2; + int map_x = start_map_x + (end_map_x - start_map_x) / 2; + int map_y = start_map_y + (end_map_y - start_map_y) / 2; - int width = std::min(g_settings.getInteger(Config::MAX_SPAWN_MONSTER_RADIUS), ((end_map_x - start_map_x)/2 + (end_map_y - start_map_y)/2)/2); + int width = std::min(g_settings.getInteger(Config::MAX_SPAWN_MONSTER_RADIUS), ((end_map_x - start_map_x) / 2 + (end_map_y - start_map_y) / 2) / 2); int old = g_gui.GetBrushSize(); g_gui.SetBrushSize(width); editor.draw(Position(map_x, map_y, floor), event.AltDown()); g_gui.SetBrushSize(old); - } else if(brush->isSpawnNpc()) { + } else if (brush->isSpawnNpc()) { int start_map_x = std::min(last_click_map_x, mouse_map_x); int start_map_y = std::min(last_click_map_y, mouse_map_y); - int end_map_x = std::max(last_click_map_x, mouse_map_x); - int end_map_y = std::max(last_click_map_y, mouse_map_y); + int end_map_x = std::max(last_click_map_x, mouse_map_x); + int end_map_y = std::max(last_click_map_y, mouse_map_y); - int map_x = start_map_x + (end_map_x - start_map_x)/2; - int map_y = start_map_y + (end_map_y - start_map_y)/2; + int map_x = start_map_x + (end_map_x - start_map_x) / 2; + int map_y = start_map_y + (end_map_y - start_map_y) / 2; - int width = std::min(g_settings.getInteger(Config::MAX_SPAWN_NPC_RADIUS), ((end_map_x - start_map_x)/2 + (end_map_y - start_map_y)/2)/2); + int width = std::min(g_settings.getInteger(Config::MAX_SPAWN_NPC_RADIUS), ((end_map_x - start_map_x) / 2 + (end_map_y - start_map_y) / 2) / 2); int old = g_gui.GetBrushSize(); g_gui.SetBrushSize(width); editor.draw(Position(map_x, map_y, floor), event.AltDown()); @@ -1255,39 +1253,42 @@ void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) } else { PositionVector tilestodraw; PositionVector tilestoborder; - if(brush->isWall()) { + if (brush->isWall()) { int start_map_x = std::min(last_click_map_x, mouse_map_x); int start_map_y = std::min(last_click_map_y, mouse_map_y); - int end_map_x = std::max(last_click_map_x, mouse_map_x); - int end_map_y = std::max(last_click_map_y, mouse_map_y); + int end_map_x = std::max(last_click_map_x, mouse_map_x); + int end_map_y = std::max(last_click_map_y, mouse_map_y); - for(int y = start_map_y-1; y <= end_map_y+1; y ++) { - for(int x = start_map_x-1; x <= end_map_x+1; x++) { - if((x <= start_map_x+1 || x >= end_map_x-1) || (y <= start_map_y+1 || y >= end_map_y-1)) { - tilestoborder.push_back(Position(x,y,floor)); + for (int y = start_map_y - 1; y <= end_map_y + 1; y++) { + for (int x = start_map_x - 1; x <= end_map_x + 1; x++) { + if ((x <= start_map_x + 1 || x >= end_map_x - 1) || (y <= start_map_y + 1 || y >= end_map_y - 1)) { + tilestoborder.push_back(Position(x, y, floor)); } - if(((x == start_map_x || x == end_map_x) || (y == start_map_y || y == end_map_y)) && - ((x >= start_map_x && x <= end_map_x) && (y >= start_map_y && y <= end_map_y))) { - tilestodraw.push_back(Position(x,y,floor)); + if (((x == start_map_x || x == end_map_x) || (y == start_map_y || y == end_map_y)) && ((x >= start_map_x && x <= end_map_x) && (y >= start_map_y && y <= end_map_y))) { + tilestodraw.push_back(Position(x, y, floor)); } } } } else { - if(g_gui.GetBrushShape() == BRUSHSHAPE_SQUARE) { - if(last_click_map_x > mouse_map_x) { - int tmp = mouse_map_x; mouse_map_x = last_click_map_x; last_click_map_x = tmp; + if (g_gui.GetBrushShape() == BRUSHSHAPE_SQUARE) { + if (last_click_map_x > mouse_map_x) { + int tmp = mouse_map_x; + mouse_map_x = last_click_map_x; + last_click_map_x = tmp; } - if(last_click_map_y > mouse_map_y) { - int tmp = mouse_map_y; mouse_map_y = last_click_map_y; last_click_map_y = tmp; + if (last_click_map_y > mouse_map_y) { + int tmp = mouse_map_y; + mouse_map_y = last_click_map_y; + last_click_map_y = tmp; } - for(int x = last_click_map_x-1; x <= mouse_map_x+1; x++) { - for(int y = last_click_map_y-1; y <= mouse_map_y+1; y ++) { - if((x <= last_click_map_x || x >= mouse_map_x) || (y <= last_click_map_y || y >= mouse_map_y)) { - tilestoborder.push_back(Position(x,y,floor)); + for (int x = last_click_map_x - 1; x <= mouse_map_x + 1; x++) { + for (int y = last_click_map_y - 1; y <= mouse_map_y + 1; y++) { + if ((x <= last_click_map_x || x >= mouse_map_x) || (y <= last_click_map_y || y >= mouse_map_y)) { + tilestoborder.push_back(Position(x, y, floor)); } - if((x >= last_click_map_x && x <= mouse_map_x) && (y >= last_click_map_y && y <= mouse_map_y)) { - tilestodraw.push_back(Position(x,y,floor)); + if ((x >= last_click_map_x && x <= mouse_map_x) && (y >= last_click_map_y && y <= mouse_map_y)) { + tilestodraw.push_back(Position(x, y, floor)); } } } @@ -1296,22 +1297,20 @@ void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) int start_y, end_y; int width = std::max( std::abs( - std::max(mouse_map_y, last_click_map_y) - - std::min(mouse_map_y, last_click_map_y) + std::max(mouse_map_y, last_click_map_y) - std::min(mouse_map_y, last_click_map_y) ), std::abs( - std::max(mouse_map_x, last_click_map_x) - - std::min(mouse_map_x, last_click_map_x) + std::max(mouse_map_x, last_click_map_x) - std::min(mouse_map_x, last_click_map_x) ) - ); - if(mouse_map_x < last_click_map_x) { + ); + if (mouse_map_x < last_click_map_x) { start_x = last_click_map_x - width; end_x = last_click_map_x; } else { start_x = last_click_map_x; end_x = last_click_map_x + width; } - if(mouse_map_y < last_click_map_y) { + if (mouse_map_y < last_click_map_y) { start_y = last_click_map_y - width; end_y = last_click_map_y; } else { @@ -1323,23 +1322,23 @@ void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) int center_y = start_y + (end_y - start_y) / 2; float radii = width / 2.0f + 0.005f; - for(int y = start_y-1; y <= end_y+1; y++) { + for (int y = start_y - 1; y <= end_y + 1; y++) { float dy = center_y - y; - for(int x = start_x-1; x <= end_x+1; x++) { + for (int x = start_x - 1; x <= end_x + 1; x++) { float dx = center_x - x; - //printf("%f;%f\n", dx, dy); - float distance = sqrt(dx*dx + dy*dy); - if(distance < radii) { - tilestodraw.push_back(Position(x,y,floor)); + // printf("%f;%f\n", dx, dy); + float distance = sqrt(dx * dx + dy * dy); + if (distance < radii) { + tilestodraw.push_back(Position(x, y, floor)); } - if(std::abs(distance - radii) < 1.5) { - tilestoborder.push_back(Position(x,y,floor)); + if (std::abs(distance - radii) < 1.5) { + tilestoborder.push_back(Position(x, y, floor)); } } } } } - if(event.ControlDown()) { + if (event.ControlDown()) { editor.undraw(tilestodraw, tilestoborder, event.AltDown()); } else { editor.draw(tilestodraw, tilestoborder, event.AltDown()); @@ -1357,14 +1356,13 @@ void MapCanvas::OnMouseActionRelease(wxMouseEvent& event) g_gui.UpdateMinimap(); } -void MapCanvas::OnMouseCameraClick(wxMouseEvent& event) -{ +void MapCanvas::OnMouseCameraClick(wxMouseEvent &event) { SetFocus(); last_mmb_click_x = event.GetX(); last_mmb_click_y = event.GetY(); - if(event.ControlDown()) { + if (event.ControlDown()) { int screensize_x, screensize_y; MapWindow* window = GetMapWindow(); window->GetViewSize(&screensize_x, &screensize_y); @@ -1379,74 +1377,71 @@ void MapCanvas::OnMouseCameraClick(wxMouseEvent& event) } } -void MapCanvas::OnMouseCameraRelease(wxMouseEvent& event) -{ +void MapCanvas::OnMouseCameraRelease(wxMouseEvent &event) { SetFocus(); screendragging = false; - if(event.ControlDown()) { + if (event.ControlDown()) { // ... // Haven't moved much, it's a click! - } else if(last_mmb_click_x > event.GetX() - 3 && last_mmb_click_x < event.GetX() + 3 && - last_mmb_click_y > event.GetY() - 3 && last_mmb_click_y < event.GetY() + 3) { + } else if (last_mmb_click_x > event.GetX() - 3 && last_mmb_click_x < event.GetX() + 3 && last_mmb_click_y > event.GetY() - 3 && last_mmb_click_y < event.GetY() + 3) { int screensize_x, screensize_y; MapWindow* window = GetMapWindow(); window->GetViewSize(&screensize_x, &screensize_y); window->ScrollRelative( - int(zoom * (2*cursor_x - screensize_x)), - int(zoom * (2*cursor_y - screensize_y)) + int(zoom * (2 * cursor_x - screensize_x)), + int(zoom * (2 * cursor_y - screensize_y)) ); Refresh(); } } -void MapCanvas::OnMousePropertiesClick(wxMouseEvent& event) -{ +void MapCanvas::OnMousePropertiesClick(wxMouseEvent &event) { SetFocus(); int mouse_map_x, mouse_map_y; ScreenToMap(event.GetX(), event.GetY(), &mouse_map_x, &mouse_map_y); Tile* tile = editor.getMap().getTile(mouse_map_x, mouse_map_y, floor); - if(g_gui.IsDrawingMode()) { + if (g_gui.IsDrawingMode()) { g_gui.SetSelectionMode(); } EndPasting(); - Selection& selection = editor.getSelection(); + Selection &selection = editor.getSelection(); boundbox_selection = false; - if(event.ShiftDown()) { + if (event.ShiftDown()) { boundbox_selection = true; - if(!event.ControlDown()) { + if (!event.ControlDown()) { selection.start(); // Start selection session selection.clear(); // Clear out selection selection.finish(); // End selection session selection.updateSelectionCount(); } - } else if(!tile) { + } else if (!tile) { selection.start(); // Start selection session selection.clear(); // Clear out selection selection.finish(); // End selection session selection.updateSelectionCount(); - } else if(tile->isSelected()) { + } else if (tile->isSelected()) { // Do nothing! } else { selection.start(); // Start a selection session selection.clear(); selection.commit(); - if(tile->spawnMonster && g_settings.getInteger(Config::SHOW_SPAWNS_MONSTER)) { + if (tile->spawnMonster && g_settings.getInteger(Config::SHOW_SPAWNS_MONSTER)) { selection.add(tile, tile->spawnMonster); - } else if(tile->monster && g_settings.getInteger(Config::SHOW_MONSTERS)) { + } else if (tile->monster && g_settings.getInteger(Config::SHOW_MONSTERS)) { selection.add(tile, tile->monster); - } else if(tile->npc && g_settings.getInteger(Config::SHOW_NPCS)) { + } else if (tile->npc && g_settings.getInteger(Config::SHOW_NPCS)) { selection.add(tile, tile->npc); - } else if(tile->spawnNpc && g_settings.getInteger(Config::SHOW_SPAWNS_NPC)) { + } else if (tile->spawnNpc && g_settings.getInteger(Config::SHOW_SPAWNS_NPC)) { selection.add(tile, tile->spawnNpc); } else { Item* item = tile->getTopItem(); - if(item) { + if (item) { selection.add(tile, item); } } @@ -1454,8 +1449,8 @@ void MapCanvas::OnMousePropertiesClick(wxMouseEvent& event) selection.updateSelectionCount(); } - last_click_x = int(event.GetX()*zoom); - last_click_y = int(event.GetY()*zoom); + last_click_x = int(event.GetX() * zoom); + last_click_y = int(event.GetY() * zoom); int start_x, start_y; GetMapWindow()->GetViewStart(&start_x, &start_y); @@ -1467,23 +1462,22 @@ void MapCanvas::OnMousePropertiesClick(wxMouseEvent& event) g_gui.RefreshView(); } -void MapCanvas::OnMousePropertiesRelease(wxMouseEvent& event) -{ +void MapCanvas::OnMousePropertiesRelease(wxMouseEvent &event) { int mouse_map_x, mouse_map_y; ScreenToMap(event.GetX(), event.GetY(), &mouse_map_x, &mouse_map_y); - if(g_gui.IsDrawingMode()) { + if (g_gui.IsDrawingMode()) { g_gui.SetSelectionMode(); } - if(boundbox_selection) { - Selection& selection = editor.getSelection(); - if(mouse_map_x == last_click_map_x && mouse_map_y == last_click_map_y && event.ControlDown()) { + if (boundbox_selection) { + Selection &selection = editor.getSelection(); + if (mouse_map_x == last_click_map_x && mouse_map_y == last_click_map_y && event.ControlDown()) { // Mouse hasn't move, do control+shift thingy! Tile* tile = editor.getMap().getTile(mouse_map_x, mouse_map_y, floor); - if(tile) { + if (tile) { selection.start(); // Start a selection session - if(tile->isSelected()) { + if (tile->isSelected()) { selection.remove(tile); } else { selection.add(tile); @@ -1493,20 +1487,26 @@ void MapCanvas::OnMousePropertiesRelease(wxMouseEvent& event) } } else { // The cursor has moved, do some boundboxing! - if(last_click_map_x > mouse_map_x) { - int tmp = mouse_map_x; mouse_map_x = last_click_map_x; last_click_map_x = tmp; + if (last_click_map_x > mouse_map_x) { + int tmp = mouse_map_x; + mouse_map_x = last_click_map_x; + last_click_map_x = tmp; } - if(last_click_map_y > mouse_map_y) { - int tmp = mouse_map_y; mouse_map_y = last_click_map_y; last_click_map_y = tmp; + if (last_click_map_y > mouse_map_y) { + int tmp = mouse_map_y; + mouse_map_y = last_click_map_y; + last_click_map_y = tmp; } selection.start(); // Start a selection session - switch(g_settings.getInteger(Config::SELECTION_TYPE)) { + switch (g_settings.getInteger(Config::SELECTION_TYPE)) { case SELECT_CURRENT_FLOOR: { - for(int x = last_click_map_x; x <= mouse_map_x; x++) { - for(int y = last_click_map_y; y <= mouse_map_y; y ++) { + for (int x = last_click_map_x; x <= mouse_map_x; x++) { + for (int y = last_click_map_y; y <= mouse_map_y; y++) { Tile* tile = editor.getMap().getTile(x, y, floor); - if(!tile) continue; + if (!tile) { + continue; + } selection.add(tile); } } @@ -1523,7 +1523,7 @@ void MapCanvas::OnMousePropertiesRelease(wxMouseEvent& event) end_y = mouse_map_y; end_z = floor; - if(g_settings.getInteger(Config::COMPENSATED_SELECT)) { + if (g_settings.getInteger(Config::COMPENSATED_SELECT)) { start_x -= (floor < rme::MapGroundLayer ? rme::MapGroundLayer - floor : 0); start_y -= (floor < rme::MapGroundLayer ? rme::MapGroundLayer - floor : 0); @@ -1531,17 +1531,21 @@ void MapCanvas::OnMousePropertiesRelease(wxMouseEvent& event) end_y -= (floor < rme::MapGroundLayer ? rme::MapGroundLayer - floor : 0); } - for(int z = start_z; z >= end_z; z--) { - for(int x = start_x; x <= end_x; x++) { - for(int y = start_y; y <= end_y; y++) { + for (int z = start_z; z >= end_z; z--) { + for (int x = start_x; x <= end_x; x++) { + for (int y = start_y; y <= end_y; y++) { Tile* tile = editor.getMap().getTile(x, y, z); - if(!tile) continue; + if (!tile) { + continue; + } selection.add(tile); } } - if(z <= rme::MapGroundLayer && g_settings.getInteger(Config::COMPENSATED_SELECT)) { - start_x++; start_y++; - end_x++; end_y++; + if (z <= rme::MapGroundLayer && g_settings.getInteger(Config::COMPENSATED_SELECT)) { + start_x++; + start_y++; + end_x++; + end_y++; } } break; @@ -1552,7 +1556,7 @@ void MapCanvas::OnMousePropertiesRelease(wxMouseEvent& event) start_x = last_click_map_x; start_y = last_click_map_y; - if(floor < 8) { + if (floor < 8) { start_z = rme::MapGroundLayer; } else { start_z = std::min(rme::MapMaxLayer, floor + 2); @@ -1561,7 +1565,7 @@ void MapCanvas::OnMousePropertiesRelease(wxMouseEvent& event) end_y = mouse_map_y; end_z = floor; - if(g_settings.getInteger(Config::COMPENSATED_SELECT)) { + if (g_settings.getInteger(Config::COMPENSATED_SELECT)) { start_x -= (floor < rme::MapGroundLayer ? rme::MapGroundLayer - floor : 0); start_y -= (floor < rme::MapGroundLayer ? rme::MapGroundLayer - floor : 0); @@ -1569,17 +1573,21 @@ void MapCanvas::OnMousePropertiesRelease(wxMouseEvent& event) end_y -= (floor < rme::MapGroundLayer ? rme::MapGroundLayer - floor : 0); } - for(int z = start_z; z >= end_z; z--) { - for(int x = start_x; x <= end_x; x++) { - for(int y = start_y; y <= end_y; y++) { + for (int z = start_z; z >= end_z; z--) { + for (int x = start_x; x <= end_x; x++) { + for (int y = start_y; y <= end_y; y++) { Tile* tile = editor.getMap().getTile(x, y, z); - if(!tile) continue; + if (!tile) { + continue; + } selection.add(tile); } } - if(z <= rme::MapGroundLayer && g_settings.getInteger(Config::COMPENSATED_SELECT)) { - start_x++; start_y++; - end_x++; end_y++; + if (z <= rme::MapGroundLayer && g_settings.getInteger(Config::COMPENSATED_SELECT)) { + start_x++; + start_y++; + end_x++; + end_y++; } } break; @@ -1588,7 +1596,7 @@ void MapCanvas::OnMousePropertiesRelease(wxMouseEvent& event) selection.finish(); // Finish the selection session selection.updateSelectionCount(); } - } else if(event.ControlDown()) { + } else if (event.ControlDown()) { // Nothing } @@ -1606,13 +1614,12 @@ void MapCanvas::OnMousePropertiesRelease(wxMouseEvent& event) g_gui.RefreshView(); } -void MapCanvas::OnWheel(wxMouseEvent& event) -{ - if(event.ControlDown()) { +void MapCanvas::OnWheel(wxMouseEvent &event) { + if (event.ControlDown()) { static double diff = 0.0; diff += event.GetWheelRotation(); - if(diff <= 1.0 || diff >= 1.0) { - if(diff < 0.0) { + if (diff <= 1.0 || diff >= 1.0) { + if (diff < 0.0) { g_gui.ChangeFloor(floor - 1); } else { g_gui.ChangeFloor(floor + 1); @@ -1620,11 +1627,11 @@ void MapCanvas::OnWheel(wxMouseEvent& event) diff = 0.0; } UpdatePositionStatus(); - } else if(event.AltDown()) { + } else if (event.AltDown()) { static double diff = 0.0; diff += event.GetWheelRotation(); - if(diff <= 1.0 || diff >= 1.0) { - if(diff < 0.0) { + if (diff <= 1.0 || diff >= 1.0) { + if (diff < 0.0) { g_gui.IncreaseBrushSize(); } else { g_gui.DecreaseBrushSize(); @@ -1636,11 +1643,11 @@ void MapCanvas::OnWheel(wxMouseEvent& event) double oldzoom = zoom; zoom += diff; - if(zoom < 0.125) { + if (zoom < 0.125) { diff = 0.125 - oldzoom; zoom = 0.125; } - if(zoom > 25.00) { + if (zoom > 25.00) { diff = 25.00 - oldzoom; zoom = 25.0; } @@ -1661,32 +1668,29 @@ void MapCanvas::OnWheel(wxMouseEvent& event) Refresh(); } -void MapCanvas::OnLoseMouse(wxMouseEvent& event) -{ +void MapCanvas::OnLoseMouse(wxMouseEvent &event) { Refresh(); } -void MapCanvas::OnGainMouse(wxMouseEvent& event) -{ - if(!event.LeftIsDown()) { +void MapCanvas::OnGainMouse(wxMouseEvent &event) { + if (!event.LeftIsDown()) { dragging = false; boundbox_selection = false; drawing = false; } - if(!event.MiddleIsDown()) { + if (!event.MiddleIsDown()) { screendragging = false; } Refresh(); } -void MapCanvas::OnKeyDown(wxKeyEvent& event) -{ +void MapCanvas::OnKeyDown(wxKeyEvent &event) { MapWindow* window = GetMapWindow(); - //char keycode = event.GetKeyCode(); - // std::cout << "Keycode " << keycode << std::endl; - switch(event.GetKeyCode()) { + // char keycode = event.GetKeyCode(); + // std::cout << "Keycode " << keycode << std::endl; + switch (event.GetKeyCode()) { case WXK_NUMPAD_ADD: case WXK_PAGEUP: { g_gui.ChangeFloor(floor - 1); @@ -1703,8 +1707,9 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) double oldzoom = zoom; zoom += diff; - if(zoom < 0.125) { - diff = 0.125 - oldzoom; zoom = 0.125; + if (zoom < 0.125) { + diff = 0.125 - oldzoom; + zoom = 0.125; } int screensize_x, screensize_y; @@ -1726,8 +1731,9 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) double oldzoom = zoom; zoom += diff; - if(zoom > 25.00) { - diff = 25.00 - oldzoom; zoom = 25.0; + if (zoom > 25.00) { + diff = 25.00 - oldzoom; + zoom = 25.0; } int screensize_x, screensize_y; @@ -1762,10 +1768,11 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) window->GetViewStart(&start_x, &start_y); int tiles = 3; - if(event.ControlDown()) + if (event.ControlDown()) { tiles = 10; - else if(zoom == 1.0) + } else if (zoom == 1.0) { tiles = 1; + } window->Scroll(start_x, int(start_y - rme::TileSize * tiles * zoom)); UpdatePositionStatus(); @@ -1778,10 +1785,11 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) window->GetViewStart(&start_x, &start_y); int tiles = 3; - if(event.ControlDown()) + if (event.ControlDown()) { tiles = 10; - else if(zoom == 1.0) + } else if (zoom == 1.0) { tiles = 1; + } window->Scroll(start_x, int(start_y + rme::TileSize * tiles * zoom)); UpdatePositionStatus(); @@ -1794,10 +1802,11 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) window->GetViewStart(&start_x, &start_y); int tiles = 3; - if(event.ControlDown()) + if (event.ControlDown()) { tiles = 10; - else if(zoom == 1.0) + } else if (zoom == 1.0) { tiles = 1; + } window->Scroll(int(start_x - rme::TileSize * tiles * zoom), start_y); UpdatePositionStatus(); @@ -1810,10 +1819,11 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) window->GetViewStart(&start_x, &start_y); int tiles = 3; - if(event.ControlDown()) + if (event.ControlDown()) { tiles = 10; - else if(zoom == 1.0) + } else if (zoom == 1.0) { tiles = 1; + } window->Scroll(int(start_x + rme::TileSize * tiles * zoom), start_y); UpdatePositionStatus(); @@ -1821,7 +1831,7 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) break; } case WXK_SPACE: { // Utility keys - if(event.ControlDown()) { + if (event.ControlDown()) { g_gui.FillDoodadPreviewBuffer(); g_gui.RefreshView(); } else { @@ -1830,7 +1840,7 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) break; } case WXK_TAB: { // Tab switch - if(event.ShiftDown()) { + if (event.ShiftDown()) { g_gui.CycleTab(false); } else { g_gui.CycleTab(true); @@ -1846,8 +1856,8 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) case 'Z': { // Rotate counterclockwise (actually shift variaton, but whatever... :P) int nv = g_gui.GetBrushVariation(); --nv; - if(nv < 0) { - nv = std::max(0, (g_gui.GetCurrentBrush()? g_gui.GetCurrentBrush()->getMaxVariation() - 1 : 0)); + if (nv < 0) { + nv = std::max(0, (g_gui.GetCurrentBrush() ? g_gui.GetCurrentBrush()->getMaxVariation() - 1 : 0)); } g_gui.SetBrushVariation(nv); g_gui.RefreshView(); @@ -1857,7 +1867,7 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) case 'X': { // Rotate clockwise (actually shift variaton, but whatever... :P) int nv = g_gui.GetBrushVariation(); ++nv; - if(nv >= (g_gui.GetCurrentBrush()? g_gui.GetCurrentBrush()->getMaxVariation() : 0)) { + if (nv >= (g_gui.GetCurrentBrush() ? g_gui.GetCurrentBrush()->getMaxVariation() : 0)) { nv = 0; } g_gui.SetBrushVariation(nv); @@ -1870,12 +1880,20 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) break; } // Hotkeys - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': { int index = event.GetKeyCode() - '0'; - if(event.ControlDown()) { + if (event.ControlDown()) { Hotkey hk; - if(g_gui.IsSelectionMode()) { + if (g_gui.IsSelectionMode()) { int view_start_x, view_start_y; window->GetViewStart(&view_start_x, &view_start_y); int view_start_map_x = view_start_x / rme::TileSize, view_start_map_y = view_start_y / rme::TileSize; @@ -1887,7 +1905,7 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) int map_y = int(view_start_map_y + (view_screensize_y * zoom) / rme::TileSize / 2); hk = Hotkey(Position(map_x, map_y, floor)); - } else if(g_gui.GetCurrentBrush()) { + } else if (g_gui.GetCurrentBrush()) { // Drawing mode hk = Hotkey(g_gui.GetCurrentBrush()); } else { @@ -1897,7 +1915,7 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) } else { // Click hotkey Hotkey hk = g_gui.GetHotkey(index); - if(hk.IsPosition()) { + if (hk.IsPosition()) { g_gui.SetSelectionMode(); int map_x = hk.GetPosition().x; @@ -1909,17 +1927,17 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) g_gui.SetStatusText("Used hotkey " + i2ws(index)); g_gui.RefreshView(); - } else if(hk.IsBrush()) { + } else if (hk.IsBrush()) { g_gui.SetDrawingMode(); std::string name = hk.GetBrushname(); Brush* brush = g_brushes.getBrush(name); - if(brush == nullptr) { + if (brush == nullptr) { g_gui.SetStatusText("Brush \"" + wxstr(name) + "\" not found"); return; } - if(!g_gui.SelectBrush(brush)) { + if (!g_gui.SelectBrush(brush)) { g_gui.SetStatusText("Brush \"" + wxstr(name) + "\" is not in any palette"); return; } @@ -1937,51 +1955,48 @@ void MapCanvas::OnKeyDown(wxKeyEvent& event) keyCode = WXK_CONTROL_D; break; } - default:{ + default: { event.Skip(); break; } } } -void MapCanvas::OnKeyUp(wxKeyEvent& event) -{ +void MapCanvas::OnKeyUp(wxKeyEvent &event) { keyCode = WXK_NONE; } -void MapCanvas::OnCopy(wxCommandEvent& WXUNUSED(event)) -{ - if(g_gui.IsSelectionMode()) - editor.copybuffer.copy(editor, GetFloor()); +void MapCanvas::OnCopy(wxCommandEvent &WXUNUSED(event)) { + if (g_gui.IsSelectionMode()) { + editor.copybuffer.copy(editor, GetFloor()); + } } -void MapCanvas::OnCut(wxCommandEvent& WXUNUSED(event)) -{ - if(g_gui.IsSelectionMode()) +void MapCanvas::OnCut(wxCommandEvent &WXUNUSED(event)) { + if (g_gui.IsSelectionMode()) { editor.copybuffer.cut(editor, GetFloor()); + } g_gui.RefreshView(); } -void MapCanvas::OnPaste(wxCommandEvent& WXUNUSED(event)) -{ +void MapCanvas::OnPaste(wxCommandEvent &WXUNUSED(event)) { g_gui.DoPaste(); g_gui.RefreshView(); } -void MapCanvas::OnDelete(wxCommandEvent& WXUNUSED(event)) -{ +void MapCanvas::OnDelete(wxCommandEvent &WXUNUSED(event)) { editor.destroySelection(); g_gui.RefreshView(); } -void MapCanvas::OnCopyPosition(wxCommandEvent& WXUNUSED(event)) -{ - if(!editor.hasSelection()) +void MapCanvas::OnCopyPosition(wxCommandEvent &WXUNUSED(event)) { + if (!editor.hasSelection()) { return; + } Position minPos = editor.getSelection().minPosition(); Position maxPos = editor.getSelection().maxPosition(); - if(minPos != maxPos) { + if (minPos != maxPos) { posToClipboard(minPos.x, minPos.y, minPos.z, maxPos.x, maxPos.y, maxPos.z); } else { int format = g_settings.getInteger(Config::COPY_POSITION_FORMAT); @@ -1989,11 +2004,10 @@ void MapCanvas::OnCopyPosition(wxCommandEvent& WXUNUSED(event)) } } -void MapCanvas::OnCopyServerId(wxCommandEvent& WXUNUSED(event)) -{ +void MapCanvas::OnCopyServerId(wxCommandEvent &WXUNUSED(event)) { ASSERT(editor.getSelection().size() == 1); - if(wxTheClipboard->Open()) { + if (wxTheClipboard->Open()) { Tile* tile = editor.getSelection().getSelectedTile(); ItemVector selected_items = tile->getSelectedItems(); ASSERT(selected_items.size() == 1); @@ -2008,11 +2022,10 @@ void MapCanvas::OnCopyServerId(wxCommandEvent& WXUNUSED(event)) } } -void MapCanvas::OnCopyClientId(wxCommandEvent& WXUNUSED(event)) -{ +void MapCanvas::OnCopyClientId(wxCommandEvent &WXUNUSED(event)) { ASSERT(editor.getSelection().size() == 1); - if(wxTheClipboard->Open()) { + if (wxTheClipboard->Open()) { Tile* tile = editor.getSelection().getSelectedTile(); ItemVector selected_items = tile->getSelectedItems(); ASSERT(selected_items.size() == 1); @@ -2027,11 +2040,10 @@ void MapCanvas::OnCopyClientId(wxCommandEvent& WXUNUSED(event)) } } -void MapCanvas::OnCopyName(wxCommandEvent& WXUNUSED(event)) -{ +void MapCanvas::OnCopyName(wxCommandEvent &WXUNUSED(event)) { ASSERT(editor.getSelection().size() == 1); - if(wxTheClipboard->Open()) { + if (wxTheClipboard->Open()) { Tile* tile = editor.getSelection().getSelectedTile(); ItemVector selected_items = tile->getSelectedItems(); ASSERT(selected_items.size() == 1); @@ -2046,20 +2058,22 @@ void MapCanvas::OnCopyName(wxCommandEvent& WXUNUSED(event)) } } -void MapCanvas::OnBrowseTile(wxCommandEvent& WXUNUSED(event)) -{ - if(editor.getSelection().size() != 1) +void MapCanvas::OnBrowseTile(wxCommandEvent &WXUNUSED(event)) { + if (editor.getSelection().size() != 1) { return; + } Tile* tile = editor.getSelection().getSelectedTile(); - if(!tile) return; + if (!tile) { + return; + } ASSERT(tile->isSelected()); Tile* new_tile = tile->deepCopy(editor.getMap()); wxDialog* w = new BrowseTileWindow(g_gui.root, new_tile, wxPoint(cursor_x, cursor_y)); int ret = w->ShowModal(); - if(ret != 0) { + if (ret != 0) { Action* action = editor.createAction(ACTION_DELETE_TILES); action->addChange(newd Change(new_tile)); editor.addAction(action); @@ -2072,25 +2086,24 @@ void MapCanvas::OnBrowseTile(wxCommandEvent& WXUNUSED(event)) w->Destroy(); } -void MapCanvas::OnRotateItem(wxCommandEvent& WXUNUSED(event)) -{ - if(!editor.hasSelection()) { +void MapCanvas::OnRotateItem(wxCommandEvent &WXUNUSED(event)) { + if (!editor.hasSelection()) { return; } - Selection& selection = editor.getSelection(); - if(selection.size() != 1) { + Selection &selection = editor.getSelection(); + if (selection.size() != 1) { return; } Tile* tile = selection.getSelectedTile(); ItemVector items = tile->getSelectedItems(); - if(items.empty()) { + if (items.empty()) { return; } Item* item = items.front(); - if(!item || !item->isRoteable()) { + if (!item || !item->isRoteable()) { return; } @@ -2100,39 +2113,36 @@ void MapCanvas::OnRotateItem(wxCommandEvent& WXUNUSED(event)) new_item->doRotate(); action->addChange(new Change(new_tile)); - editor.addAction(action); + editor.addAction(action); editor.updateActions(); g_gui.RefreshView(); } -void MapCanvas::OnGotoDestination(wxCommandEvent& WXUNUSED(event)) -{ +void MapCanvas::OnGotoDestination(wxCommandEvent &WXUNUSED(event)) { Tile* tile = editor.getSelection().getSelectedTile(); ItemVector selected_items = tile->getSelectedItems(); ASSERT(selected_items.size() > 0); Teleport* teleport = dynamic_cast(selected_items.front()); - if(teleport) { + if (teleport) { Position pos = teleport->getDestination(); g_gui.SetScreenCenterPosition(pos); } } -void MapCanvas::OnCopyDestination(wxCommandEvent& WXUNUSED(event)) -{ +void MapCanvas::OnCopyDestination(wxCommandEvent &WXUNUSED(event)) { Tile* tile = editor.getSelection().getSelectedTile(); ItemVector selected_items = tile->getSelectedItems(); ASSERT(selected_items.size() > 0); Teleport* teleport = dynamic_cast(selected_items.front()); if (teleport) { - const Position& destination = teleport->getDestination(); + const Position &destination = teleport->getDestination(); int format = g_settings.getInteger(Config::COPY_POSITION_FORMAT); posToClipboard(destination.x, destination.y, destination.z, format); } } -void MapCanvas::OnSwitchDoor(wxCommandEvent& WXUNUSED(event)) -{ +void MapCanvas::OnSwitchDoor(wxCommandEvent &WXUNUSED(event)) { Tile* tile = editor.getSelection().getSelectedTile(); Action* action = editor.createAction(ACTION_SWITCHDOOR); @@ -2151,175 +2161,206 @@ void MapCanvas::OnSwitchDoor(wxCommandEvent& WXUNUSED(event)) g_gui.RefreshView(); } -void MapCanvas::OnSelectRAWBrush(wxCommandEvent& WXUNUSED(event)) -{ - if(editor.getSelection().size() != 1) return; +void MapCanvas::OnSelectRAWBrush(wxCommandEvent &WXUNUSED(event)) { + if (editor.getSelection().size() != 1) { + return; + } Tile* tile = editor.getSelection().getSelectedTile(); - if(!tile) return; + if (!tile) { + return; + } Item* item = tile->getTopSelectedItem(); - if(item && item->getRAWBrush()) + if (item && item->getRAWBrush()) { g_gui.SelectBrush(item->getRAWBrush(), TILESET_RAW); + } } -void MapCanvas::OnSelectGroundBrush(wxCommandEvent& WXUNUSED(event)) -{ - if(editor.getSelection().size() != 1) return; +void MapCanvas::OnSelectGroundBrush(wxCommandEvent &WXUNUSED(event)) { + if (editor.getSelection().size() != 1) { + return; + } Tile* tile = editor.getSelection().getSelectedTile(); - if(!tile) return; + if (!tile) { + return; + } GroundBrush* bb = tile->getGroundBrush(); - if(bb) + if (bb) { g_gui.SelectBrush(bb, TILESET_TERRAIN); + } } -void MapCanvas::OnSelectDoodadBrush(wxCommandEvent& WXUNUSED(event)) -{ - if(editor.getSelection().size() != 1) return; +void MapCanvas::OnSelectDoodadBrush(wxCommandEvent &WXUNUSED(event)) { + if (editor.getSelection().size() != 1) { + return; + } Tile* tile = editor.getSelection().getSelectedTile(); - if(!tile) return; + if (!tile) { + return; + } Item* item = tile->getTopSelectedItem(); - if(item) + if (item) { g_gui.SelectBrush(item->getDoodadBrush(), TILESET_DOODAD); + } } -void MapCanvas::OnSelectDoorBrush(wxCommandEvent& WXUNUSED(event)) -{ - if(editor.getSelection().size() != 1) return; +void MapCanvas::OnSelectDoorBrush(wxCommandEvent &WXUNUSED(event)) { + if (editor.getSelection().size() != 1) { + return; + } Tile* tile = editor.getSelection().getSelectedTile(); - if(!tile) return; + if (!tile) { + return; + } Item* item = tile->getTopSelectedItem(); - if(item) + if (item) { g_gui.SelectBrush(item->getDoorBrush(), TILESET_TERRAIN); + } } -void MapCanvas::OnSelectWallBrush(wxCommandEvent& WXUNUSED(event)) -{ - if(editor.getSelection().size() != 1) return; +void MapCanvas::OnSelectWallBrush(wxCommandEvent &WXUNUSED(event)) { + if (editor.getSelection().size() != 1) { + return; + } Tile* tile = editor.getSelection().getSelectedTile(); - if(!tile) return; + if (!tile) { + return; + } Item* wall = tile->getWall(); WallBrush* wb = wall->getWallBrush(); - if(wb) + if (wb) { g_gui.SelectBrush(wb, TILESET_TERRAIN); + } } -void MapCanvas::OnSelectCarpetBrush(wxCommandEvent& WXUNUSED(event)) -{ - if(editor.getSelection().size() != 1) return; +void MapCanvas::OnSelectCarpetBrush(wxCommandEvent &WXUNUSED(event)) { + if (editor.getSelection().size() != 1) { + return; + } Tile* tile = editor.getSelection().getSelectedTile(); - if(!tile) return; + if (!tile) { + return; + } Item* wall = tile->getCarpet(); CarpetBrush* cb = wall->getCarpetBrush(); - if(cb) + if (cb) { g_gui.SelectBrush(cb); + } } -void MapCanvas::OnSelectTableBrush(wxCommandEvent& WXUNUSED(event)) -{ - if(editor.getSelection().size() != 1) return; +void MapCanvas::OnSelectTableBrush(wxCommandEvent &WXUNUSED(event)) { + if (editor.getSelection().size() != 1) { + return; + } Tile* tile = editor.getSelection().getSelectedTile(); - if(!tile) return; + if (!tile) { + return; + } Item* wall = tile->getTable(); TableBrush* tb = wall->getTableBrush(); - if(tb) + if (tb) { g_gui.SelectBrush(tb); + } } -void MapCanvas::OnSelectHouseBrush(wxCommandEvent& WXUNUSED(event)) -{ +void MapCanvas::OnSelectHouseBrush(wxCommandEvent &WXUNUSED(event)) { Tile* tile = editor.getSelection().getSelectedTile(); - if(!tile) + if (!tile) { return; + } - if(tile->isHouseTile()) { + if (tile->isHouseTile()) { House* house = editor.getMap().houses.getHouse(tile->getHouseID()); - if(house) { + if (house) { g_gui.house_brush->setHouse(house); g_gui.SelectBrush(g_gui.house_brush, TILESET_HOUSE); } } } -void MapCanvas::OnSelectMonsterBrush(wxCommandEvent& WXUNUSED(event)) -{ +void MapCanvas::OnSelectMonsterBrush(wxCommandEvent &WXUNUSED(event)) { Tile* tile = editor.getSelection().getSelectedTile(); - if(!tile) + if (!tile) { return; + } - if(tile->monster) + if (tile->monster) { g_gui.SelectBrush(tile->monster->getBrush(), TILESET_MONSTER); + } } -void MapCanvas::OnSelectSpawnBrush(wxCommandEvent& WXUNUSED(event)) -{ +void MapCanvas::OnSelectSpawnBrush(wxCommandEvent &WXUNUSED(event)) { g_gui.SelectBrush(g_gui.spawn_brush, TILESET_MONSTER); } -void MapCanvas::OnSelectNpcBrush(wxCommandEvent& WXUNUSED(event)) -{ +void MapCanvas::OnSelectNpcBrush(wxCommandEvent &WXUNUSED(event)) { Tile* tile = editor.getSelection().getSelectedTile(); - if(!tile) + if (!tile) { return; + } - if(tile->npc) + if (tile->npc) { g_gui.SelectBrush(tile->npc->getBrush(), TILESET_NPC); + } } -void MapCanvas::OnSelectSpawnNpcBrush(wxCommandEvent& WXUNUSED(event)) -{ +void MapCanvas::OnSelectSpawnNpcBrush(wxCommandEvent &WXUNUSED(event)) { g_gui.SelectBrush(g_gui.spawn_npc_brush, TILESET_NPC); } -void MapCanvas::OnProperties(wxCommandEvent& WXUNUSED(event)) -{ - if(editor.getSelection().size() != 1) +void MapCanvas::OnProperties(wxCommandEvent &WXUNUSED(event)) { + if (editor.getSelection().size() != 1) { return; + } Tile* tile = editor.getSelection().getSelectedTile(); - if(!tile) return; + if (!tile) { + return; + } ASSERT(tile->isSelected()); Tile* new_tile = tile->deepCopy(editor.getMap()); wxDialog* w = nullptr; - if(new_tile->spawnMonster && g_settings.getInteger(Config::SHOW_SPAWNS_MONSTER)) + if (new_tile->spawnMonster && g_settings.getInteger(Config::SHOW_SPAWNS_MONSTER)) { w = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, new_tile->spawnMonster); - else if(new_tile->monster && g_settings.getInteger(Config::SHOW_MONSTERS)) + } else if (new_tile->monster && g_settings.getInteger(Config::SHOW_MONSTERS)) { w = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, new_tile->monster); - else if(new_tile->npc && g_settings.getInteger(Config::SHOW_NPCS)) + } else if (new_tile->npc && g_settings.getInteger(Config::SHOW_NPCS)) { w = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, new_tile->npc); - else if(new_tile->spawnNpc && g_settings.getInteger(Config::SHOW_SPAWNS_NPC)) + } else if (new_tile->spawnNpc && g_settings.getInteger(Config::SHOW_SPAWNS_NPC)) { w = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, new_tile->spawnNpc); - else { + } else { ItemVector selected_items = new_tile->getSelectedItems(); Item* item = nullptr; int count = 0; - for(ItemVector::iterator it = selected_items.begin(); it != selected_items.end(); ++it) { + for (ItemVector::iterator it = selected_items.begin(); it != selected_items.end(); ++it) { ++count; - if((*it)->isSelected()) { + if ((*it)->isSelected()) { item = *it; } } - if(item) { - if(editor.getMap().getVersion().otbm >= MAP_OTBM_4) + if (item) { + if (editor.getMap().getVersion().otbm >= MAP_OTBM_4) { w = newd PropertiesWindow(g_gui.root, &editor.getMap(), new_tile, item); - else + } else { w = newd OldPropertiesWindow(g_gui.root, &editor.getMap(), new_tile, item); - } - else + } + } else { return; + } } int ret = w->ShowModal(); - if(ret != 0) { + if (ret != 0) { Action* action = editor.createAction(ACTION_CHANGE_PROPERTIES); action->addChange(newd Change(new_tile)); editor.addAction(action); @@ -2330,12 +2371,11 @@ void MapCanvas::OnProperties(wxCommandEvent& WXUNUSED(event)) w->Destroy(); } -void MapCanvas::ChangeFloor(int new_floor) -{ +void MapCanvas::ChangeFloor(int new_floor) { ASSERT(new_floor >= 0 || new_floor <= rme::MapMaxLayer); int old_floor = floor; floor = new_floor; - if(old_floor != new_floor) { + if (old_floor != new_floor) { UpdatePositionStatus(); g_gui.root->UpdateFloorMenu(); g_gui.UpdateMinimap(true); @@ -2343,16 +2383,14 @@ void MapCanvas::ChangeFloor(int new_floor) Refresh(); } -void MapCanvas::EnterDrawingMode() -{ +void MapCanvas::EnterDrawingMode() { dragging = false; boundbox_selection = false; EndPasting(); Refresh(); } -void MapCanvas::EnterSelectionMode() -{ +void MapCanvas::EnterSelectionMode() { drawing = false; dragging_draw = false; replace_dragging = false; @@ -2360,23 +2398,19 @@ void MapCanvas::EnterSelectionMode() Refresh(); } -bool MapCanvas::isPasting() const -{ +bool MapCanvas::isPasting() const { return g_gui.IsPasting(); } -void MapCanvas::StartPasting() -{ +void MapCanvas::StartPasting() { g_gui.StartPasting(); } -void MapCanvas::EndPasting() -{ +void MapCanvas::EndPasting() { g_gui.EndPasting(); } -void MapCanvas::Reset() -{ +void MapCanvas::Reset() { cursor_x = 0; cursor_y = 0; @@ -2407,20 +2441,18 @@ void MapCanvas::Reset() editor.clearActions(); } -MapPopupMenu::MapPopupMenu(Editor& editor) : wxMenu(""), editor(editor) -{ +MapPopupMenu::MapPopupMenu(Editor &editor) : + wxMenu(""), editor(editor) { //// } -MapPopupMenu::~MapPopupMenu() -{ +MapPopupMenu::~MapPopupMenu() { //// } -void MapPopupMenu::Update() -{ +void MapPopupMenu::Update() { // Clear the menu of all items - while(GetMenuItemCount() != 0) { + while (GetMenuItemCount() != 0) { wxMenuItem* m_item = FindItemByPosition(0); // If you add a submenu, this won't delete it. Delete(m_item); @@ -2428,23 +2460,23 @@ void MapPopupMenu::Update() bool anything_selected = editor.hasSelection(); - wxMenuItem* cutItem = Append( MAP_POPUP_MENU_CUT, "&Cut\tCTRL+X", "Cut out all selected items"); + wxMenuItem* cutItem = Append(MAP_POPUP_MENU_CUT, "&Cut\tCTRL+X", "Cut out all selected items"); cutItem->Enable(anything_selected); - wxMenuItem* copyItem = Append( MAP_POPUP_MENU_COPY, "&Copy\tCTRL+C", "Copy all selected items"); + wxMenuItem* copyItem = Append(MAP_POPUP_MENU_COPY, "&Copy\tCTRL+C", "Copy all selected items"); copyItem->Enable(anything_selected); - wxMenuItem* copyPositionItem = Append( MAP_POPUP_MENU_COPY_POSITION, "&Copy Position", "Copy the position as a lua table"); + wxMenuItem* copyPositionItem = Append(MAP_POPUP_MENU_COPY_POSITION, "&Copy Position", "Copy the position as a lua table"); copyPositionItem->Enable(anything_selected); - wxMenuItem* pasteItem = Append( MAP_POPUP_MENU_PASTE, "&Paste\tCTRL+V", "Paste items in the copybuffer here"); + wxMenuItem* pasteItem = Append(MAP_POPUP_MENU_PASTE, "&Paste\tCTRL+V", "Paste items in the copybuffer here"); pasteItem->Enable(editor.copybuffer.canPaste()); - wxMenuItem* deleteItem = Append( MAP_POPUP_MENU_DELETE, "&Delete\tDEL", "Removes all seleceted items"); + wxMenuItem* deleteItem = Append(MAP_POPUP_MENU_DELETE, "&Delete\tDEL", "Removes all seleceted items"); deleteItem->Enable(anything_selected); - if(anything_selected) { - if(editor.getSelection().size() == 1) { + if (anything_selected) { + if (editor.getSelection().size() == 1) { Tile* tile = editor.getSelection().getSelectedTile(); ItemVector selected_items = tile->getSelectedItems(); @@ -2458,44 +2490,51 @@ void MapPopupMenu::Update() Npc* topNpc = tile->npc; SpawnNpc* topSpawnNpc = tile->spawnNpc; - for (auto *item : tile->items) { - if(item->isWall()) { + for (auto* item : tile->items) { + if (item->isWall()) { Brush* wb = item->getWallBrush(); - if(wb && wb->visibleInPalette()) hasWall = true; + if (wb && wb->visibleInPalette()) { + hasWall = true; + } } - if(item->isTable()) { + if (item->isTable()) { Brush* tb = item->getTableBrush(); - if(tb && tb->visibleInPalette()) hasTable = true; + if (tb && tb->visibleInPalette()) { + hasTable = true; + } } - if(item->isCarpet()) { + if (item->isCarpet()) { Brush* cb = item->getCarpetBrush(); - if(cb && cb->visibleInPalette()) hasCarpet = true; + if (cb && cb->visibleInPalette()) { + hasCarpet = true; + } } - if(item->isSelected()) { + if (item->isSelected()) { topItem = item; } } - if(!topItem) { + if (!topItem) { topItem = tile->ground; } AppendSeparator(); - if(topSelectedItem) { + if (topSelectedItem) { Append(MAP_POPUP_MENU_COPY_SERVER_ID, "Copy Item Server Id", "Copy the server id of this item"); Append(MAP_POPUP_MENU_COPY_CLIENT_ID, "Copy Item Client Id", "Copy the client id of this item"); Append(MAP_POPUP_MENU_COPY_NAME, "Copy Item Name", "Copy the name of this item"); AppendSeparator(); } - if(topSelectedItem || topMonster || topNpc || topItem) { + if (topSelectedItem || topMonster || topNpc || topItem) { Teleport* teleport = dynamic_cast(topSelectedItem); - if(topSelectedItem && (topSelectedItem->isBrushDoor() || topSelectedItem->isRoteable() || teleport)) { + if (topSelectedItem && (topSelectedItem->isBrushDoor() || topSelectedItem->isRoteable() || teleport)) { - if(topSelectedItem->isRoteable()) + if (topSelectedItem->isRoteable()) { Append(MAP_POPUP_MENU_ROTATE, "&Rotate item", "Rotate this item"); + } - if(teleport) { + if (teleport) { bool enabled = teleport->hasDestination(); wxMenuItem* goto_menu = Append(MAP_POPUP_MENU_GOTO, "&Go To Destination", "Go to the destination of this teleport"); goto_menu->Enable(enabled); @@ -2504,8 +2543,7 @@ void MapPopupMenu::Update() AppendSeparator(); } - if(topSelectedItem->isDoor()) - { + if (topSelectedItem->isDoor()) { if (topSelectedItem->isOpen()) { Append(MAP_POPUP_MENU_SWITCH_DOOR, "&Close door", "Close this door"); } else { @@ -2515,72 +2553,87 @@ void MapPopupMenu::Update() } } - if(topMonster) - Append( MAP_POPUP_MENU_SELECT_MONSTER_BRUSH, "Select Monster", "Uses the current monster as a monster brush"); + if (topMonster) { + Append(MAP_POPUP_MENU_SELECT_MONSTER_BRUSH, "Select Monster", "Uses the current monster as a monster brush"); + } - if(topSpawnMonster) - Append( MAP_POPUP_MENU_SELECT_SPAWN_BRUSH, "Select Monster Spawn", "Select the npc brush"); + if (topSpawnMonster) { + Append(MAP_POPUP_MENU_SELECT_SPAWN_BRUSH, "Select Monster Spawn", "Select the npc brush"); + } - if(topNpc) - Append( MAP_POPUP_MENU_SELECT_NPC_BRUSH, "Select Npc", "Uses the current npc as a npc brush"); + if (topNpc) { + Append(MAP_POPUP_MENU_SELECT_NPC_BRUSH, "Select Npc", "Uses the current npc as a npc brush"); + } - if(topSpawnNpc) - Append( MAP_POPUP_MENU_SELECT_SPAWN_NPC_BRUSH, "Select Npc Spawn", "Select the npc brush"); + if (topSpawnNpc) { + Append(MAP_POPUP_MENU_SELECT_SPAWN_NPC_BRUSH, "Select Npc Spawn", "Select the npc brush"); + } - Append( MAP_POPUP_MENU_SELECT_RAW_BRUSH, "Select RAW", "Uses the top item as a RAW brush"); + Append(MAP_POPUP_MENU_SELECT_RAW_BRUSH, "Select RAW", "Uses the top item as a RAW brush"); - if(hasWall) - Append( MAP_POPUP_MENU_SELECT_WALL_BRUSH, "Select Wallbrush", "Uses the current item as a wallbrush"); + if (hasWall) { + Append(MAP_POPUP_MENU_SELECT_WALL_BRUSH, "Select Wallbrush", "Uses the current item as a wallbrush"); + } - if(hasCarpet) - Append( MAP_POPUP_MENU_SELECT_CARPET_BRUSH, "Select Carpetbrush", "Uses the current item as a carpetbrush"); + if (hasCarpet) { + Append(MAP_POPUP_MENU_SELECT_CARPET_BRUSH, "Select Carpetbrush", "Uses the current item as a carpetbrush"); + } - if(hasTable) - Append( MAP_POPUP_MENU_SELECT_TABLE_BRUSH, "Select Tablebrush", "Uses the current item as a tablebrush"); + if (hasTable) { + Append(MAP_POPUP_MENU_SELECT_TABLE_BRUSH, "Select Tablebrush", "Uses the current item as a tablebrush"); + } - if(topSelectedItem && topSelectedItem->getDoodadBrush() && topSelectedItem->getDoodadBrush()->visibleInPalette()) - Append( MAP_POPUP_MENU_SELECT_DOODAD_BRUSH, "Select Doodadbrush", "Use this doodad brush"); + if (topSelectedItem && topSelectedItem->getDoodadBrush() && topSelectedItem->getDoodadBrush()->visibleInPalette()) { + Append(MAP_POPUP_MENU_SELECT_DOODAD_BRUSH, "Select Doodadbrush", "Use this doodad brush"); + } - if(topSelectedItem && topSelectedItem->isBrushDoor() && topSelectedItem->getDoorBrush()) - Append( MAP_POPUP_MENU_SELECT_DOOR_BRUSH, "Select Doorbrush", "Use this door brush"); + if (topSelectedItem && topSelectedItem->isBrushDoor() && topSelectedItem->getDoorBrush()) { + Append(MAP_POPUP_MENU_SELECT_DOOR_BRUSH, "Select Doorbrush", "Use this door brush"); + } - if(tile->hasGround() && tile->getGroundBrush() && tile->getGroundBrush()->visibleInPalette()) - Append( MAP_POPUP_MENU_SELECT_GROUND_BRUSH, "Select Groundbrush", "Uses the current item as a groundbrush"); + if (tile->hasGround() && tile->getGroundBrush() && tile->getGroundBrush()->visibleInPalette()) { + Append(MAP_POPUP_MENU_SELECT_GROUND_BRUSH, "Select Groundbrush", "Uses the current item as a groundbrush"); + } - if(tile->isHouseTile()) + if (tile->isHouseTile()) { Append(MAP_POPUP_MENU_SELECT_HOUSE_BRUSH, "Select House", "Draw with the house on this tile."); + } AppendSeparator(); - Append( MAP_POPUP_MENU_PROPERTIES, "&Properties", "Properties for the current object"); + Append(MAP_POPUP_MENU_PROPERTIES, "&Properties", "Properties for the current object"); } else { - if(topMonster) - Append( MAP_POPUP_MENU_SELECT_MONSTER_BRUSH, "Select Monster", "Uses the current monster as a monster brush"); + if (topMonster) { + Append(MAP_POPUP_MENU_SELECT_MONSTER_BRUSH, "Select Monster", "Uses the current monster as a monster brush"); + } - if(topSpawnMonster) - Append( MAP_POPUP_MENU_SELECT_SPAWN_BRUSH, "Select Monster", "Select the monster brush"); + if (topSpawnMonster) { + Append(MAP_POPUP_MENU_SELECT_SPAWN_BRUSH, "Select Monster", "Select the monster brush"); + } - if(topNpc) - Append( MAP_POPUP_MENU_SELECT_NPC_BRUSH, "Select Npc", "Uses the current npc as a npc brush"); + if (topNpc) { + Append(MAP_POPUP_MENU_SELECT_NPC_BRUSH, "Select Npc", "Uses the current npc as a npc brush"); + } - if(topSpawnNpc) - Append( MAP_POPUP_MENU_SELECT_SPAWN_NPC_BRUSH, "Select Npc", "Select the npc brush"); + if (topSpawnNpc) { + Append(MAP_POPUP_MENU_SELECT_SPAWN_NPC_BRUSH, "Select Npc", "Select the npc brush"); + } - Append( MAP_POPUP_MENU_SELECT_RAW_BRUSH, "Select RAW", "Uses the top item as a RAW brush"); - if(hasWall) { - Append( MAP_POPUP_MENU_SELECT_WALL_BRUSH, "Select Wallbrush", "Uses the current item as a wallbrush"); + Append(MAP_POPUP_MENU_SELECT_RAW_BRUSH, "Select RAW", "Uses the top item as a RAW brush"); + if (hasWall) { + Append(MAP_POPUP_MENU_SELECT_WALL_BRUSH, "Select Wallbrush", "Uses the current item as a wallbrush"); } - if(tile->hasGround() && tile->getGroundBrush() && tile->getGroundBrush()->visibleInPalette()) { - Append( MAP_POPUP_MENU_SELECT_GROUND_BRUSH, "Select Groundbrush", "Uses the current tile as a groundbrush"); + if (tile->hasGround() && tile->getGroundBrush() && tile->getGroundBrush()->visibleInPalette()) { + Append(MAP_POPUP_MENU_SELECT_GROUND_BRUSH, "Select Groundbrush", "Uses the current tile as a groundbrush"); } - if(tile->isHouseTile()) { + if (tile->isHouseTile()) { Append(MAP_POPUP_MENU_SELECT_HOUSE_BRUSH, "Select House", "Draw with the house on this tile."); } - if(tile->hasGround() || topMonster || topSpawnMonster || topNpc|| topSpawnNpc) { + if (tile->hasGround() || topMonster || topSpawnMonster || topNpc || topSpawnNpc) { AppendSeparator(); - Append( MAP_POPUP_MENU_PROPERTIES, "&Properties", "Properties for the current object"); + Append(MAP_POPUP_MENU_PROPERTIES, "&Properties", "Properties for the current object"); } } @@ -2592,11 +2645,10 @@ void MapPopupMenu::Update() } } -void MapCanvas::getTilesToDraw(int mouse_map_x, int mouse_map_y, int floor, PositionVector* tilestodraw, PositionVector* tilestoborder, bool fill /*= false*/) -{ - if(fill) { +void MapCanvas::getTilesToDraw(int mouse_map_x, int mouse_map_y, int floor, PositionVector* tilestodraw, PositionVector* tilestoborder, bool fill /*= false*/) { + if (fill) { Brush* brush = g_gui.GetCurrentBrush(); - if(!brush || !brush->isGround()) { + if (!brush || !brush->isGround()) { return; } @@ -2605,49 +2657,53 @@ void MapCanvas::getTilesToDraw(int mouse_map_x, int mouse_map_y, int floor, Posi Tile* tile = editor.getMap().getTile(position); GroundBrush* oldBrush = nullptr; - if(tile) { + if (tile) { oldBrush = tile->getGroundBrush(); } - if(oldBrush && oldBrush->getID() == newBrush->getID()) { + if (oldBrush && oldBrush->getID() == newBrush->getID()) { return; } - if((tile && tile->ground && !oldBrush) || (!tile && oldBrush)) { + if ((tile && tile->ground && !oldBrush) || (!tile && oldBrush)) { return; } - if(tile && oldBrush) { + if (tile && oldBrush) { GroundBrush* groundBrush = tile->getGroundBrush(); - if(!groundBrush || groundBrush->getID() != oldBrush->getID()) { + if (!groundBrush || groundBrush->getID() != oldBrush->getID()) { return; } } std::fill(std::begin(processed), std::end(processed), false); - floodFill(&editor.getMap(), position, BLOCK_SIZE/2, BLOCK_SIZE/2, oldBrush, tilestodraw); + floodFill(&editor.getMap(), position, BLOCK_SIZE / 2, BLOCK_SIZE / 2, oldBrush, tilestodraw); } else { - for(int y = -g_gui.GetBrushSize() - 1; y <= g_gui.GetBrushSize() + 1; y++) { - for(int x = -g_gui.GetBrushSize() - 1; x <= g_gui.GetBrushSize() + 1; x++) { - if(g_gui.GetBrushShape() == BRUSHSHAPE_SQUARE) { - if(x >= -g_gui.GetBrushSize() && x <= g_gui.GetBrushSize() && y >= -g_gui.GetBrushSize() && y <= g_gui.GetBrushSize()) { - if(tilestodraw) + for (int y = -g_gui.GetBrushSize() - 1; y <= g_gui.GetBrushSize() + 1; y++) { + for (int x = -g_gui.GetBrushSize() - 1; x <= g_gui.GetBrushSize() + 1; x++) { + if (g_gui.GetBrushShape() == BRUSHSHAPE_SQUARE) { + if (x >= -g_gui.GetBrushSize() && x <= g_gui.GetBrushSize() && y >= -g_gui.GetBrushSize() && y <= g_gui.GetBrushSize()) { + if (tilestodraw) { tilestodraw->push_back(Position(mouse_map_x + x, mouse_map_y + y, floor)); + } } - if(std::abs(x) - g_gui.GetBrushSize() < 2 && std::abs(y) - g_gui.GetBrushSize() < 2) { - if(tilestoborder) + if (std::abs(x) - g_gui.GetBrushSize() < 2 && std::abs(y) - g_gui.GetBrushSize() < 2) { + if (tilestoborder) { tilestoborder->push_back(Position(mouse_map_x + x, mouse_map_y + y, floor)); + } } - } else if(g_gui.GetBrushShape() == BRUSHSHAPE_CIRCLE) { - double distance = sqrt(double(x*x) + double(y*y)); - if(distance < g_gui.GetBrushSize() + 0.005) { - if(tilestodraw) + } else if (g_gui.GetBrushShape() == BRUSHSHAPE_CIRCLE) { + double distance = sqrt(double(x * x) + double(y * y)); + if (distance < g_gui.GetBrushSize() + 0.005) { + if (tilestodraw) { tilestodraw->push_back(Position(mouse_map_x + x, mouse_map_y + y, floor)); + } } - if(std::abs(distance - g_gui.GetBrushSize()) < 1.5) { - if(tilestoborder) + if (std::abs(distance - g_gui.GetBrushSize()) < 1.5) { + if (tilestoborder) { tilestoborder->push_back(Position(mouse_map_x + x, mouse_map_y + y, floor)); + } } } } @@ -2655,28 +2711,27 @@ void MapCanvas::getTilesToDraw(int mouse_map_x, int mouse_map_y, int floor, Posi } } -bool MapCanvas::floodFill(Map *map, const Position& center, int x, int y, GroundBrush* brush, PositionVector* positions) -{ - if(x < 0 || y < 0 || x > BLOCK_SIZE || y > BLOCK_SIZE) { +bool MapCanvas::floodFill(Map* map, const Position ¢er, int x, int y, GroundBrush* brush, PositionVector* positions) { + if (x < 0 || y < 0 || x > BLOCK_SIZE || y > BLOCK_SIZE) { return false; } processed[getFillIndex(x, y)] = true; - int px = (center.x + x) - (BLOCK_SIZE/2); - int py = (center.y + y) - (BLOCK_SIZE/2); - if(px <= 0 || py <= 0 || px >= map->getWidth() || py >= map->getHeight()) { + int px = (center.x + x) - (BLOCK_SIZE / 2); + int py = (center.y + y) - (BLOCK_SIZE / 2); + if (px <= 0 || py <= 0 || px >= map->getWidth() || py >= map->getHeight()) { return false; } Tile* tile = map->getTile(px, py, center.z); - if((tile && tile->ground && !brush) || (!tile && brush)) { + if ((tile && tile->ground && !brush) || (!tile && brush)) { return false; } - if(tile && brush) { + if (tile && brush) { GroundBrush* groundBrush = tile->getGroundBrush(); - if(!groundBrush || groundBrush->getID() != brush->getID()) { + if (!groundBrush || groundBrush->getID() != brush->getID()) { return false; } } @@ -2684,20 +2739,20 @@ bool MapCanvas::floodFill(Map *map, const Position& center, int x, int y, Ground positions->push_back(Position(px, py, center.z)); bool deny = false; - if(!processed[getFillIndex(x-1, y)]) { - deny = floodFill(map, center, x-1, y, brush, positions); + if (!processed[getFillIndex(x - 1, y)]) { + deny = floodFill(map, center, x - 1, y, brush, positions); } - if(!deny && !processed[getFillIndex(x, y-1)]) { - deny = floodFill(map, center, x, y-1, brush, positions); + if (!deny && !processed[getFillIndex(x, y - 1)]) { + deny = floodFill(map, center, x, y - 1, brush, positions); } - if(!deny && !processed[getFillIndex(x+1, y)]) { - deny = floodFill(map, center, x+1, y, brush, positions); + if (!deny && !processed[getFillIndex(x + 1, y)]) { + deny = floodFill(map, center, x + 1, y, brush, positions); } - if(!deny && !processed[getFillIndex(x, y+1)]) { - deny = floodFill(map, center, x, y+1, brush, positions); + if (!deny && !processed[getFillIndex(x, y + 1)]) { + deny = floodFill(map, center, x, y + 1, brush, positions); } return deny; @@ -2706,30 +2761,28 @@ bool MapCanvas::floodFill(Map *map, const Position& center, int x, int y, Ground // ============================================================================ // AnimationTimer -AnimationTimer::AnimationTimer(MapCanvas *canvas) : wxTimer(), +AnimationTimer::AnimationTimer(MapCanvas* canvas) : + wxTimer(), map_canvas(canvas), - started(false) -{ - //// -}; + started(false) { + //// + }; -void AnimationTimer::Notify() -{ - if(map_canvas->GetZoom() <= 2.0) +void AnimationTimer::Notify() { + if (map_canvas->GetZoom() <= 2.0) { map_canvas->Refresh(); + } }; -void AnimationTimer::Start() -{ - if(!started) { +void AnimationTimer::Start() { + if (!started) { started = true; wxTimer::Start(100); } }; -void AnimationTimer::Stop() -{ - if(started) { +void AnimationTimer::Stop() { + if (started) { started = false; wxTimer::Stop(); } diff --git a/source/map_display.h b/source/map_display.h index 572bcb55..5a58ebbc 100644 --- a/source/map_display.h +++ b/source/map_display.h @@ -31,75 +31,76 @@ class MapPopupMenu; class AnimationTimer; class MapDrawer; -class MapCanvas : public wxGLCanvas -{ +class MapCanvas : public wxGLCanvas { public: - MapCanvas(MapWindow* parent, Editor& editor, int* attriblist); + MapCanvas(MapWindow* parent, Editor &editor, int* attriblist); virtual ~MapCanvas(); void Reset(); // All events - void OnPaint(wxPaintEvent& event); - void OnEraseBackground(wxEraseEvent& event) {} - - void OnMouseMove(wxMouseEvent& event); - void OnMouseLeftRelease(wxMouseEvent& event); - void OnMouseLeftClick(wxMouseEvent& event); - void OnMouseLeftDoubleClick(wxMouseEvent& event); - void OnMouseCenterClick(wxMouseEvent& event); - void OnMouseCenterRelease(wxMouseEvent& event); - void OnMouseRightClick(wxMouseEvent& event); - void OnMouseRightRelease(wxMouseEvent& event); - - void OnKeyDown(wxKeyEvent& event); - void OnKeyUp(wxKeyEvent& event); - void OnWheel(wxMouseEvent& event); - void OnGainMouse(wxMouseEvent& event); - void OnLoseMouse(wxMouseEvent& event); + void OnPaint(wxPaintEvent &event); + void OnEraseBackground(wxEraseEvent &event) { } + + void OnMouseMove(wxMouseEvent &event); + void OnMouseLeftRelease(wxMouseEvent &event); + void OnMouseLeftClick(wxMouseEvent &event); + void OnMouseLeftDoubleClick(wxMouseEvent &event); + void OnMouseCenterClick(wxMouseEvent &event); + void OnMouseCenterRelease(wxMouseEvent &event); + void OnMouseRightClick(wxMouseEvent &event); + void OnMouseRightRelease(wxMouseEvent &event); + + void OnKeyDown(wxKeyEvent &event); + void OnKeyUp(wxKeyEvent &event); + void OnWheel(wxMouseEvent &event); + void OnGainMouse(wxMouseEvent &event); + void OnLoseMouse(wxMouseEvent &event); // Mouse events handlers (called by the above) - void OnMouseActionRelease(wxMouseEvent& event); - void OnMouseActionClick(wxMouseEvent& event); - void OnMouseCameraClick(wxMouseEvent& event); - void OnMouseCameraRelease(wxMouseEvent& event); - void OnMousePropertiesClick(wxMouseEvent& event); - void OnMousePropertiesRelease(wxMouseEvent& event); + void OnMouseActionRelease(wxMouseEvent &event); + void OnMouseActionClick(wxMouseEvent &event); + void OnMouseCameraClick(wxMouseEvent &event); + void OnMouseCameraRelease(wxMouseEvent &event); + void OnMousePropertiesClick(wxMouseEvent &event); + void OnMousePropertiesRelease(wxMouseEvent &event); // - void OnCut(wxCommandEvent& event); - void OnCopy(wxCommandEvent& event); - void OnCopyPosition(wxCommandEvent& event); - void OnCopyServerId(wxCommandEvent& event); - void OnCopyClientId(wxCommandEvent& event); - void OnCopyName(wxCommandEvent& event); - void OnBrowseTile(wxCommandEvent& event); - void OnPaste(wxCommandEvent& event); - void OnDelete(wxCommandEvent& event); + void OnCut(wxCommandEvent &event); + void OnCopy(wxCommandEvent &event); + void OnCopyPosition(wxCommandEvent &event); + void OnCopyServerId(wxCommandEvent &event); + void OnCopyClientId(wxCommandEvent &event); + void OnCopyName(wxCommandEvent &event); + void OnBrowseTile(wxCommandEvent &event); + void OnPaste(wxCommandEvent &event); + void OnDelete(wxCommandEvent &event); // ---- - void OnGotoDestination(wxCommandEvent& event); - void OnCopyDestination(wxCommandEvent& event); - void OnRotateItem(wxCommandEvent& event); - void OnSwitchDoor(wxCommandEvent& event); + void OnGotoDestination(wxCommandEvent &event); + void OnCopyDestination(wxCommandEvent &event); + void OnRotateItem(wxCommandEvent &event); + void OnSwitchDoor(wxCommandEvent &event); // ---- - void OnSelectRAWBrush(wxCommandEvent& event); - void OnSelectGroundBrush(wxCommandEvent& event); - void OnSelectDoodadBrush(wxCommandEvent& event); - void OnSelectDoorBrush(wxCommandEvent& event); - void OnSelectWallBrush(wxCommandEvent& event); - void OnSelectCarpetBrush(wxCommandEvent& event); - void OnSelectTableBrush(wxCommandEvent& event); - void OnSelectMonsterBrush(wxCommandEvent& event); - void OnSelectSpawnBrush(wxCommandEvent& event); - void OnSelectNpcBrush(wxCommandEvent& event); - void OnSelectSpawnNpcBrush(wxCommandEvent& event); - void OnSelectHouseBrush(wxCommandEvent& event); + void OnSelectRAWBrush(wxCommandEvent &event); + void OnSelectGroundBrush(wxCommandEvent &event); + void OnSelectDoodadBrush(wxCommandEvent &event); + void OnSelectDoorBrush(wxCommandEvent &event); + void OnSelectWallBrush(wxCommandEvent &event); + void OnSelectCarpetBrush(wxCommandEvent &event); + void OnSelectTableBrush(wxCommandEvent &event); + void OnSelectMonsterBrush(wxCommandEvent &event); + void OnSelectSpawnBrush(wxCommandEvent &event); + void OnSelectNpcBrush(wxCommandEvent &event); + void OnSelectSpawnNpcBrush(wxCommandEvent &event); + void OnSelectHouseBrush(wxCommandEvent &event); // --- - void OnProperties(wxCommandEvent& event); + void OnProperties(wxCommandEvent &event); void Refresh(); void ScreenToMap(int screen_x, int screen_y, int* map_x, int* map_y); - void MouseToMap(int* map_x, int* map_y) { ScreenToMap(cursor_x, cursor_y, map_x, map_y); } + void MouseToMap(int* map_x, int* map_y) { + ScreenToMap(cursor_x, cursor_y, map_x, map_y); + } void GetScreenCenter(int* map_x, int* map_y); void StartPasting(); @@ -111,35 +112,41 @@ class MapCanvas : public wxGLCanvas void UpdateZoomStatus(); void ChangeFloor(int new_floor); - int GetFloor() const noexcept { return floor; } - double GetZoom() const noexcept { return zoom; } + int GetFloor() const noexcept { + return floor; + } + double GetZoom() const noexcept { + return zoom; + } void SetZoom(double value); void GetViewBox(int* view_scroll_x, int* view_scroll_y, int* screensize_x, int* screensize_y) const; MapWindow* GetMapWindow() const; Position GetCursorPosition() const; - void ShowPositionIndicator(const Position& position); + void ShowPositionIndicator(const Position &position); void TakeScreenshot(wxFileName path, wxString format); protected: void getTilesToDraw(int mouse_map_x, int mouse_map_y, int floor, PositionVector* tilestodraw, PositionVector* tilestoborder, bool fill = false); - bool floodFill(Map *map, const Position& center, int x, int y, GroundBrush* brush, PositionVector* positions); + bool floodFill(Map* map, const Position ¢er, int x, int y, GroundBrush* brush, PositionVector* positions); private: enum { BLOCK_SIZE = 64 }; - inline int getFillIndex(int x, int y) const noexcept { return ((y % BLOCK_SIZE) * BLOCK_SIZE) + (x % BLOCK_SIZE); } + inline int getFillIndex(int x, int y) const noexcept { + return ((y % BLOCK_SIZE) * BLOCK_SIZE) + (x % BLOCK_SIZE); + } - static bool processed[BLOCK_SIZE*BLOCK_SIZE]; + static bool processed[BLOCK_SIZE * BLOCK_SIZE]; - Editor& editor; - MapDrawer *drawer; + Editor &editor; + MapDrawer* drawer; int keyCode; -// View related + // View related int floor; double zoom; int cursor_x; @@ -191,26 +198,25 @@ class MapCanvas : public wxGLCanvas // Right-click popup menu class MapPopupMenu : public wxMenu { public: - MapPopupMenu(Editor& editor); + MapPopupMenu(Editor &editor); virtual ~MapPopupMenu(); void Update(); protected: - Editor& editor; + Editor &editor; }; -class AnimationTimer : public wxTimer -{ +class AnimationTimer : public wxTimer { public: - AnimationTimer(MapCanvas *canvas); + AnimationTimer(MapCanvas* canvas); void Notify(); void Start(); void Stop(); private: - MapCanvas *map_canvas; + MapCanvas* map_canvas; bool started; }; diff --git a/source/map_drawer.cpp b/source/map_drawer.cpp index f404b3e1..7e0fc4ac 100644 --- a/source/map_drawer.cpp +++ b/source/map_drawer.cpp @@ -46,13 +46,11 @@ #include "waypoint_brush.h" #include "light_drawer.h" -DrawingOptions::DrawingOptions() -{ +DrawingOptions::DrawingOptions() { SetDefault(); } -void DrawingOptions::SetDefault() -{ +void DrawingOptions::SetDefault() { transparent_floors = false; transparent_items = false; show_ingame_box = false; @@ -84,8 +82,7 @@ void DrawingOptions::SetDefault() hide_items_when_zoomed = true; } -void DrawingOptions::SetIngame() -{ +void DrawingOptions::SetIngame() { transparent_floors = false; transparent_items = false; show_ingame_box = false; @@ -117,40 +114,35 @@ void DrawingOptions::SetIngame() hide_items_when_zoomed = false; } -bool DrawingOptions::isOnlyColors() const noexcept -{ +bool DrawingOptions::isOnlyColors() const noexcept { return show_as_minimap || show_only_colors; } -bool DrawingOptions::isTileIndicators() const noexcept -{ - if(isOnlyColors()) +bool DrawingOptions::isTileIndicators() const noexcept { + if (isOnlyColors()) { return false; + } return show_pickupables || show_moveables || show_houses || show_spawns_monster || show_spawns_npc; } -bool DrawingOptions::isTooltips() const noexcept -{ +bool DrawingOptions::isTooltips() const noexcept { return show_tooltips && !isOnlyColors(); } -bool DrawingOptions::isDrawLight() const noexcept -{ +bool DrawingOptions::isDrawLight() const noexcept { return show_ingame_box && show_lights; } -MapDrawer::MapDrawer(MapCanvas* canvas) : canvas(canvas), editor(canvas->editor) -{ +MapDrawer::MapDrawer(MapCanvas* canvas) : + canvas(canvas), editor(canvas->editor) { light_drawer = std::make_shared(); } -MapDrawer::~MapDrawer() -{ +MapDrawer::~MapDrawer() { Release(); } -void MapDrawer::SetupVars() -{ +void MapDrawer::SetupVars() { canvas->MouseToMap(&mouse_map_x, &mouse_map_y); canvas->GetViewBox(&view_scroll_x, &view_scroll_y, &screensize_x, &screensize_y); @@ -161,14 +153,15 @@ void MapDrawer::SetupVars() tile_size = int(rme::TileSize / zoom); // after zoom floor = canvas->GetFloor(); - if(options.show_all_floors) { - if(floor < 8) + if (options.show_all_floors) { + if (floor < 8) { start_z = rme::MapGroundLayer; - else + } else { start_z = std::min(rme::MapMaxLayer, floor + 2); - } - else + } + } else { start_z = floor; + } end_z = floor; superend_z = (floor > rme::MapGroundLayer ? 8 : 0); @@ -176,7 +169,7 @@ void MapDrawer::SetupVars() start_x = view_scroll_x / rme::TileSize; start_y = view_scroll_y / rme::TileSize; - if(floor > rme::MapGroundLayer) { + if (floor > rme::MapGroundLayer) { start_x -= 2; start_y -= 2; } @@ -185,8 +178,7 @@ void MapDrawer::SetupVars() end_y = start_y + screensize_y / tile_size + 2; } -void MapDrawer::SetupGL() -{ +void MapDrawer::SetupGL() { glViewport(0, 0, screensize_x, screensize_y); // Enable 2D mode @@ -197,7 +189,7 @@ void MapDrawer::SetupGL() glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); - glOrtho(0, vPort[2]*zoom, vPort[3]*zoom, 0, -1, 1); + glOrtho(0, vPort[2] * zoom, vPort[3] * zoom, 0, -1, 1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); @@ -205,14 +197,13 @@ void MapDrawer::SetupGL() glTranslatef(0.375f, 0.375f, 0.0f); } -void MapDrawer::Release() -{ - for(auto it = tooltips.begin(); it != tooltips.end(); ++it) { +void MapDrawer::Release() { + for (auto it = tooltips.begin(); it != tooltips.end(); ++it) { delete *it; } tooltips.clear(); - if(light_drawer) { + if (light_drawer) { light_drawer->clear(); } @@ -223,26 +214,28 @@ void MapDrawer::Release() glPopMatrix(); } -void MapDrawer::Draw() -{ +void MapDrawer::Draw() { DrawBackground(); DrawMap(); DrawDraggingShadow(); DrawHigherFloors(); - if(options.dragging) + if (options.dragging) { DrawSelectionBox(); + } DrawLiveCursors(); DrawBrush(); - if(options.show_grid && zoom <= 10.f) + if (options.show_grid && zoom <= 10.f) { DrawGrid(); - if(options.show_ingame_box) + } + if (options.show_ingame_box) { DrawIngameBox(); - if(options.isTooltips()) + } + if (options.isTooltips()) { DrawTooltips(); + } } -void MapDrawer::DrawBackground() -{ +void MapDrawer::DrawBackground() { // Black Background glClearColor(0.0f, 0.0f, 0.0f, 0.0f); @@ -252,42 +245,42 @@ void MapDrawer::DrawBackground() glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - //glAlphaFunc(GL_GEQUAL, 0.9f); - //glEnable(GL_ALPHA_TEST); + // glAlphaFunc(GL_GEQUAL, 0.9f); + // glEnable(GL_ALPHA_TEST); } -inline int getFloorAdjustment(int floor) -{ - if(floor > rme::MapGroundLayer) // Underground +inline int getFloorAdjustment(int floor) { + if (floor > rme::MapGroundLayer) { // Underground return 0; // No adjustment - else + } else { return rme::TileSize * (rme::MapGroundLayer - floor); + } } -void MapDrawer::DrawShade(int map_z) -{ - if(map_z == end_z && start_z != end_z) { +void MapDrawer::DrawShade(int map_z) { + if (map_z == end_z && start_z != end_z) { bool only_colors = options.isOnlyColors(); - if(!only_colors) + if (!only_colors) { glDisable(GL_TEXTURE_2D); + } float x = screensize_x * zoom; float y = screensize_y * zoom; glColor4ub(0, 0, 0, 128); glBegin(GL_QUADS); - glVertex2f(0, y); - glVertex2f(x, y); - glVertex2f(x,0); - glVertex2f(0,0); + glVertex2f(0, y); + glVertex2f(x, y); + glVertex2f(x, 0); + glVertex2f(0, 0); glEnd(); - if(!only_colors) + if (!only_colors) { glEnable(GL_TEXTURE_2D); + } } } -void MapDrawer::DrawMap() -{ +void MapDrawer::DrawMap() { int center_x = start_x + int(screensize_x * zoom / 64); int center_y = start_y + int(screensize_y * zoom / 64); int offset_y = 2; @@ -302,82 +295,86 @@ void MapDrawer::DrawMap() // The current house we're drawing current_house_id = 0; - if(brush) { - if(brush->isHouse()) + if (brush) { + if (brush->isHouse()) { current_house_id = brush->asHouse()->getHouseID(); - else if(brush->isHouseExit()) + } else if (brush->isHouseExit()) { current_house_id = brush->asHouseExit()->getHouseID(); + } } bool only_colors = options.isOnlyColors(); bool tile_indicators = options.isTileIndicators(); - for(int map_z = start_z; map_z >= superend_z; map_z--) { - if(options.show_shade) { + for (int map_z = start_z; map_z >= superend_z; map_z--) { + if (options.show_shade) { DrawShade(map_z); } - if(map_z >= end_z) { - if(!only_colors) + if (map_z >= end_z) { + if (!only_colors) { glEnable(GL_TEXTURE_2D); + } int nd_start_x = start_x & ~3; int nd_start_y = start_y & ~3; int nd_end_x = (end_x & ~3) + 4; int nd_end_y = (end_y & ~3) + 4; - for(int nd_map_x = nd_start_x; nd_map_x <= nd_end_x; nd_map_x += 4) { - for(int nd_map_y = nd_start_y; nd_map_y <= nd_end_y; nd_map_y += 4) { + for (int nd_map_x = nd_start_x; nd_map_x <= nd_end_x; nd_map_x += 4) { + for (int nd_map_y = nd_start_y; nd_map_y <= nd_end_y; nd_map_y += 4) { QTreeNode* nd = editor.getMap().getLeaf(nd_map_x, nd_map_y); - if(!nd) { - if(!live_client) + if (!nd) { + if (!live_client) { continue; + } nd = editor.getMap().createLeaf(nd_map_x, nd_map_y); nd->setVisible(false, false); } - if(!live_client || nd->isVisible(map_z > rme::MapGroundLayer)) { - for(int map_x = 0; map_x < 4; ++map_x) { - for(int map_y = 0; map_y < 4; ++map_y) { + if (!live_client || nd->isVisible(map_z > rme::MapGroundLayer)) { + for (int map_x = 0; map_x < 4; ++map_x) { + for (int map_y = 0; map_y < 4; ++map_y) { TileLocation* location = nd->getTile(map_x, map_y, map_z); DrawTile(location); - if(location && options.isDrawLight()) { - auto& position = location->getPosition(); - if(position.x >= box_start_map_x && position.x <= box_end_map_x && position.y >= box_start_map_y && position.y <= box_end_map_y) { + if (location && options.isDrawLight()) { + auto &position = location->getPosition(); + if (position.x >= box_start_map_x && position.x <= box_end_map_x && position.y >= box_start_map_y && position.y <= box_end_map_y) { AddLight(location); } } } } if (tile_indicators) { - for(int map_x = 0; map_x < 4; ++map_x) { - for(int map_y = 0; map_y < 4; ++map_y) { + for (int map_x = 0; map_x < 4; ++map_x) { + for (int map_y = 0; map_y < 4; ++map_y) { DrawTileIndicators(nd->getTile(map_x, map_y, map_z)); } } } } else { - if(!nd->isRequested(map_z > rme::MapGroundLayer)) { + if (!nd->isRequested(map_z > rme::MapGroundLayer)) { // Request the node editor.QueryNode(nd_map_x, nd_map_y, map_z > rme::MapGroundLayer); nd->setRequested(map_z > rme::MapGroundLayer, true); } - int cy = (nd_map_y) * rme::TileSize - view_scroll_y - getFloorAdjustment(floor); - int cx = (nd_map_x) * rme::TileSize - view_scroll_x - getFloorAdjustment(floor); + int cy = (nd_map_y)*rme::TileSize - view_scroll_y - getFloorAdjustment(floor); + int cx = (nd_map_x)*rme::TileSize - view_scroll_x - getFloorAdjustment(floor); glColor4ub(255, 0, 255, 128); glBegin(GL_QUADS); - glVertex2f(cx, cy + rme::TileSize * 4); - glVertex2f(cx + rme::TileSize * 4, cy + rme::TileSize * 4); - glVertex2f(cx + rme::TileSize * 4, cy); - glVertex2f(cx, cy); + glVertex2f(cx, cy + rme::TileSize * 4); + glVertex2f(cx + rme::TileSize * 4, cy + rme::TileSize * 4); + glVertex2f(cx + rme::TileSize * 4, cy); + glVertex2f(cx, cy); glEnd(); } } } - if(!only_colors) + if (!only_colors) { glDisable(GL_TEXTURE_2D); + } DrawPositionIndicator(map_z); } @@ -391,72 +388,77 @@ void MapDrawer::DrawMap() ++end_y; } - if(!only_colors) + if (!only_colors) { glEnable(GL_TEXTURE_2D); + } } -void MapDrawer::DrawSecondaryMap(int map_z) -{ - if(options.ingame) +void MapDrawer::DrawSecondaryMap(int map_z) { + if (options.ingame) { return; + } BaseMap* secondary_map = g_gui.secondary_map; - if(!secondary_map) return; + if (!secondary_map) { + return; + } Position normal_pos; Position to_pos(mouse_map_x, mouse_map_y, floor); - if(canvas->isPasting()) { + if (canvas->isPasting()) { normal_pos = editor.copybuffer.getPosition(); } else { Brush* brush = g_gui.GetCurrentBrush(); - if(brush && brush->isDoodad()) { + if (brush && brush->isDoodad()) { normal_pos = Position(0x8000, 0x8000, 0x8); } } glEnable(GL_TEXTURE_2D); - for(int map_x = start_x; map_x <= end_x; map_x++) { - for(int map_y = start_y; map_y <= end_y; map_y++) { + for (int map_x = start_x; map_x <= end_x; map_x++) { + for (int map_y = start_y; map_y <= end_y; map_y++) { Position final_pos(map_x, map_y, map_z); Position pos = normal_pos + final_pos - to_pos; - if(pos.z < 0 || pos.z >= rme::MapLayers) { + if (pos.z < 0 || pos.z >= rme::MapLayers) { continue; } Tile* tile = secondary_map->getTile(pos); - if(!tile) continue; + if (!tile) { + continue; + } int draw_x, draw_y; getDrawPosition(final_pos, draw_x, draw_y); // Draw ground uint8_t r = 160, g = 160, b = 160; - if(tile->ground) { - if(options.show_blocking && tile->isBlocking()) { - g = g/3*2; - b = b/3*2; + if (tile->ground) { + if (options.show_blocking && tile->isBlocking()) { + g = g / 3 * 2; + b = b / 3 * 2; } - if(options.show_houses && tile->isHouseTile()) { - if(tile->getHouseID() == current_house_id) { + if (options.show_houses && tile->isHouseTile()) { + if (tile->getHouseID() == current_house_id) { r /= 2; } else { r /= 2; g /= 2; } - } else if(options.show_special_tiles && tile->isPZ()) { + } else if (options.show_special_tiles && tile->isPZ()) { r /= 2; b /= 2; } - if(options.show_special_tiles && tile->getMapFlags() & TILESTATE_PVPZONE) { - r = r/3*2; - b = r/3*2; + if (options.show_special_tiles && tile->getMapFlags() & TILESTATE_PVPZONE) { + r = r / 3 * 2; + b = r / 3 * 2; } - if(options.show_special_tiles && tile->getMapFlags() & TILESTATE_NOLOGOUT) { + if (options.show_special_tiles && tile->getMapFlags() & TILESTATE_NOLOGOUT) { b /= 2; } - if(options.show_special_tiles && tile->getMapFlags() & TILESTATE_NOPVP) { + if (options.show_special_tiles && tile->getMapFlags() & TILESTATE_NOPVP) { g /= 2; } BlitItem(draw_x, draw_y, tile, tile->ground, true, r, g, b, 160); @@ -465,9 +467,9 @@ void MapDrawer::DrawSecondaryMap(int map_z) bool hidden = options.hide_items_when_zoomed && zoom > 10.f; // Draw items - if(!hidden && !tile->items.empty()) { - for(const Item* item : tile->items) { - if(item->isBorder()) { + if (!hidden && !tile->items.empty()) { + for (const Item* item : tile->items) { + if (item->isBorder()) { BlitItem(draw_x, draw_y, tile, item, true, 160, r, g, b); } else { BlitItem(draw_x, draw_y, tile, item, true, 160, 160, 160, 160); @@ -476,11 +478,11 @@ void MapDrawer::DrawSecondaryMap(int map_z) } // Monsters - if(!hidden && options.show_monsters && tile->monster) { + if (!hidden && options.show_monsters && tile->monster) { BlitCreature(draw_x, draw_y, tile->monster); } // NPCS - if(!hidden && options.show_npcs && tile->npc) { + if (!hidden && options.show_npcs && tile->npc) { BlitCreature(draw_x, draw_y, tile->npc); } } @@ -489,8 +491,7 @@ void MapDrawer::DrawSecondaryMap(int map_z) glDisable(GL_TEXTURE_2D); } -void MapDrawer::DrawIngameBox() -{ +void MapDrawer::DrawIngameBox() { int center_x = start_x + int(screensize_x * zoom / 64); int center_y = start_y + int(screensize_y * zoom / 64); @@ -505,7 +506,7 @@ void MapDrawer::DrawIngameBox() int box_end_x = box_end_map_x * rme::TileSize - view_scroll_x; int box_end_y = box_end_map_y * rme::TileSize - view_scroll_y; - if(options.isDrawLight()) { + if (options.isDrawLight()) { light_drawer->draw(box_start_map_x, box_start_map_y, view_scroll_x, view_scroll_y); } @@ -514,58 +515,57 @@ void MapDrawer::DrawIngameBox() glDisable(GL_TEXTURE_2D); // left side - if(box_start_map_x >= start_x) { + if (box_start_map_x >= start_x) { drawFilledRect(0, 0, box_start_x, screensize_y * zoom, side_color); } // right side - if(box_end_map_x < end_x) { + if (box_end_map_x < end_x) { drawFilledRect(box_end_x, 0, screensize_x * zoom, screensize_y * zoom, side_color); } // top side - if(box_start_map_y >= start_y) { - drawFilledRect(box_start_x, 0, box_end_x-box_start_x, box_start_y, side_color); + if (box_start_map_y >= start_y) { + drawFilledRect(box_start_x, 0, box_end_x - box_start_x, box_start_y, side_color); } // bottom side - if(box_end_map_y < end_y) { - drawFilledRect(box_start_x, box_end_y, box_end_x-box_start_x, screensize_y * zoom, side_color); + if (box_end_map_y < end_y) { + drawFilledRect(box_start_x, box_end_y, box_end_x - box_start_x, screensize_y * zoom, side_color); } // hidden tiles - drawRect(box_start_x, box_start_y, box_end_x-box_start_x, box_end_y-box_start_y, *wxRED); + drawRect(box_start_x, box_start_y, box_end_x - box_start_x, box_end_y - box_start_y, *wxRED); // visible tiles box_start_x += rme::TileSize; box_start_y += rme::TileSize; box_end_x -= 2 * rme::TileSize; box_end_y -= 2 * rme::TileSize; - drawRect(box_start_x, box_start_y, box_end_x-box_start_x, box_end_y-box_start_y, *wxGREEN); + drawRect(box_start_x, box_start_y, box_end_x - box_start_x, box_end_y - box_start_y, *wxGREEN); // player position - box_start_x += ((rme::ClientMapWidth/2)-2) * rme::TileSize; - box_start_y += ((rme::ClientMapHeight/2)-2) * rme::TileSize; + box_start_x += ((rme::ClientMapWidth / 2) - 2) * rme::TileSize; + box_start_y += ((rme::ClientMapHeight / 2) - 2) * rme::TileSize; box_end_x = box_start_x + rme::TileSize; box_end_y = box_start_y + rme::TileSize; - drawRect(box_start_x, box_start_y, box_end_x-box_start_x, box_end_y-box_start_y, *wxGREEN); + drawRect(box_start_x, box_start_y, box_end_x - box_start_x, box_end_y - box_start_y, *wxGREEN); glEnable(GL_TEXTURE_2D); } -void MapDrawer::DrawGrid() -{ +void MapDrawer::DrawGrid() { glDisable(GL_TEXTURE_2D); glColor4ub(255, 255, 255, 128); - glBegin(GL_LINES); + glBegin(GL_LINES); - for(int y = start_y; y < end_y; ++y) { + for (int y = start_y; y < end_y; ++y) { int py = y * rme::TileSize - view_scroll_y; glVertex2f(start_x * rme::TileSize - view_scroll_x, py); glVertex2f(end_x * rme::TileSize - view_scroll_x, py); } - for(int x = start_x; x < end_x; ++x) { + for (int x = start_x; x < end_x; ++x) { int px = x * rme::TileSize - view_scroll_x; glVertex2f(px, start_y * rme::TileSize - view_scroll_y); glVertex2f(px, end_y * rme::TileSize - view_scroll_y); @@ -575,24 +575,25 @@ void MapDrawer::DrawGrid() glEnable(GL_TEXTURE_2D); } -void MapDrawer::DrawDraggingShadow() -{ - if(!dragging || options.ingame || editor.getSelection().isBusy()) +void MapDrawer::DrawDraggingShadow() { + if (!dragging || options.ingame || editor.getSelection().isBusy()) { return; + } glEnable(GL_TEXTURE_2D); - for(Tile* tile : editor.getSelection()) { + for (Tile* tile : editor.getSelection()) { int move_z = canvas->drag_start_z - floor; int move_x = canvas->drag_start_x - mouse_map_x; int move_y = canvas->drag_start_y - mouse_map_y; - if(move_x == 0 && move_y == 0 && move_z == 0) + if (move_x == 0 && move_y == 0 && move_z == 0) { continue; + } - const Position& position = tile->getPosition(); + const Position &position = tile->getPosition(); int pos_z = position.z - move_z; - if(pos_z < 0 || pos_z >= rme::MapLayers) { + if (pos_z < 0 || pos_z >= rme::MapLayers) { continue; } @@ -600,7 +601,7 @@ void MapDrawer::DrawDraggingShadow() int pos_y = position.y - move_y; // On screen and dragging? - if(pos_x+2 > start_x && pos_x < end_x && pos_y+2 > start_y && pos_y < end_y) { + if (pos_x + 2 > start_x && pos_x < end_x && pos_y + 2 > start_y && pos_y < end_y) { Position pos(pos_x, pos_y, pos_z); int draw_x, draw_y; getDrawPosition(pos, draw_x, draw_y); @@ -608,24 +609,25 @@ void MapDrawer::DrawDraggingShadow() ItemVector items = tile->getSelectedItems(); Tile* dest_tile = editor.getMap().getTile(pos); - for(Item* item : items) { - if(dest_tile) - BlitItem(draw_x, draw_y, dest_tile, item, true, 160,160,160,160); - else - BlitItem(draw_x, draw_y, pos, item, true, 160,160,160,160); + for (Item* item : items) { + if (dest_tile) { + BlitItem(draw_x, draw_y, dest_tile, item, true, 160, 160, 160, 160); + } else { + BlitItem(draw_x, draw_y, pos, item, true, 160, 160, 160, 160); + } } - if(options.show_monsters && tile->monster && tile->monster->isSelected()) { + if (options.show_monsters && tile->monster && tile->monster->isSelected()) { BlitCreature(draw_x, draw_y, tile->monster); } - if(tile->spawnMonster && tile->spawnMonster->isSelected()) { + if (tile->spawnMonster && tile->spawnMonster->isSelected()) { DrawIndicator(draw_x, draw_y, EDITOR_SPRITE_SPAWNS, 160, 160, 160, 160); } - if(options.show_npcs && tile->npc && tile->npc->isSelected()) { + if (options.show_npcs && tile->npc && tile->npc->isSelected()) { BlitCreature(draw_x, draw_y, tile->npc); } - if(tile->spawnNpc && tile->spawnNpc->isSelected()) { + if (tile->spawnNpc && tile->spawnNpc->isSelected()) { DrawIndicator(draw_x, draw_y, EDITOR_SPRITE_SPAWNS, 160, 160, 160, 160); } } @@ -634,34 +636,37 @@ void MapDrawer::DrawDraggingShadow() glDisable(GL_TEXTURE_2D); } -void MapDrawer::DrawHigherFloors() -{ - if(!options.transparent_floors || floor == 0 || floor == 8) +void MapDrawer::DrawHigherFloors() { + if (!options.transparent_floors || floor == 0 || floor == 8) { return; + } glEnable(GL_TEXTURE_2D); int map_z = floor - 1; - for(int map_x = start_x; map_x <= end_x; map_x++) { - for(int map_y = start_y; map_y <= end_y; map_y++) { + for (int map_x = start_x; map_x <= end_x; map_x++) { + for (int map_y = start_y; map_y <= end_y; map_y++) { Tile* tile = editor.getMap().getTile(map_x, map_y, map_z); - if(!tile) continue; + if (!tile) { + continue; + } int draw_x, draw_y; getDrawPosition(tile->getPosition(), draw_x, draw_y); - if(tile->ground) { - if(tile->isPZ()) { - BlitItem(draw_x, draw_y, tile, tile->ground, false, 128,255,128, 96); + if (tile->ground) { + if (tile->isPZ()) { + BlitItem(draw_x, draw_y, tile, tile->ground, false, 128, 255, 128, 96); } else { - BlitItem(draw_x, draw_y, tile, tile->ground, false, 255,255,255, 96); + BlitItem(draw_x, draw_y, tile, tile->ground, false, 255, 255, 255, 96); } } bool hidden = options.hide_items_when_zoomed && zoom > 10.f; - if(!hidden && !tile->items.empty()) { - for(const Item* item : tile->items) - BlitItem(draw_x, draw_y, tile, item, false, 255,255,255, 96); + if (!hidden && !tile->items.empty()) { + for (const Item* item : tile->items) { + BlitItem(draw_x, draw_y, tile, item, false, 255, 255, 255, 96); + } } } } @@ -669,8 +674,7 @@ void MapDrawer::DrawHigherFloors() glDisable(GL_TEXTURE_2D); } -void MapDrawer::DrawSelectionBox() -{ +void MapDrawer::DrawSelectionBox() { if (options.ingame) { return; } @@ -708,9 +712,9 @@ void MapDrawer::DrawSelectionBox() glEnable(GL_LINE_STIPPLE); glLineStipple(2, 0xAAAA); glLineWidth(1.0); - glColor4f(1.0,1.0,1.0,1.0); + glColor4f(1.0, 1.0, 1.0, 1.0); glBegin(GL_LINES); - for(int i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { glVertex2f(lines[i][0], lines[i][1]); glVertex2f(lines[i][2], lines[i][3]); } @@ -719,22 +723,22 @@ void MapDrawer::DrawSelectionBox() glEnable(GL_TEXTURE_2D); } -void MapDrawer::DrawLiveCursors() -{ - if(options.ingame || !editor.IsLive()) +void MapDrawer::DrawLiveCursors() { + if (options.ingame || !editor.IsLive()) { return; + } - LiveSocket& live = editor.GetLive(); - for(LiveCursor& cursor : live.getCursorList()) { - if(cursor.pos.z <= rme::MapGroundLayer && floor > rme::MapGroundLayer) { + LiveSocket &live = editor.GetLive(); + for (LiveCursor &cursor : live.getCursorList()) { + if (cursor.pos.z <= rme::MapGroundLayer && floor > rme::MapGroundLayer) { continue; } - if(cursor.pos.z > rme::MapGroundLayer && floor <= 8) { + if (cursor.pos.z > rme::MapGroundLayer && floor <= 8) { continue; } - if(cursor.pos.z < floor) { + if (cursor.pos.z < floor) { cursor.color = wxColor( cursor.color.Red(), cursor.color.Green(), @@ -744,56 +748,57 @@ void MapDrawer::DrawLiveCursors() } int offset; - if(cursor.pos.z <= rme::MapGroundLayer) + if (cursor.pos.z <= rme::MapGroundLayer) { offset = (rme::MapGroundLayer - cursor.pos.z) * rme::TileSize; - else + } else { offset = rme::TileSize * (floor - cursor.pos.z); + } float draw_x = ((cursor.pos.x * rme::TileSize) - view_scroll_x) - offset; float draw_y = ((cursor.pos.y * rme::TileSize) - view_scroll_y) - offset; glColor(cursor.color); glBegin(GL_QUADS); - glVertex2f(draw_x, draw_y); - glVertex2f(draw_x + rme::TileSize, draw_y); - glVertex2f(draw_x + rme::TileSize, draw_y + rme::TileSize); - glVertex2f(draw_x, draw_y + rme::TileSize); + glVertex2f(draw_x, draw_y); + glVertex2f(draw_x + rme::TileSize, draw_y); + glVertex2f(draw_x + rme::TileSize, draw_y + rme::TileSize); + glVertex2f(draw_x, draw_y + rme::TileSize); glEnd(); } } -void MapDrawer::DrawBrush() -{ - if(options.ingame || !g_gui.IsDrawingMode() || !g_gui.GetCurrentBrush()) { +void MapDrawer::DrawBrush() { + if (options.ingame || !g_gui.IsDrawingMode() || !g_gui.GetCurrentBrush()) { return; } Brush* brush = g_gui.GetCurrentBrush(); BrushColor brushColor = COLOR_BLANK; - if(brush->isTerrain() || brush->isTable() || brush->isCarpet()) + if (brush->isTerrain() || brush->isTable() || brush->isCarpet()) { brushColor = COLOR_BRUSH; - else if(brush->isHouse()) + } else if (brush->isHouse()) { brushColor = COLOR_HOUSE_BRUSH; - else if(brush->isFlag()) + } else if (brush->isFlag()) { brushColor = COLOR_FLAG_BRUSH; - else if(brush->isSpawnMonster()) + } else if (brush->isSpawnMonster()) { brushColor = COLOR_SPAWN_BRUSH; - else if(brush->isSpawnNpc()) + } else if (brush->isSpawnNpc()) { brushColor = COLOR_SPAWN_NPC_BRUSH; - else if(brush->isEraser()) + } else if (brush->isEraser()) { brushColor = COLOR_ERASER; + } int adjustment = getFloorAdjustment(floor); - if(dragging_draw) { + if (dragging_draw) { ASSERT(brush->canDrag()); - if(brush->isWall()) { + if (brush->isWall()) { int last_click_start_map_x = std::min(canvas->last_click_map_x, mouse_map_x); int last_click_start_map_y = std::min(canvas->last_click_map_y, mouse_map_y); - int last_click_end_map_x = std::max(canvas->last_click_map_x, mouse_map_x)+1; - int last_click_end_map_y = std::max(canvas->last_click_map_y, mouse_map_y)+1; + int last_click_end_map_x = std::max(canvas->last_click_map_x, mouse_map_x) + 1; + int last_click_end_map_y = std::max(canvas->last_click_map_y, mouse_map_y) + 1; int last_click_start_sx = last_click_start_map_x * rme::TileSize - view_scroll_x - adjustment; int last_click_start_sy = last_click_start_map_y * rme::TileSize - view_scroll_y - adjustment; @@ -805,51 +810,52 @@ void MapDrawer::DrawBrush() glColor(brushColor); glBegin(GL_QUADS); - { - glVertex2f(last_click_start_sx, last_click_start_sy + rme::TileSize); - glVertex2f(last_click_end_sx, last_click_start_sy + rme::TileSize); - glVertex2f(last_click_end_sx, last_click_start_sy); - glVertex2f(last_click_start_sx, last_click_start_sy); - } + { + glVertex2f(last_click_start_sx, last_click_start_sy + rme::TileSize); + glVertex2f(last_click_end_sx, last_click_start_sy + rme::TileSize); + glVertex2f(last_click_end_sx, last_click_start_sy); + glVertex2f(last_click_start_sx, last_click_start_sy); + } - if(delta_y > rme::TileSize) { - glVertex2f(last_click_start_sx, last_click_end_sy - rme::TileSize); - glVertex2f(last_click_start_sx + rme::TileSize, last_click_end_sy - rme::TileSize); - glVertex2f(last_click_start_sx + rme::TileSize, last_click_start_sy + rme::TileSize); - glVertex2f(last_click_start_sx, last_click_start_sy + rme::TileSize); - } + if (delta_y > rme::TileSize) { + glVertex2f(last_click_start_sx, last_click_end_sy - rme::TileSize); + glVertex2f(last_click_start_sx + rme::TileSize, last_click_end_sy - rme::TileSize); + glVertex2f(last_click_start_sx + rme::TileSize, last_click_start_sy + rme::TileSize); + glVertex2f(last_click_start_sx, last_click_start_sy + rme::TileSize); + } - if(delta_x > rme::TileSize && delta_y > rme::TileSize) { - glVertex2f(last_click_end_sx - rme::TileSize, last_click_start_sy + rme::TileSize); - glVertex2f(last_click_end_sx, last_click_start_sy + rme::TileSize); - glVertex2f(last_click_end_sx, last_click_end_sy - rme::TileSize); - glVertex2f(last_click_end_sx - rme::TileSize, last_click_end_sy - rme::TileSize); - } + if (delta_x > rme::TileSize && delta_y > rme::TileSize) { + glVertex2f(last_click_end_sx - rme::TileSize, last_click_start_sy + rme::TileSize); + glVertex2f(last_click_end_sx, last_click_start_sy + rme::TileSize); + glVertex2f(last_click_end_sx, last_click_end_sy - rme::TileSize); + glVertex2f(last_click_end_sx - rme::TileSize, last_click_end_sy - rme::TileSize); + } - if(delta_y > rme::TileSize) { - glVertex2f(last_click_start_sx, last_click_end_sy - rme::TileSize); - glVertex2f(last_click_end_sx, last_click_end_sy - rme::TileSize); - glVertex2f(last_click_end_sx, last_click_end_sy); - glVertex2f(last_click_start_sx, last_click_end_sy); - } + if (delta_y > rme::TileSize) { + glVertex2f(last_click_start_sx, last_click_end_sy - rme::TileSize); + glVertex2f(last_click_end_sx, last_click_end_sy - rme::TileSize); + glVertex2f(last_click_end_sx, last_click_end_sy); + glVertex2f(last_click_start_sx, last_click_end_sy); + } glEnd(); } else { - if(brush->isRaw()) + if (brush->isRaw()) { glEnable(GL_TEXTURE_2D); + } - if(g_gui.GetBrushShape() == BRUSHSHAPE_SQUARE || brush->isSpawnMonster() || brush->isSpawnNpc()) { - if(brush->isRaw() || brush->isOptionalBorder()) { + if (g_gui.GetBrushShape() == BRUSHSHAPE_SQUARE || brush->isSpawnMonster() || brush->isSpawnNpc()) { + if (brush->isRaw() || brush->isOptionalBorder()) { int start_x, end_x; int start_y, end_y; - if(mouse_map_x < canvas->last_click_map_x) { + if (mouse_map_x < canvas->last_click_map_x) { start_x = mouse_map_x; end_x = canvas->last_click_map_x; } else { start_x = canvas->last_click_map_x; end_x = mouse_map_x; } - if(mouse_map_y < canvas->last_click_map_y) { + if (mouse_map_y < canvas->last_click_map_y) { start_y = mouse_map_y; end_y = canvas->last_click_map_y; } else { @@ -858,24 +864,26 @@ void MapDrawer::DrawBrush() } RAWBrush* raw_brush = nullptr; - if(brush->isRaw()) + if (brush->isRaw()) { raw_brush = brush->asRaw(); + } - for(int y = start_y; y <= end_y; y++) { + for (int y = start_y; y <= end_y; y++) { int cy = y * rme::TileSize - view_scroll_y - adjustment; - for(int x = start_x; x <= end_x; x++) { + for (int x = start_x; x <= end_x; x++) { int cx = x * rme::TileSize - view_scroll_x - adjustment; - if(brush->isOptionalBorder()) + if (brush->isOptionalBorder()) { glColorCheck(brush, Position(x, y, floor)); - else + } else { BlitSpriteType(cx, cy, raw_brush->getItemType()->sprite, 160, 160, 160, 160); + } } } } else { int last_click_start_map_x = std::min(canvas->last_click_map_x, mouse_map_x); int last_click_start_map_y = std::min(canvas->last_click_map_y, mouse_map_y); - int last_click_end_map_x = std::max(canvas->last_click_map_x, mouse_map_x)+1; - int last_click_end_map_y = std::max(canvas->last_click_map_y, mouse_map_y)+1; + int last_click_end_map_x = std::max(canvas->last_click_map_x, mouse_map_x) + 1; + int last_click_end_map_y = std::max(canvas->last_click_map_y, mouse_map_y) + 1; int last_click_start_sx = last_click_start_map_x * rme::TileSize - view_scroll_x - adjustment; int last_click_start_sy = last_click_start_map_y * rme::TileSize - view_scroll_y - adjustment; @@ -884,22 +892,22 @@ void MapDrawer::DrawBrush() glColor(brushColor); glBegin(GL_QUADS); - glVertex2f(last_click_start_sx, last_click_start_sy); - glVertex2f(last_click_end_sx, last_click_start_sy); - glVertex2f(last_click_end_sx, last_click_end_sy); - glVertex2f(last_click_start_sx, last_click_end_sy); + glVertex2f(last_click_start_sx, last_click_start_sy); + glVertex2f(last_click_end_sx, last_click_start_sy); + glVertex2f(last_click_end_sx, last_click_end_sy); + glVertex2f(last_click_start_sx, last_click_end_sy); glEnd(); } - } else if(g_gui.GetBrushShape() == BRUSHSHAPE_CIRCLE) { + } else if (g_gui.GetBrushShape() == BRUSHSHAPE_CIRCLE) { // Calculate drawing offsets int start_x, end_x; int start_y, end_y; int width = std::max( std::abs(std::max(mouse_map_y, canvas->last_click_map_y) - std::min(mouse_map_y, canvas->last_click_map_y)), std::abs(std::max(mouse_map_x, canvas->last_click_map_x) - std::min(mouse_map_x, canvas->last_click_map_x)) - ); + ); - if(mouse_map_x < canvas->last_click_map_x) { + if (mouse_map_x < canvas->last_click_map_x) { start_x = canvas->last_click_map_x - width; end_x = canvas->last_click_map_x; } else { @@ -907,7 +915,7 @@ void MapDrawer::DrawBrush() end_x = canvas->last_click_map_x + width; } - if(mouse_map_y < canvas->last_click_map_y) { + if (mouse_map_y < canvas->last_click_map_y) { start_y = canvas->last_click_map_y - width; end_y = canvas->last_click_map_y; } else { @@ -920,28 +928,29 @@ void MapDrawer::DrawBrush() float radii = width / 2.0f + 0.005f; RAWBrush* raw_brush = nullptr; - if(brush->isRaw()) + if (brush->isRaw()) { raw_brush = brush->asRaw(); + } - for(int y = start_y-1; y <= end_y+1; y++) { + for (int y = start_y - 1; y <= end_y + 1; y++) { int cy = y * rme::TileSize - view_scroll_y - adjustment; float dy = center_y - y; - for(int x = start_x-1; x <= end_x+1; x++) { + for (int x = start_x - 1; x <= end_x + 1; x++) { int cx = x * rme::TileSize - view_scroll_x - adjustment; float dx = center_x - x; - //printf("%f;%f\n", dx, dy); - float distance = sqrt(dx*dx + dy*dy); - if(distance < radii) { - if(brush->isRaw()) { + // printf("%f;%f\n", dx, dy); + float distance = sqrt(dx * dx + dy * dy); + if (distance < radii) { + if (brush->isRaw()) { BlitSpriteType(cx, cy, raw_brush->getItemType()->sprite, 160, 160, 160, 160); } else { glColor(brushColor); glBegin(GL_QUADS); - glVertex2f(cx, cy + rme::TileSize); - glVertex2f(cx + rme::TileSize, cy + rme::TileSize); - glVertex2f(cx + rme::TileSize, cy); - glVertex2f(cx, cy); + glVertex2f(cx, cy + rme::TileSize); + glVertex2f(cx + rme::TileSize, cy + rme::TileSize); + glVertex2f(cx + rme::TileSize, cy); + glVertex2f(cx, cy); glEnd(); } } @@ -949,15 +958,16 @@ void MapDrawer::DrawBrush() } } - if(brush->isRaw()) + if (brush->isRaw()) { glDisable(GL_TEXTURE_2D); + } } } else { - if(brush->isWall()) { + if (brush->isWall()) { int start_map_x = mouse_map_x - g_gui.GetBrushSize(); int start_map_y = mouse_map_y - g_gui.GetBrushSize(); - int end_map_x = mouse_map_x + g_gui.GetBrushSize() + 1; - int end_map_y = mouse_map_y + g_gui.GetBrushSize() + 1; + int end_map_x = mouse_map_x + g_gui.GetBrushSize() + 1; + int end_map_y = mouse_map_y + g_gui.GetBrushSize() + 1; int start_sx = start_map_x * rme::TileSize - view_scroll_x - adjustment; int start_sy = start_map_y * rme::TileSize - view_scroll_y - adjustment; @@ -969,123 +979,127 @@ void MapDrawer::DrawBrush() glColor(brushColor); glBegin(GL_QUADS); - { - glVertex2f(start_sx, start_sy + rme::TileSize); - glVertex2f(end_sx, start_sy + rme::TileSize); - glVertex2f(end_sx, start_sy); - glVertex2f(start_sx, start_sy); - } + { + glVertex2f(start_sx, start_sy + rme::TileSize); + glVertex2f(end_sx, start_sy + rme::TileSize); + glVertex2f(end_sx, start_sy); + glVertex2f(start_sx, start_sy); + } - if(delta_y > rme::TileSize) { - glVertex2f(start_sx, end_sy - rme::TileSize); - glVertex2f(start_sx + rme::TileSize, end_sy - rme::TileSize); - glVertex2f(start_sx + rme::TileSize, start_sy + rme::TileSize); - glVertex2f(start_sx, start_sy + rme::TileSize); - } + if (delta_y > rme::TileSize) { + glVertex2f(start_sx, end_sy - rme::TileSize); + glVertex2f(start_sx + rme::TileSize, end_sy - rme::TileSize); + glVertex2f(start_sx + rme::TileSize, start_sy + rme::TileSize); + glVertex2f(start_sx, start_sy + rme::TileSize); + } - if(delta_x > rme::TileSize && delta_y > rme::TileSize) { - glVertex2f(end_sx - rme::TileSize, start_sy + rme::TileSize); - glVertex2f(end_sx, start_sy + rme::TileSize); - glVertex2f(end_sx, end_sy - rme::TileSize); - glVertex2f(end_sx - rme::TileSize, end_sy - rme::TileSize); - } + if (delta_x > rme::TileSize && delta_y > rme::TileSize) { + glVertex2f(end_sx - rme::TileSize, start_sy + rme::TileSize); + glVertex2f(end_sx, start_sy + rme::TileSize); + glVertex2f(end_sx, end_sy - rme::TileSize); + glVertex2f(end_sx - rme::TileSize, end_sy - rme::TileSize); + } - if(delta_y > rme::TileSize) { - glVertex2f(start_sx, end_sy - rme::TileSize); - glVertex2f(end_sx, end_sy - rme::TileSize); - glVertex2f(end_sx, end_sy); - glVertex2f(start_sx, end_sy); - } + if (delta_y > rme::TileSize) { + glVertex2f(start_sx, end_sy - rme::TileSize); + glVertex2f(end_sx, end_sy - rme::TileSize); + glVertex2f(end_sx, end_sy); + glVertex2f(start_sx, end_sy); + } glEnd(); - } else if(brush->isDoor()) { - int cx = (mouse_map_x) * rme::TileSize - view_scroll_x - adjustment; - int cy = (mouse_map_y) * rme::TileSize - view_scroll_y - adjustment; + } else if (brush->isDoor()) { + int cx = (mouse_map_x)*rme::TileSize - view_scroll_x - adjustment; + int cy = (mouse_map_y)*rme::TileSize - view_scroll_y - adjustment; glColorCheck(brush, Position(mouse_map_x, mouse_map_y, floor)); glBegin(GL_QUADS); - glVertex2f(cx, cy + rme::TileSize); - glVertex2f(cx + rme::TileSize, cy + rme::TileSize); - glVertex2f(cx + rme::TileSize, cy); - glVertex2f(cx, cy); + glVertex2f(cx, cy + rme::TileSize); + glVertex2f(cx + rme::TileSize, cy + rme::TileSize); + glVertex2f(cx + rme::TileSize, cy); + glVertex2f(cx, cy); glEnd(); - } else if(brush->isMonster()) { + } else if (brush->isMonster()) { glEnable(GL_TEXTURE_2D); - int cy = (mouse_map_y) * rme::TileSize - view_scroll_y - adjustment; - int cx = (mouse_map_x) * rme::TileSize - view_scroll_x - adjustment; + int cy = (mouse_map_y)*rme::TileSize - view_scroll_y - adjustment; + int cx = (mouse_map_x)*rme::TileSize - view_scroll_x - adjustment; MonsterBrush* monster_brush = brush->asMonster(); - if(monster_brush->canDraw(&editor.getMap(), Position(mouse_map_x, mouse_map_y, floor))) + if (monster_brush->canDraw(&editor.getMap(), Position(mouse_map_x, mouse_map_y, floor))) { BlitCreature(cx, cy, monster_brush->getType()->outfit, SOUTH, 255, 255, 255, 160); - else + } else { BlitCreature(cx, cy, monster_brush->getType()->outfit, SOUTH, 255, 64, 64, 160); + } glDisable(GL_TEXTURE_2D); - } else if(brush->isNpc()) { + } else if (brush->isNpc()) { glEnable(GL_TEXTURE_2D); - int cy = (mouse_map_y) * rme::TileSize - view_scroll_y - getFloorAdjustment(floor); - int cx = (mouse_map_x) * rme::TileSize - view_scroll_x - getFloorAdjustment(floor); + int cy = (mouse_map_y)*rme::TileSize - view_scroll_y - getFloorAdjustment(floor); + int cx = (mouse_map_x)*rme::TileSize - view_scroll_x - getFloorAdjustment(floor); NpcBrush* npcBrush = brush->asNpc(); - if(npcBrush->canDraw(&editor.getMap(), Position(mouse_map_x, mouse_map_y, floor))) + if (npcBrush->canDraw(&editor.getMap(), Position(mouse_map_x, mouse_map_y, floor))) { BlitCreature(cx, cy, npcBrush->getType()->outfit, SOUTH, 255, 255, 255, 160); - else + } else { BlitCreature(cx, cy, npcBrush->getType()->outfit, SOUTH, 255, 64, 64, 160); + } glDisable(GL_TEXTURE_2D); - } else if(!brush->isDoodad()) { + } else if (!brush->isDoodad()) { RAWBrush* raw_brush = nullptr; - if(brush->isRaw()) { // Textured brush + if (brush->isRaw()) { // Textured brush glEnable(GL_TEXTURE_2D); raw_brush = brush->asRaw(); } else { glDisable(GL_TEXTURE_2D); } - for(int y = -g_gui.GetBrushSize()-1; y <= g_gui.GetBrushSize()+1; y++) { + for (int y = -g_gui.GetBrushSize() - 1; y <= g_gui.GetBrushSize() + 1; y++) { int cy = (mouse_map_y + y) * rme::TileSize - view_scroll_y - adjustment; - for(int x = -g_gui.GetBrushSize()-1; x <= g_gui.GetBrushSize()+1; x++) { + for (int x = -g_gui.GetBrushSize() - 1; x <= g_gui.GetBrushSize() + 1; x++) { int cx = (mouse_map_x + x) * rme::TileSize - view_scroll_x - adjustment; - if(g_gui.GetBrushShape() == BRUSHSHAPE_SQUARE) { - if(x >= -g_gui.GetBrushSize() && x <= g_gui.GetBrushSize() && y >= -g_gui.GetBrushSize() && y <= g_gui.GetBrushSize()) { - if(brush->isRaw()) { + if (g_gui.GetBrushShape() == BRUSHSHAPE_SQUARE) { + if (x >= -g_gui.GetBrushSize() && x <= g_gui.GetBrushSize() && y >= -g_gui.GetBrushSize() && y <= g_gui.GetBrushSize()) { + if (brush->isRaw()) { BlitSpriteType(cx, cy, raw_brush->getItemType()->sprite, 160, 160, 160, 160); } else { - if(brush->isWaypoint()) { + if (brush->isWaypoint()) { uint8_t r, g, b; getColor(brush, Position(mouse_map_x + x, mouse_map_y + y, floor), r, g, b); DrawBrushIndicator(cx, cy, brush, r, g, b); } else { - if(brush->isHouseExit() || brush->isOptionalBorder()) + if (brush->isHouseExit() || brush->isOptionalBorder()) { glColorCheck(brush, Position(mouse_map_x + x, mouse_map_y + y, floor)); - else + } else { glColor(brushColor); + } glBegin(GL_QUADS); - glVertex2f(cx, cy + rme::TileSize); - glVertex2f(cx + rme::TileSize, cy + rme::TileSize); - glVertex2f(cx + rme::TileSize, cy); - glVertex2f(cx, cy); + glVertex2f(cx, cy + rme::TileSize); + glVertex2f(cx + rme::TileSize, cy + rme::TileSize); + glVertex2f(cx + rme::TileSize, cy); + glVertex2f(cx, cy); glEnd(); } } } - } else if(g_gui.GetBrushShape() == BRUSHSHAPE_CIRCLE) { - double distance = sqrt(double(x*x) + double(y*y)); - if(distance < g_gui.GetBrushSize()+0.005) { - if(brush->isRaw()) { + } else if (g_gui.GetBrushShape() == BRUSHSHAPE_CIRCLE) { + double distance = sqrt(double(x * x) + double(y * y)); + if (distance < g_gui.GetBrushSize() + 0.005) { + if (brush->isRaw()) { BlitSpriteType(cx, cy, raw_brush->getItemType()->sprite, 160, 160, 160, 160); } else { - if(brush->isWaypoint()) { + if (brush->isWaypoint()) { uint8_t r, g, b; getColor(brush, Position(mouse_map_x + x, mouse_map_y + y, floor), r, g, b); DrawBrushIndicator(cx, cy, brush, r, g, b); } else { - if(brush->isHouseExit() || brush->isOptionalBorder()) + if (brush->isHouseExit() || brush->isOptionalBorder()) { glColorCheck(brush, Position(mouse_map_x + x, mouse_map_y + y, floor)); - else + } else { glColor(brushColor); + } glBegin(GL_QUADS); - glVertex2f(cx, cy + rme::TileSize); - glVertex2f(cx + rme::TileSize, cy + rme::TileSize); - glVertex2f(cx + rme::TileSize, cy); - glVertex2f(cx, cy); + glVertex2f(cx, cy + rme::TileSize); + glVertex2f(cx + rme::TileSize, cy + rme::TileSize); + glVertex2f(cx + rme::TileSize, cy); + glVertex2f(cx, cy); glEnd(); } } @@ -1094,7 +1108,7 @@ void MapDrawer::DrawBrush() } } - if(brush->isRaw()) { // Textured brush + if (brush->isRaw()) { // Textured brush glDisable(GL_TEXTURE_2D); } else { glEnable(GL_TEXTURE_2D); @@ -1103,47 +1117,49 @@ void MapDrawer::DrawBrush() } } -void MapDrawer::BlitItem(int& draw_x, int& draw_y, const Tile* tile, const Item* item, bool ephemeral, int red, int green, int blue, int alpha) -{ - const ItemType& type = g_items.getItemType(item->getID()); - if(type.id == 0) { +void MapDrawer::BlitItem(int &draw_x, int &draw_y, const Tile* tile, const Item* item, bool ephemeral, int red, int green, int blue, int alpha) { + const ItemType &type = g_items.getItemType(item->getID()); + if (type.id == 0) { glDisable(GL_TEXTURE_2D); glBlitSquare(draw_x, draw_y, *wxRED); glEnable(GL_TEXTURE_2D); return; } - if(!options.ingame && !ephemeral && item->isSelected()) { + if (!options.ingame && !ephemeral && item->isSelected()) { red /= 2; blue /= 2; green /= 2; } // Ugly hacks. :) - if(type.id == ITEM_STAIRS && !options.ingame) { + if (type.id == ITEM_STAIRS && !options.ingame) { glDisable(GL_TEXTURE_2D); - glBlitSquare(draw_x, draw_y, red, green, 0, alpha/3*2); + glBlitSquare(draw_x, draw_y, red, green, 0, alpha / 3 * 2); glEnable(GL_TEXTURE_2D); return; - } else if(type.id == ITEM_NOTHING_SPECIAL && !options.ingame) { + } else if (type.id == ITEM_NOTHING_SPECIAL && !options.ingame) { glDisable(GL_TEXTURE_2D); - glBlitSquare(draw_x, draw_y, red, 0, 0, alpha/3*2); + glBlitSquare(draw_x, draw_y, red, 0, 0, alpha / 3 * 2); glEnable(GL_TEXTURE_2D); return; } - if(type.isMetaItem()) + if (type.isMetaItem()) { return; - if(!ephemeral && type.pickupable && !options.show_items) + } + if (!ephemeral && type.pickupable && !options.show_items) { return; + } GameSprite* sprite = type.sprite; - if(!sprite) + if (!sprite) { return; + } int screenx = draw_x - sprite->getDrawOffset().x; int screeny = draw_y - sprite->getDrawOffset().y; - const Position& pos = tile->getPosition(); + const Position &pos = tile->getPosition(); // Set the newd drawing height accordingly draw_x -= sprite->getDrawHeight(); @@ -1155,95 +1171,89 @@ void MapDrawer::BlitItem(int& draw_x, int& draw_y, const Tile* tile, const Item* int pattern_y = pos.y % sprite->pattern_y; int pattern_z = pos.z % sprite->pattern_z; - if(type.isSplash() || type.isFluidContainer()) { + if (type.isSplash() || type.isFluidContainer()) { subtype = item->getSubtype(); - } else if(type.isHangable) { - if(tile->hasProperty(HOOK_SOUTH)) { + } else if (type.isHangable) { + if (tile->hasProperty(HOOK_SOUTH)) { pattern_x = 1; - } else if(tile->hasProperty(HOOK_EAST)) { + } else if (tile->hasProperty(HOOK_EAST)) { pattern_x = 2; } else { pattern_x = 0; } - } else if(type.stackable) { - if(item->getSubtype() <= 1) + } else if (type.stackable) { + if (item->getSubtype() <= 1) { subtype = 0; - else if(item->getSubtype() <= 2) + } else if (item->getSubtype() <= 2) { subtype = 1; - else if(item->getSubtype() <= 3) + } else if (item->getSubtype() <= 3) { subtype = 2; - else if(item->getSubtype() <= 4) + } else if (item->getSubtype() <= 4) { subtype = 3; - else if(item->getSubtype() < 10) + } else if (item->getSubtype() < 10) { subtype = 4; - else if(item->getSubtype() < 25) + } else if (item->getSubtype() < 25) { subtype = 5; - else if(item->getSubtype() < 50) + } else if (item->getSubtype() < 50) { subtype = 6; - else + } else { subtype = 7; + } } - if(!ephemeral && options.transparent_items && - (!type.isGroundTile() || sprite->width > 1 || sprite->height > 1) && - !type.isSplash() && - (!type.isBorder || sprite->width > 1 || sprite->height > 1) - ) - { + if (!ephemeral && options.transparent_items && (!type.isGroundTile() || sprite->width > 1 || sprite->height > 1) && !type.isSplash() && (!type.isBorder || sprite->width > 1 || sprite->height > 1)) { alpha /= 2; } int frame = item->getFrame(); - for(int cx = 0; cx != sprite->width; cx++) { - for(int cy = 0; cy != sprite->height; cy++) { - for(int cf = 0; cf != sprite->layers; cf++) { - int texnum = sprite->getHardwareID(cx,cy,cf, - subtype, - pattern_x, - pattern_y, - pattern_z, - frame - ); + for (int cx = 0; cx != sprite->width; cx++) { + for (int cy = 0; cy != sprite->height; cy++) { + for (int cf = 0; cf != sprite->layers; cf++) { + int texnum = sprite->getHardwareID(cx, cy, cf, subtype, pattern_x, pattern_y, pattern_z, frame); glBlitTexture(screenx - cx * rme::TileSize, screeny - cy * rme::TileSize, texnum, red, green, blue, alpha); } } } - if(options.show_hooks && (type.hookSouth || type.hookEast)) + if (options.show_hooks && (type.hookSouth || type.hookEast)) { DrawHookIndicator(draw_x, draw_y, type); + } } -void MapDrawer::BlitItem(int& draw_x, int& draw_y, const Position& pos, const Item* item, bool ephemeral, int red, int green, int blue, int alpha) -{ - const ItemType& type = g_items.getItemType(item->getID()); - if(type.id == 0) +void MapDrawer::BlitItem(int &draw_x, int &draw_y, const Position &pos, const Item* item, bool ephemeral, int red, int green, int blue, int alpha) { + const ItemType &type = g_items.getItemType(item->getID()); + if (type.id == 0) { return; + } - if(!options.ingame && !ephemeral && item->isSelected()) { + if (!options.ingame && !ephemeral && item->isSelected()) { red /= 2; blue /= 2; green /= 2; } - if(type.id == ITEM_STAIRS && !options.ingame) { // Ugly hack yes? + if (type.id == ITEM_STAIRS && !options.ingame) { // Ugly hack yes? glDisable(GL_TEXTURE_2D); - glBlitSquare(draw_x, draw_y, red, green, 0, alpha/3*2); + glBlitSquare(draw_x, draw_y, red, green, 0, alpha / 3 * 2); glEnable(GL_TEXTURE_2D); return; - } else if(type.id == ITEM_NOTHING_SPECIAL && !options.ingame) { // Ugly hack yes? + } else if (type.id == ITEM_NOTHING_SPECIAL && !options.ingame) { // Ugly hack yes? glDisable(GL_TEXTURE_2D); - glBlitSquare(draw_x, draw_y, red, 0, 0, alpha/3*2); + glBlitSquare(draw_x, draw_y, red, 0, 0, alpha / 3 * 2); glEnable(GL_TEXTURE_2D); return; } - if(type.isMetaItem()) + if (type.isMetaItem()) { return; - if(!ephemeral && type.pickupable && options.show_items) + } + if (!ephemeral && type.pickupable && options.show_items) { return; + } GameSprite* sprite = type.sprite; - if(!sprite) + if (!sprite) { return; + } int screenx = draw_x - sprite->getDrawOffset().x; int screeny = draw_y - sprite->getDrawOffset().y; @@ -1258,9 +1268,9 @@ void MapDrawer::BlitItem(int& draw_x, int& draw_y, const Position& pos, const It int pattern_y = pos.y % sprite->pattern_y; int pattern_z = pos.z % sprite->pattern_z; - if(type.isSplash() || type.isFluidContainer()) { + if (type.isSplash() || type.isFluidContainer()) { subtype = item->getSubtype(); - } else if(type.isHangable) { + } else if (type.isHangable) { pattern_x = 0; /* if(tile->hasProperty(HOOK_SOUTH)) { @@ -1271,104 +1281,96 @@ void MapDrawer::BlitItem(int& draw_x, int& draw_y, const Position& pos, const It pattern_x = -0; } */ - } else if(type.stackable) { - if(item->getSubtype() <= 1) + } else if (type.stackable) { + if (item->getSubtype() <= 1) { subtype = 0; - else if(item->getSubtype() <= 2) + } else if (item->getSubtype() <= 2) { subtype = 1; - else if(item->getSubtype() <= 3) + } else if (item->getSubtype() <= 3) { subtype = 2; - else if(item->getSubtype() <= 4) + } else if (item->getSubtype() <= 4) { subtype = 3; - else if(item->getSubtype() < 10) + } else if (item->getSubtype() < 10) { subtype = 4; - else if(item->getSubtype() < 25) + } else if (item->getSubtype() < 25) { subtype = 5; - else if(item->getSubtype() < 50) + } else if (item->getSubtype() < 50) { subtype = 6; - else + } else { subtype = 7; + } } - if(!ephemeral && options.transparent_items && - (!type.isGroundTile() || sprite->width > 1 || sprite->height > 1) && - !type.isSplash() && - (!type.isBorder || sprite->width > 1 || sprite->height > 1) - ) - { + if (!ephemeral && options.transparent_items && (!type.isGroundTile() || sprite->width > 1 || sprite->height > 1) && !type.isSplash() && (!type.isBorder || sprite->width > 1 || sprite->height > 1)) { alpha /= 2; } int frame = item->getFrame(); - for(int cx = 0; cx != sprite->width; ++cx) { - for(int cy = 0; cy != sprite->height; ++cy) { - for(int cf = 0; cf != sprite->layers; ++cf) { - int texnum = sprite->getHardwareID(cx,cy,cf, - subtype, - pattern_x, - pattern_y, - pattern_z, - frame - ); + for (int cx = 0; cx != sprite->width; ++cx) { + for (int cy = 0; cy != sprite->height; ++cy) { + for (int cf = 0; cf != sprite->layers; ++cf) { + int texnum = sprite->getHardwareID(cx, cy, cf, subtype, pattern_x, pattern_y, pattern_z, frame); glBlitTexture(screenx - cx * rme::TileSize, screeny - cy * rme::TileSize, texnum, red, green, blue, alpha); } } } - if(options.show_hooks && (type.hookSouth || type.hookEast) && zoom <= 3.0) + if (options.show_hooks && (type.hookSouth || type.hookEast) && zoom <= 3.0) { DrawHookIndicator(draw_x, draw_y, type); + } } -void MapDrawer::BlitSpriteType(int screenx, int screeny, uint32_t spriteid, int red, int green, int blue, int alpha) -{ - const ItemType& type = g_items.getItemType(spriteid); - if(type.id == 0) +void MapDrawer::BlitSpriteType(int screenx, int screeny, uint32_t spriteid, int red, int green, int blue, int alpha) { + const ItemType &type = g_items.getItemType(spriteid); + if (type.id == 0) { return; + } GameSprite* sprite = type.sprite; - if(!sprite) + if (!sprite) { return; + } screenx -= sprite->getDrawOffset().x; screeny -= sprite->getDrawOffset().y; int frame = 0; - for(int cx = 0; cx != sprite->width; ++cx) { - for(int cy = 0; cy != sprite->height; ++cy) { - for(int cf = 0; cf != sprite->layers; ++cf) { - int texnum = sprite->getHardwareID(cx,cy,cf,-1,0,0,0, frame); + for (int cx = 0; cx != sprite->width; ++cx) { + for (int cy = 0; cy != sprite->height; ++cy) { + for (int cf = 0; cf != sprite->layers; ++cf) { + int texnum = sprite->getHardwareID(cx, cy, cf, -1, 0, 0, 0, frame); glBlitTexture(screenx - cx * rme::TileSize, screeny - cy * rme::TileSize, texnum, red, green, blue, alpha); } } } } -void MapDrawer::BlitSpriteType(int screenx, int screeny, GameSprite* sprite, int red, int green, int blue, int alpha) -{ - if(!sprite) return; +void MapDrawer::BlitSpriteType(int screenx, int screeny, GameSprite* sprite, int red, int green, int blue, int alpha) { + if (!sprite) { + return; + } screenx -= sprite->getDrawOffset().x; screeny -= sprite->getDrawOffset().y; int frame = 0; - for(int cx = 0; cx != sprite->width; ++cx) { - for(int cy = 0; cy != sprite->height; ++cy) { - for(int cf = 0; cf != sprite->layers; ++cf) { - int texnum = sprite->getHardwareID(cx,cy,cf,-1,0,0,0, frame); + for (int cx = 0; cx != sprite->width; ++cx) { + for (int cy = 0; cy != sprite->height; ++cy) { + for (int cf = 0; cf != sprite->layers; ++cf) { + int texnum = sprite->getHardwareID(cx, cy, cf, -1, 0, 0, 0, frame); glBlitTexture(screenx - cx * rme::TileSize, screeny - cy * rme::TileSize, texnum, red, green, blue, alpha); } } } } -void MapDrawer::BlitCreature(int screenx, int screeny, const Outfit& outfit, Direction dir, int red, int green, int blue, int alpha) -{ - if(outfit.lookItem != 0) { - const ItemType& type = g_items.getItemType(outfit.lookItem); +void MapDrawer::BlitCreature(int screenx, int screeny, const Outfit &outfit, Direction dir, int red, int green, int blue, int alpha) { + if (outfit.lookItem != 0) { + const ItemType &type = g_items.getItemType(outfit.lookItem); BlitSpriteType(screenx, screeny, type.sprite, red, green, blue, alpha); } else { GameSprite* sprite = g_gui.gfx.getCreatureSprite(outfit.lookType); - if(!sprite || outfit.lookType == 0) { + if (!sprite || outfit.lookType == 0) { return; } @@ -1389,14 +1391,15 @@ void MapDrawer::BlitCreature(int screenx, int screeny, const Outfit& outfit, Dir int frame = 0; // pattern_y => creature addon - for(int pattern_y = 0; pattern_y < sprite->pattern_y; pattern_y++) { + for (int pattern_y = 0; pattern_y < sprite->pattern_y; pattern_y++) { // continue if we dont have this addon - if (pattern_y > 0 && !(outfit.lookAddon & (1 << (pattern_y - 1)))) + if (pattern_y > 0 && !(outfit.lookAddon & (1 << (pattern_y - 1)))) { continue; + } - for(int cx = 0; cx != sprite->width; ++cx) { - for(int cy = 0; cy != sprite->height; ++cy) { + for (int cx = 0; cx != sprite->width; ++cx) { + for (int cy = 0; cy != sprite->height; ++cy) { int texnum = sprite->getHardwareID(cx, cy, (int)dir, pattern_y, pattern_z, outfit, frame); glBlitTexture(screenx - cx * rme::TileSize, screeny - cy * rme::TileSize, texnum, red, green, blue, alpha); } @@ -1405,9 +1408,8 @@ void MapDrawer::BlitCreature(int screenx, int screeny, const Outfit& outfit, Dir } } -void MapDrawer::BlitCreature(int screenx, int screeny, const Monster* creature, int red, int green, int blue, int alpha) -{ - if(!options.ingame && creature->isSelected()) { +void MapDrawer::BlitCreature(int screenx, int screeny, const Monster* creature, int red, int green, int blue, int alpha) { + if (!options.ingame && creature->isSelected()) { red /= 2; green /= 2; blue /= 2; @@ -1415,9 +1417,8 @@ void MapDrawer::BlitCreature(int screenx, int screeny, const Monster* creature, BlitCreature(screenx, screeny, creature->getLookType(), creature->getDirection(), red, green, blue, alpha); } // Npcs -void MapDrawer::BlitCreature(int screenx, int screeny, const Npc* npc, int red, int green, int blue, int alpha) -{ - if(!options.ingame && npc->isSelected()) { +void MapDrawer::BlitCreature(int screenx, int screeny, const Npc* npc, int red, int green, int blue, int alpha) { + if (!options.ingame && npc->isSelected()) { red /= 2; green /= 2; blue /= 2; @@ -1425,57 +1426,69 @@ void MapDrawer::BlitCreature(int screenx, int screeny, const Npc* npc, int red, BlitCreature(screenx, screeny, npc->getLookType(), npc->getDirection(), red, green, blue, alpha); } -void MapDrawer::WriteTooltip(const Item* item, std::ostringstream& stream) -{ - if(!item) return; +void MapDrawer::WriteTooltip(const Item* item, std::ostringstream &stream) { + if (!item) { + return; + } const uint16_t id = item->getID(); - if(id < 100) + if (id < 100) { return; + } const uint16_t unique = item->getUniqueID(); const uint16_t action = item->getActionID(); - const std::string& text = item->getText(); - if(unique == 0 && action == 0 && text.empty()) + const std::string &text = item->getText(); + if (unique == 0 && action == 0 && text.empty()) { return; + } - if(stream.tellp() > 0) + if (stream.tellp() > 0) { stream << "\n"; + } stream << "id: " << id << "\n"; - if (action > 0) + if (action > 0) { stream << "aid: " << action << "\n"; - if(unique > 0) + } + if (unique > 0) { stream << "uid: " << unique << "\n"; - if(!text.empty()) + } + if (!text.empty()) { stream << "text: " << text << "\n"; + } } -void MapDrawer::WriteTooltip(const Waypoint* waypoint, std::ostringstream& stream) -{ - if (stream.tellp() > 0) +void MapDrawer::WriteTooltip(const Waypoint* waypoint, std::ostringstream &stream) { + if (stream.tellp() > 0) { stream << "\n"; + } stream << "wp: " << waypoint->name << "\n"; } -void MapDrawer::DrawTile(TileLocation* location) -{ - if(!location) return; +void MapDrawer::DrawTile(TileLocation* location) { + if (!location) { + return; + } Tile* tile = location->get(); - if(!tile) return; + if (!tile) { + return; + } - if(options.show_only_modified && !tile->isModified()) + if (options.show_only_modified && !tile->isModified()) { return; + } - const Position& position = location->getPosition(); + const Position &position = location->getPosition(); bool show_tooltips = options.isTooltips(); - if(show_tooltips && location->getWaypointCount() > 0) { + if (show_tooltips && location->getWaypointCount() > 0) { Waypoint* waypoint = canvas->editor.getMap().waypoints.getWaypoint(position); - if(waypoint) + if (waypoint) { WriteTooltip(waypoint, tooltip); + } } bool only_colors = options.isOnlyColors(); @@ -1483,101 +1496,104 @@ void MapDrawer::DrawTile(TileLocation* location) int draw_x, draw_y; getDrawPosition(position, draw_x, draw_y); - uint8_t r = 255,g = 255,b = 255; - if(only_colors || tile->hasGround()) { + uint8_t r = 255, g = 255, b = 255; + if (only_colors || tile->hasGround()) { - if(!options.show_as_minimap) { + if (!options.show_as_minimap) { bool showspecial = options.show_only_colors || options.show_special_tiles; - if(options.show_blocking && tile->isBlocking() && tile->size() > 0) { + if (options.show_blocking && tile->isBlocking() && tile->size() > 0) { g = g / 3 * 2; b = b / 3 * 2; } int item_count = tile->items.size(); - if(options.highlight_items && item_count > 0 && !tile->items.back()->isBorder()) { + if (options.highlight_items && item_count > 0 && !tile->items.back()->isBorder()) { static const float factor[5] = { 0.75f, 0.6f, 0.48f, 0.40f, 0.33f }; int idx = (item_count < 5 ? item_count : 5) - 1; g = int(g * factor[idx]); r = int(r * factor[idx]); } - if(options.show_spawns_monster && location->getSpawnMonsterCount() > 0) { + if (options.show_spawns_monster && location->getSpawnMonsterCount() > 0) { float f = 1.0f; - for(uint32_t i = 0; i < location->getSpawnMonsterCount(); ++i) { + for (uint32_t i = 0; i < location->getSpawnMonsterCount(); ++i) { f *= 0.7f; } g = uint8_t(g * f); b = uint8_t(b * f); } - if(options.show_spawns_npc && location->getSpawnNpcCount() > 0) { + if (options.show_spawns_npc && location->getSpawnNpcCount() > 0) { float f = 1.0f; - for(uint32_t i = 0; i < location->getSpawnNpcCount(); ++i) { + for (uint32_t i = 0; i < location->getSpawnNpcCount(); ++i) { f *= 0.7f; } g = uint8_t(g * f); b = uint8_t(b * f); } - if(options.show_houses && tile->isHouseTile()) { - if((int)tile->getHouseID() == current_house_id) { + if (options.show_houses && tile->isHouseTile()) { + if ((int)tile->getHouseID() == current_house_id) { r /= 2; } else { r /= 2; g /= 2; } - } - else if(showspecial && tile->isPZ()) { + } else if (showspecial && tile->isPZ()) { r /= 2; b /= 2; } - if(showspecial && tile->getMapFlags() & TILESTATE_PVPZONE) { + if (showspecial && tile->getMapFlags() & TILESTATE_PVPZONE) { g = r / 4; b = b / 3 * 2; } - if(showspecial && tile->getMapFlags() & TILESTATE_NOLOGOUT) { + if (showspecial && tile->getMapFlags() & TILESTATE_NOLOGOUT) { b /= 2; } - if(showspecial && tile->getMapFlags() & TILESTATE_NOPVP) { + if (showspecial && tile->getMapFlags() & TILESTATE_NOPVP) { g /= 2; } } - if(only_colors) { + if (only_colors) { glDisable(GL_TEXTURE_2D); - if(options.show_as_minimap) { + if (options.show_as_minimap) { wxColor color = colorFromEightBit(tile->getMiniMapColor()); glBlitSquare(draw_x, draw_y, color); - } else if(r != 255 || g != 255 || b != 255) { + } else if (r != 255 || g != 255 || b != 255) { glBlitSquare(draw_x, draw_y, r, g, b, 128); } glEnable(GL_TEXTURE_2D); } else { - if(options.show_preview && zoom <= 2.0) + if (options.show_preview && zoom <= 2.0) { tile->ground->animate(); + } BlitItem(draw_x, draw_y, tile, tile->ground, false, r, g, b); } - if(show_tooltips && position.z == floor) + if (show_tooltips && position.z == floor) { WriteTooltip(tile->ground, tooltip); + } } bool hidden = only_colors || (options.hide_items_when_zoomed && zoom > 10.f); - if(!hidden && !tile->items.empty()) { - for(Item* item : tile->items) { - if(show_tooltips && position.z == floor) + if (!hidden && !tile->items.empty()) { + for (Item* item : tile->items) { + if (show_tooltips && position.z == floor) { WriteTooltip(item, tooltip); + } - if(options.show_preview && zoom <= 2.0) + if (options.show_preview && zoom <= 2.0) { item->animate(); + } - if(item->isBorder()) { + if (item->isBorder()) { BlitItem(draw_x, draw_y, tile, item, false, r, g, b); } else { BlitItem(draw_x, draw_y, tile, item); @@ -1585,25 +1601,25 @@ void MapDrawer::DrawTile(TileLocation* location) } } - if(!hidden && options.show_monsters && tile->monster) { + if (!hidden && options.show_monsters && tile->monster) { BlitCreature(draw_x, draw_y, tile->monster); } - if(!hidden && options.show_npcs && tile->npc) { + if (!hidden && options.show_npcs && tile->npc) { BlitCreature(draw_x, draw_y, tile->npc); } - if(show_tooltips) { - if(location->getWaypointCount() > 0) + if (show_tooltips) { + if (location->getWaypointCount() > 0) { MakeTooltip(draw_x, draw_y, tooltip.str(), 0, 255, 0); - else + } else { MakeTooltip(draw_x, draw_y, tooltip.str()); + } tooltip.str(""); } } -void MapDrawer::DrawBrushIndicator(int x, int y, Brush* brush, uint8_t r, uint8_t g, uint8_t b) -{ +void MapDrawer::DrawBrushIndicator(int x, int y, Brush* brush, uint8_t r, uint8_t g, uint8_t b) { x += (rme::TileSize / 2); y += (rme::TileSize / 2); @@ -1613,22 +1629,22 @@ void MapDrawer::DrawBrushIndicator(int x, int y, Brush* brush, uint8_t r, uint8_ // \/ // 4 static int vertexes[9][2] = { - {-15, -20}, // 0 - { 15, -20}, // 1 - { 15, -5}, // 2 - { 5, -5}, // 3 - { 0, 0}, // 4 - {-5, -5}, // 5 - {-15, -5}, // 6 - {-15, -20}, // 7 - {-15, -20}, // 0 + { -15, -20 }, // 0 + { 15, -20 }, // 1 + { 15, -5 }, // 2 + { 5, -5 }, // 3 + { 0, 0 }, // 4 + { -5, -5 }, // 5 + { -15, -5 }, // 6 + { -15, -20 }, // 7 + { -15, -20 }, // 0 }; // circle glBegin(GL_TRIANGLE_FAN); glColor4ub(0x00, 0x00, 0x00, 0x50); glVertex2i(x, y); - for(int i = 0; i <= 30; i++) { + for (int i = 0; i <= 30; i++) { float angle = i * 2.0f * rme::PI / 30; glVertex2f(cos(angle) * (rme::TileSize / 2) + x, sin(angle) * (rme::TileSize / 2) + y); } @@ -1637,34 +1653,34 @@ void MapDrawer::DrawBrushIndicator(int x, int y, Brush* brush, uint8_t r, uint8_ // background glColor4ub(r, g, b, 0xB4); glBegin(GL_POLYGON); - for(int i = 0; i < 8; ++i) + for (int i = 0; i < 8; ++i) { glVertex2i(vertexes[i][0] + x, vertexes[i][1] + y); + } glEnd(); // borders glColor4ub(0x00, 0x00, 0x00, 0xB4); glLineWidth(1.0); glBegin(GL_LINES); - for(int i = 0; i < 8; ++i) { + for (int i = 0; i < 8; ++i) { glVertex2i(vertexes[i][0] + x, vertexes[i][1] + y); glVertex2i(vertexes[i + 1][0] + x, vertexes[i + 1][1] + y); } glEnd(); } -void MapDrawer::DrawHookIndicator(int x, int y, const ItemType& type) -{ +void MapDrawer::DrawHookIndicator(int x, int y, const ItemType &type) { glDisable(GL_TEXTURE_2D); glColor4ub(uint8_t(0), uint8_t(0), uint8_t(255), uint8_t(200)); glBegin(GL_QUADS); - if(type.hookSouth) { + if (type.hookSouth) { x -= 10; y += 10; glVertex2f(x, y); glVertex2f(x + 10, y); glVertex2f(x + 20, y + 10); glVertex2f(x + 10, y + 10); - } else if(type.hookEast) { + } else if (type.hookEast) { x += 10; y -= 10; glVertex2f(x, y); @@ -1676,74 +1692,75 @@ void MapDrawer::DrawHookIndicator(int x, int y, const ItemType& type) glEnable(GL_TEXTURE_2D); } -void MapDrawer::DrawTileIndicators(TileLocation* location) -{ - if(!location) +void MapDrawer::DrawTileIndicators(TileLocation* location) { + if (!location) { return; + } Tile* tile = location->get(); - if(!tile) + if (!tile) { return; + } int x, y; getDrawPosition(location->getPosition(), x, y); - if(zoom < 10.0 && (options.show_pickupables || options.show_moveables)) { + if (zoom < 10.0 && (options.show_pickupables || options.show_moveables)) { uint8_t red = 0xFF, green = 0xFF, blue = 0xFF; if (tile->isHouseTile()) { green = 0x00; blue = 0x00; } - for(const Item* item : tile->items) { - const ItemType& type = g_items.getItemType(item->getID()); + for (const Item* item : tile->items) { + const ItemType &type = g_items.getItemType(item->getID()); if ((type.pickupable && options.show_pickupables) || (type.moveable && options.show_moveables)) { - if (type.pickupable && options.show_pickupables && type.moveable && options.show_moveables) + if (type.pickupable && options.show_pickupables && type.moveable && options.show_moveables) { DrawIndicator(x, y, EDITOR_SPRITE_PICKUPABLE_MOVEABLE_ITEM, red, green, blue); - else if (type.pickupable && options.show_pickupables) + } else if (type.pickupable && options.show_pickupables) { DrawIndicator(x, y, EDITOR_SPRITE_PICKUPABLE_ITEM, red, green, blue); - else if (type.moveable && options.show_moveables) + } else if (type.moveable && options.show_moveables) { DrawIndicator(x, y, EDITOR_SPRITE_MOVEABLE_ITEM, red, green, blue); + } } } } - if(options.show_houses && tile->isHouseExit()) { - if(tile->hasHouseExit(current_house_id)) { + if (options.show_houses && tile->isHouseExit()) { + if (tile->hasHouseExit(current_house_id)) { DrawIndicator(x, y, EDITOR_SPRITE_HOUSE_EXIT); } else { DrawIndicator(x, y, EDITOR_SPRITE_HOUSE_EXIT, 64, 64, 255, 128); } } - if(options.show_spawns_monster && tile->spawnMonster) { - if(tile->spawnMonster->isSelected()) { + if (options.show_spawns_monster && tile->spawnMonster) { + if (tile->spawnMonster->isSelected()) { DrawIndicator(x, y, EDITOR_SPRITE_SPAWNS, 128, 128, 128); } else { DrawIndicator(x, y, EDITOR_SPRITE_SPAWNS); } } - if(tile->spawnNpc && options.show_spawns_npc) { - if(tile->spawnNpc->isSelected()) { - DrawIndicator(x, y, SPRITE_SPAWN_NPC, 128, 128, 128); - } else { - DrawIndicator(x, y, SPRITE_SPAWN_NPC, 255, 255, 255); - } + if (tile->spawnNpc && options.show_spawns_npc) { + if (tile->spawnNpc->isSelected()) { + DrawIndicator(x, y, SPRITE_SPAWN_NPC, 128, 128, 128); + } else { + DrawIndicator(x, y, SPRITE_SPAWN_NPC, 255, 255, 255); } + } } -void MapDrawer::DrawIndicator(int x, int y, int indicator, uint8_t r, uint8_t g, uint8_t b, uint8_t a) -{ +void MapDrawer::DrawIndicator(int x, int y, int indicator, uint8_t r, uint8_t g, uint8_t b, uint8_t a) { GameSprite* sprite = g_gui.gfx.getEditorSprite(indicator); - if(sprite == nullptr) + if (sprite == nullptr) { return; + } - int textureId = sprite->getHardwareID(0,0,0,-1,0,0,0,0); + int textureId = sprite->getHardwareID(0, 0, 0, -1, 0, 0, 0, 0); glBlitTexture(x, y, textureId, r, g, b, a, true); } -void MapDrawer::DrawPositionIndicator(int z) -{ +void MapDrawer::DrawPositionIndicator(int z) { if (z != pos_indicator.z || pos_indicator.x < start_x || pos_indicator.x > end_x @@ -1754,8 +1771,9 @@ void MapDrawer::DrawPositionIndicator(int z) constexpr int duration = 5000; const long time = pos_indicator_timer.Time(); - if (time >= duration) + if (time >= duration) { return; + } int x, y; getDrawPosition(pos_indicator, x, y); @@ -1769,14 +1787,14 @@ void MapDrawer::DrawPositionIndicator(int z) glEnable(GL_TEXTURE_2D); } -void MapDrawer::DrawTooltips() -{ - if(!options.show_tooltips || tooltips.empty()) +void MapDrawer::DrawTooltips() { + if (!options.show_tooltips || tooltips.empty()) { return; + } glDisable(GL_TEXTURE_2D); - for(MapTooltip* tooltip : tooltips) { + for (MapTooltip* tooltip : tooltips) { const char* text = tooltip->text.c_str(); float line_width = 0.0f; float width = 2.0f; @@ -1784,8 +1802,8 @@ void MapDrawer::DrawTooltips() int char_count = 0; int line_char_count = 0; - for(const char* c = text; *c != '\0'; c++) { - if(*c == '\n' || (line_char_count >= MapTooltip::MAX_CHARS_PER_LINE && *c == ' ')) { + for (const char* c = text; *c != '\0'; c++) { + if (*c == '\n' || (line_char_count >= MapTooltip::MAX_CHARS_PER_LINE && *c == ' ')) { height += 14.0f; line_width = 0.0f; line_char_count = 0; @@ -1796,8 +1814,9 @@ void MapDrawer::DrawTooltips() char_count++; line_char_count++; - if(tooltip->ellipsis && char_count > (MapTooltip::MAX_CHARS + 3)) + if (tooltip->ellipsis && char_count > (MapTooltip::MAX_CHARS + 3)) { break; + } } float scale = zoom < 1.0f ? zoom : 1.0f; @@ -1820,44 +1839,45 @@ void MapDrawer::DrawTooltips() // \/ // 4 float vertexes[9][2] = { - {x, starty}, // 0 - {endx, starty}, // 1 - {endx, endy}, // 2 - {x + space, endy}, // 3 - {x, y}, // 4 - {x - space, endy}, // 5 - {startx, endy}, // 6 - {startx, starty}, // 7 - {x, starty}, // 0 + { x, starty }, // 0 + { endx, starty }, // 1 + { endx, endy }, // 2 + { x + space, endy }, // 3 + { x, y }, // 4 + { x - space, endy }, // 5 + { startx, endy }, // 6 + { startx, starty }, // 7 + { x, starty }, // 0 }; // background glColor4ub(tooltip->r, tooltip->g, tooltip->b, 255); glBegin(GL_POLYGON); - for(int i = 0; i < 8; ++i) + for (int i = 0; i < 8; ++i) { glVertex2f(vertexes[i][0], vertexes[i][1]); + } glEnd(); // borders glColor4ub(0, 0, 0, 255); glLineWidth(1.0); glBegin(GL_LINES); - for(int i = 0; i < 8; ++i) { + for (int i = 0; i < 8; ++i) { glVertex2f(vertexes[i][0], vertexes[i][1]); glVertex2f(vertexes[i + 1][0], vertexes[i + 1][1]); } glEnd(); // text - if(zoom <= 1.0) { + if (zoom <= 1.0) { startx += (3.0f * scale); starty += (14.0f * scale); glColor4ub(0, 0, 0, 255); glRasterPos2f(startx, starty); char_count = 0; line_char_count = 0; - for(const char* c = text; *c != '\0'; c++) { - if(*c == '\n' || (line_char_count >= MapTooltip::MAX_CHARS_PER_LINE && *c == ' ')) { + for (const char* c = text; *c != '\0'; c++) { + if (*c == '\n' || (line_char_count >= MapTooltip::MAX_CHARS_PER_LINE && *c == ' ')) { starty += (14.0f * scale); glRasterPos2f(startx, starty); line_char_count = 0; @@ -1865,10 +1885,11 @@ void MapDrawer::DrawTooltips() char_count++; line_char_count++; - if(tooltip->ellipsis && char_count >= MapTooltip::MAX_CHARS) { + if (tooltip->ellipsis && char_count >= MapTooltip::MAX_CHARS) { glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, '.'); - if(char_count >= (MapTooltip::MAX_CHARS + 2)) + if (char_count >= (MapTooltip::MAX_CHARS + 2)) { break; + } } else if (!iscntrl(*c)) { glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, *c); } @@ -1879,86 +1900,86 @@ void MapDrawer::DrawTooltips() glEnable(GL_TEXTURE_2D); } -void MapDrawer::MakeTooltip(int screenx, int screeny, const std::string& text, uint8_t r, uint8_t g, uint8_t b) -{ - if(text.empty()) +void MapDrawer::MakeTooltip(int screenx, int screeny, const std::string &text, uint8_t r, uint8_t g, uint8_t b) { + if (text.empty()) { return; + } - MapTooltip *tooltip = new MapTooltip(screenx, screeny, text, r, g, b); + MapTooltip* tooltip = new MapTooltip(screenx, screeny, text, r, g, b); tooltip->checkLineEnding(); tooltips.push_back(tooltip); } -void MapDrawer::AddLight(TileLocation* location) -{ - if(!options.isDrawLight() || !location) { +void MapDrawer::AddLight(TileLocation* location) { + if (!options.isDrawLight() || !location) { return; } auto tile = location->get(); - if(!tile) { + if (!tile) { return; } - auto& position = location->getPosition(); + auto &position = location->getPosition(); - if(tile->ground) { + if (tile->ground) { if (tile->ground->hasLight()) { light_drawer->addLight(position.x, position.y, tile->ground->getLight()); } } bool hidden = options.hide_items_when_zoomed && zoom > 10.f; - if(!hidden && !tile->items.empty()) { - for(auto item : tile->items) { - if(item->hasLight()) { + if (!hidden && !tile->items.empty()) { + for (auto item : tile->items) { + if (item->hasLight()) { light_drawer->addLight(position.x, position.y, item->getLight()); } } } } -void MapDrawer::getColor(Brush* brush, const Position& position, uint8_t &r, uint8_t &g, uint8_t &b) -{ - if(brush->canDraw(&editor.getMap(), position)) { - if(brush->isWaypoint()) { - r = 0x00; g = 0xff, b = 0x00; +void MapDrawer::getColor(Brush* brush, const Position &position, uint8_t &r, uint8_t &g, uint8_t &b) { + if (brush->canDraw(&editor.getMap(), position)) { + if (brush->isWaypoint()) { + r = 0x00; + g = 0xff, b = 0x00; } else { - r = 0x00; g = 0x00, b = 0xff; + r = 0x00; + g = 0x00, b = 0xff; } } else { - r = 0xff; g = 0x00, b = 0x00; + r = 0xff; + g = 0x00, b = 0x00; } } -void MapDrawer::TakeScreenshot(uint8_t* screenshot_buffer) -{ +void MapDrawer::TakeScreenshot(uint8_t* screenshot_buffer) { glFinish(); // Wait for the operation to finish glPixelStorei(GL_PACK_ALIGNMENT, 1); // 1 byte alignment - for(int i = 0; i < screensize_y; ++i) - glReadPixels(0, screensize_y - i, screensize_x, 1, GL_RGB, GL_UNSIGNED_BYTE, (GLubyte*)(screenshot_buffer) + 3*screensize_x*i); + for (int i = 0; i < screensize_y; ++i) { + glReadPixels(0, screensize_y - i, screensize_x, 1, GL_RGB, GL_UNSIGNED_BYTE, (GLubyte*)(screenshot_buffer) + 3 * screensize_x * i); + } } -void MapDrawer::ShowPositionIndicator(const Position& position) -{ +void MapDrawer::ShowPositionIndicator(const Position &position) { pos_indicator = position; pos_indicator_timer.Start(); } -void MapDrawer::glBlitTexture(int x, int y, int textureId, int red, int green, int blue, int alpha, bool adjustZoom) -{ - if (textureId <= 0) +void MapDrawer::glBlitTexture(int x, int y, int textureId, int red, int green, int blue, int alpha, bool adjustZoom) { + if (textureId <= 0) { return; + } glBindTexture(GL_TEXTURE_2D, textureId); glColor4ub(uint8_t(red), uint8_t(green), uint8_t(blue), uint8_t(alpha)); glBegin(GL_QUADS); - if(adjustZoom) { + if (adjustZoom) { float size = rme::TileSize; - if(zoom < 1.0f) { + if (zoom < 1.0f) { float offset = 10 / (10 * zoom); size = std::max(16, rme::TileSize * zoom); x += offset; @@ -1969,50 +1990,54 @@ void MapDrawer::glBlitTexture(int x, int y, int textureId, int red, int green, i x -= offset; y -= offset; } - glTexCoord2f(0.f, 0.f); glVertex2f(x, y); - glTexCoord2f(1.f, 0.f); glVertex2f(x + size, y); - glTexCoord2f(1.f, 1.f); glVertex2f(x + size, y + size); - glTexCoord2f(0.f, 1.f); glVertex2f(x, y + size); + glTexCoord2f(0.f, 0.f); + glVertex2f(x, y); + glTexCoord2f(1.f, 0.f); + glVertex2f(x + size, y); + glTexCoord2f(1.f, 1.f); + glVertex2f(x + size, y + size); + glTexCoord2f(0.f, 1.f); + glVertex2f(x, y + size); } else { - glTexCoord2f(0.f, 0.f); glVertex2f(x, y); - glTexCoord2f(1.f, 0.f); glVertex2f(x + rme::TileSize, y); - glTexCoord2f(1.f, 1.f); glVertex2f(x + rme::TileSize, y + rme::TileSize); - glTexCoord2f(0.f, 1.f); glVertex2f(x, y + rme::TileSize); + glTexCoord2f(0.f, 0.f); + glVertex2f(x, y); + glTexCoord2f(1.f, 0.f); + glVertex2f(x + rme::TileSize, y); + glTexCoord2f(1.f, 1.f); + glVertex2f(x + rme::TileSize, y + rme::TileSize); + glTexCoord2f(0.f, 1.f); + glVertex2f(x, y + rme::TileSize); } glEnd(); } -void MapDrawer::glBlitSquare(int x, int y, int red, int green, int blue, int alpha) -{ +void MapDrawer::glBlitSquare(int x, int y, int red, int green, int blue, int alpha) { glColor4ub(uint8_t(red), uint8_t(green), uint8_t(blue), uint8_t(alpha)); glBegin(GL_QUADS); - glVertex2f(x, y); - glVertex2f(x + rme::TileSize, y); - glVertex2f(x + rme::TileSize, y + rme::TileSize); - glVertex2f(x, y + rme::TileSize); + glVertex2f(x, y); + glVertex2f(x + rme::TileSize, y); + glVertex2f(x + rme::TileSize, y + rme::TileSize); + glVertex2f(x, y + rme::TileSize); glEnd(); } -void MapDrawer::glBlitSquare(int x, int y, const wxColor& color) -{ +void MapDrawer::glBlitSquare(int x, int y, const wxColor &color) { glColor4ub(color.Red(), color.Green(), color.Blue(), color.Alpha()); glBegin(GL_QUADS); - glVertex2f(x, y); - glVertex2f(x + rme::TileSize, y); - glVertex2f(x + rme::TileSize, y + rme::TileSize); - glVertex2f(x, y + rme::TileSize); + glVertex2f(x, y); + glVertex2f(x + rme::TileSize, y); + glVertex2f(x + rme::TileSize, y + rme::TileSize); + glVertex2f(x, y + rme::TileSize); glEnd(); } -void MapDrawer::glColor(const wxColor& color) -{ +void MapDrawer::glColor(const wxColor &color) { glColor4ub(color.Red(), color.Green(), color.Blue(), color.Alpha()); } -void MapDrawer::glColor(MapDrawer::BrushColor color) -{ - switch(color) { +void MapDrawer::glColor(MapDrawer::BrushColor color) { + switch (color) { case COLOR_BRUSH: glColor4ub( g_settings.getInteger(Config::CURSOR_RED), @@ -2058,45 +2083,43 @@ void MapDrawer::glColor(MapDrawer::BrushColor color) } } -void MapDrawer::glColorCheck(Brush* brush, const Position& pos) -{ - if(brush->canDraw(&editor.getMap(), pos)) +void MapDrawer::glColorCheck(Brush* brush, const Position &pos) { + if (brush->canDraw(&editor.getMap(), pos)) { glColor(COLOR_VALID); - else + } else { glColor(COLOR_INVALID); + } } -void MapDrawer::drawRect(int x, int y, int w, int h, const wxColor& color, int width) -{ +void MapDrawer::drawRect(int x, int y, int w, int h, const wxColor &color, int width) { glLineWidth(width); glColor4ub(color.Red(), color.Green(), color.Blue(), color.Alpha()); glBegin(GL_LINE_STRIP); - glVertex2f(x, y); - glVertex2f(x + w, y); - glVertex2f(x + w, y + h); - glVertex2f(x, y + h); - glVertex2f(x, y); + glVertex2f(x, y); + glVertex2f(x + w, y); + glVertex2f(x + w, y + h); + glVertex2f(x, y + h); + glVertex2f(x, y); glEnd(); } -void MapDrawer::drawFilledRect(int x, int y, int w, int h, const wxColor& color) -{ +void MapDrawer::drawFilledRect(int x, int y, int w, int h, const wxColor &color) { glColor4ub(color.Red(), color.Green(), color.Blue(), color.Alpha()); glBegin(GL_QUADS); - glVertex2f(x, y); - glVertex2f(x + w, y); - glVertex2f(x + w, y + h); - glVertex2f(x, y + h); + glVertex2f(x, y); + glVertex2f(x + w, y); + glVertex2f(x + w, y + h); + glVertex2f(x, y + h); glEnd(); } -void MapDrawer::getDrawPosition(const Position& position, int& x, int& y) -{ +void MapDrawer::getDrawPosition(const Position &position, int &x, int &y) { int offset; - if(position.z <= rme::MapGroundLayer) + if (position.z <= rme::MapGroundLayer) { offset = (rme::MapGroundLayer - position.z) * rme::TileSize; - else + } else { offset = rme::TileSize * (floor - position.z); + } x = ((position.x * rme::TileSize) - view_scroll_x) - offset; y = ((position.y * rme::TileSize) - view_scroll_y) - offset; diff --git a/source/map_drawer.h b/source/map_drawer.h index 56003c22..aaa5d5ee 100644 --- a/source/map_drawer.h +++ b/source/map_drawer.h @@ -20,8 +20,7 @@ class GameSprite; -struct MapTooltip -{ +struct MapTooltip { enum TextLength { MAX_CHARS_PER_LINE = 40, MAX_CHARS = 255, @@ -33,8 +32,9 @@ struct MapTooltip } void checkLineEnding() { - if(text.at(text.size() - 1) == '\n') + if (text.at(text.size() - 1) == '\n') { text.resize(text.size() - 1); + } } int x, y; @@ -90,10 +90,9 @@ struct DrawingOptions { class MapCanvas; class LightDrawer; -class MapDrawer -{ +class MapDrawer { MapCanvas* canvas; - Editor& editor; + Editor &editor; DrawingOptions options; std::shared_ptr light_drawer; @@ -143,27 +142,29 @@ class MapDrawer void TakeScreenshot(uint8_t* screenshot_buffer); - void ShowPositionIndicator(const Position& position); + void ShowPositionIndicator(const Position &position); - DrawingOptions& getOptions() noexcept { return options; } + DrawingOptions &getOptions() noexcept { + return options; + } protected: - void BlitItem(int& screenx, int& screeny, const Tile* tile, const Item* item, bool ephemeral = false, int red = 255, int green = 255, int blue = 255, int alpha = 255); - void BlitItem(int& screenx, int& screeny, const Position& pos, const Item* item, bool ephemeral = false, int red = 255, int green = 255, int blue = 255, int alpha = 255); + void BlitItem(int &screenx, int &screeny, const Tile* tile, const Item* item, bool ephemeral = false, int red = 255, int green = 255, int blue = 255, int alpha = 255); + void BlitItem(int &screenx, int &screeny, const Position &pos, const Item* item, bool ephemeral = false, int red = 255, int green = 255, int blue = 255, int alpha = 255); void BlitSpriteType(int screenx, int screeny, uint32_t spriteid, int red = 255, int green = 255, int blue = 255, int alpha = 255); void BlitSpriteType(int screenx, int screeny, GameSprite* spr, int red = 255, int green = 255, int blue = 255, int alpha = 255); void BlitCreature(int screenx, int screeny, const Monster* npc, int red = 255, int green = 255, int blue = 255, int alpha = 255); void BlitCreature(int screenx, int screeny, const Npc* c, int red = 255, int green = 255, int blue = 255, int alpha = 255); - void BlitCreature(int screenx, int screeny, const Outfit& outfit, Direction dir, int red = 255, int green = 255, int blue = 255, int alpha = 255); + void BlitCreature(int screenx, int screeny, const Outfit &outfit, Direction dir, int red = 255, int green = 255, int blue = 255, int alpha = 255); void DrawTile(TileLocation* tile); void DrawBrushIndicator(int x, int y, Brush* brush, uint8_t r, uint8_t g, uint8_t b); - void DrawHookIndicator(int x, int y, const ItemType& type); + void DrawHookIndicator(int x, int y, const ItemType &type); void DrawTileIndicators(TileLocation* location); void DrawIndicator(int x, int y, int indicator, uint8_t r = 255, uint8_t g = 255, uint8_t b = 255, uint8_t a = 255); void DrawPositionIndicator(int z); - void WriteTooltip(const Item* item, std::ostringstream& stream); - void WriteTooltip(const Waypoint* item, std::ostringstream& stream); - void MakeTooltip(int screenx, int screeny, const std::string& text, uint8_t r = 255, uint8_t g = 255, uint8_t b = 255); + void WriteTooltip(const Item* item, std::ostringstream &stream); + void WriteTooltip(const Waypoint* item, std::ostringstream &stream); + void MakeTooltip(int screenx, int screeny, const std::string &text, uint8_t r = 255, uint8_t g = 255, uint8_t b = 255); void AddLight(TileLocation* location); enum BrushColor { @@ -178,19 +179,18 @@ class MapDrawer COLOR_BLANK, }; - void getColor(Brush* brush, const Position& position, uint8_t &r, uint8_t &g, uint8_t &b); + void getColor(Brush* brush, const Position &position, uint8_t &r, uint8_t &g, uint8_t &b); void glBlitTexture(int x, int y, int textureId, int red, int green, int blue, int alpha, bool adjustZoom = false); void glBlitSquare(int x, int y, int red, int green, int blue, int alpha); - void glBlitSquare(int x, int y, const wxColor& color); - void glColor(const wxColor& color); + void glBlitSquare(int x, int y, const wxColor &color); + void glColor(const wxColor &color); void glColor(BrushColor color); - void glColorCheck(Brush* brush, const Position& pos); - void drawRect(int x, int y, int w, int h, const wxColor& color, int width = 1); - void drawFilledRect(int x, int y, int w, int h, const wxColor& color); + void glColorCheck(Brush* brush, const Position &pos); + void drawRect(int x, int y, int w, int h, const wxColor &color, int width = 1); + void drawFilledRect(int x, int y, int w, int h, const wxColor &color); private: - void getDrawPosition(const Position& position, int &x, int &y); + void getDrawPosition(const Position &position, int &x, int &y); }; #endif - diff --git a/source/map_region.cpp b/source/map_region.cpp index fc350e21..f5fe43aa 100644 --- a/source/map_region.cpp +++ b/source/map_region.cpp @@ -30,44 +30,40 @@ TileLocation::TileLocation() : spawn_monster_count(0), spawn_npc_count(0), waypoint_count(0), - house_exits(nullptr) -{ + house_exits(nullptr) { //// } -TileLocation::~TileLocation() -{ +TileLocation::~TileLocation() { delete tile; delete house_exits; } -int TileLocation::size() const -{ - if(tile) +int TileLocation::size() const { + if (tile) { return tile->size(); - return spawn_monster_count + spawn_npc_count + waypoint_count + (house_exits? 1 : 0); + } + return spawn_monster_count + spawn_npc_count + waypoint_count + (house_exits ? 1 : 0); } -bool TileLocation::empty() const -{ +bool TileLocation::empty() const { return size() == 0; } -HouseExitList* TileLocation::createHouseExits() -{ - if(!house_exits) +HouseExitList* TileLocation::createHouseExits() { + if (!house_exits) { house_exits = new HouseExitList(); + } return house_exits; } //**************** Floor ********************** -Floor::Floor(int sx, int sy, int z) -{ +Floor::Floor(int sx, int sy, int z) { sx = sx & ~3; sy = sy & ~3; - for(int i = 0; i < rme::MapLayers; ++i) { + for (int i = 0; i < rme::MapLayers; ++i) { locs[i].position.x = sx + (i >> 2); locs[i].position.y = sy + (i & 3); locs[i].position.z = z; @@ -76,37 +72,37 @@ Floor::Floor(int sx, int sy, int z) //**************** QTreeNode ********************** -QTreeNode::QTreeNode(BaseMap& map) : +QTreeNode::QTreeNode(BaseMap &map) : map(map), visible(0), - isLeaf(false) -{ + isLeaf(false) { // Doesn't matter if we're leaf or node - for(int i = 0; i < rme::MapLayers; ++i) + for (int i = 0; i < rme::MapLayers; ++i) { child[i] = nullptr; + } } -QTreeNode::~QTreeNode() -{ - if(isLeaf) { - for(int i = 0; i < rme::MapLayers; ++i) +QTreeNode::~QTreeNode() { + if (isLeaf) { + for (int i = 0; i < rme::MapLayers; ++i) { delete array[i]; + } } else { - for(int i = 0; i < rme::MapLayers; ++i) + for (int i = 0; i < rme::MapLayers; ++i) { delete child[i]; + } } } -QTreeNode* QTreeNode::getLeaf(int x, int y) -{ +QTreeNode* QTreeNode::getLeaf(int x, int y) { QTreeNode* node = this; uint32_t cx = x, cy = y; - while(node) { - if(node->isLeaf) { + while (node) { + if (node->isLeaf) { return node; } else { uint32_t index = ((cx & 0xC000) >> 14) | ((cy & 0xC000) >> 12); - if(node->child[index]) { + if (node->child[index]) { node = node->child[index]; cx <<= 2; cy <<= 2; @@ -118,21 +114,21 @@ QTreeNode* QTreeNode::getLeaf(int x, int y) return nullptr; } -QTreeNode* QTreeNode::getLeafForce(int x, int y) -{ +QTreeNode* QTreeNode::getLeafForce(int x, int y) { QTreeNode* node = this; uint32_t cx = x, cy = y; int level = 6; - while(node) { + while (node) { uint32_t index = ((cx & 0xC000) >> 14) | ((cy & 0xC000) >> 12); - QTreeNode*& qt = node->child[index]; - if(qt) { - if(qt->isLeaf) + QTreeNode*&qt = node->child[index]; + if (qt) { + if (qt->isLeaf) { return qt; + } } else { - if(level == 0) { + if (level == 0) { qt = newd QTreeNode(map); qt->isLeaf = true; return qt; @@ -149,124 +145,121 @@ QTreeNode* QTreeNode::getLeafForce(int x, int y) return nullptr; } - -Floor* QTreeNode::createFloor(int x, int y, int z) -{ +Floor* QTreeNode::createFloor(int x, int y, int z) { ASSERT(isLeaf); - if(!array[z]) + if (!array[z]) { array[z] = newd Floor(x, y, z); + } return array[z]; } -bool QTreeNode::isVisible(bool underground) -{ +bool QTreeNode::isVisible(bool underground) { return testFlags(visible, underground + 1); } -bool QTreeNode::isRequested(bool underground) -{ - if(underground) { +bool QTreeNode::isRequested(bool underground) { + if (underground) { return testFlags(visible, 4); } else { return testFlags(visible, 8); } } -void QTreeNode::clearVisible(uint32_t u) -{ - if(isLeaf) +void QTreeNode::clearVisible(uint32_t u) { + if (isLeaf) { visible &= u; - else - for(int i = 0; i < rme::MapLayers; ++i) - if(child[i]) + } else { + for (int i = 0; i < rme::MapLayers; ++i) { + if (child[i]) { child[i]->clearVisible(u); + } + } + } } -bool QTreeNode::isVisible(uint32_t client, bool underground) -{ - if(underground) { +bool QTreeNode::isVisible(uint32_t client, bool underground) { + if (underground) { return testFlags(visible >> rme::MapLayers, static_cast(1) << client); } else { return testFlags(visible, static_cast(1) << client); } } -void QTreeNode::setVisible(bool underground, bool value) -{ - if(underground) { - if(value) +void QTreeNode::setVisible(bool underground, bool value) { + if (underground) { + if (value) { visible |= 2; - else + } else { visible &= ~2; + } } else { // overground - if(value) + if (value) { visible |= 1; - else + } else { visible &= 1; + } } } -void QTreeNode::setRequested(bool underground, bool r) -{ - if(r) - visible |= (underground? 4 : 8); - else - visible &= ~(underground? 4 : 8); +void QTreeNode::setRequested(bool underground, bool r) { + if (r) { + visible |= (underground ? 4 : 8); + } else { + visible &= ~(underground ? 4 : 8); + } } -void QTreeNode::setVisible(uint32_t client, bool underground, bool value) -{ - if(value) +void QTreeNode::setVisible(uint32_t client, bool underground, bool value) { + if (value) { visible |= (1 << client << (underground ? rme::MapLayers : 0)); - else + } else { visible &= ~(1 << client << (underground ? rme::MapLayers : 0)); + } } -TileLocation* QTreeNode::getTile(int x, int y, int z) -{ +TileLocation* QTreeNode::getTile(int x, int y, int z) { ASSERT(isLeaf); Floor* f = array[z]; - if(!f) + if (!f) { return nullptr; + } return &f->locs[(x & 3) * 4 + (y & 3)]; } -TileLocation* QTreeNode::createTile(int x, int y, int z) -{ +TileLocation* QTreeNode::createTile(int x, int y, int z) { ASSERT(isLeaf); Floor* f = createFloor(x, y, z); return &f->locs[(x & 3) * 4 + (y & 3)]; } -Tile* QTreeNode::setTile(int x, int y, int z, Tile* newtile) -{ +Tile* QTreeNode::setTile(int x, int y, int z, Tile* newtile) { ASSERT(isLeaf); Floor* f = createFloor(x, y, z); int offset_x = x & 3; int offset_y = y & 3; - TileLocation* tmp = &f->locs[offset_x*4+offset_y]; + TileLocation* tmp = &f->locs[offset_x * 4 + offset_y]; Tile* oldtile = tmp->tile; tmp->tile = newtile; - if(newtile && !oldtile) + if (newtile && !oldtile) { ++map.tilecount; - else if(oldtile && !newtile) + } else if (oldtile && !newtile) { --map.tilecount; + } return oldtile; } -void QTreeNode::clearTile(int x, int y, int z) -{ +void QTreeNode::clearTile(int x, int y, int z) { ASSERT(isLeaf); Floor* f = createFloor(x, y, z); int offset_x = x & 3; int offset_y = y & 3; - TileLocation* tmp = &f->locs[offset_x*4+offset_y]; + TileLocation* tmp = &f->locs[offset_x * 4 + offset_y]; delete tmp->tile; tmp->tile = map.allocator(tmp); } diff --git a/source/map_region.h b/source/map_region.h index e13f589f..83de4d36 100644 --- a/source/map_region.h +++ b/source/map_region.h @@ -25,14 +25,14 @@ class Tile; class Floor; class BaseMap; -class TileLocation -{ +class TileLocation { TileLocation(); + public: ~TileLocation(); - TileLocation(const TileLocation&) = delete; - TileLocation& operator=(const TileLocation&) = delete; + TileLocation(const TileLocation &) = delete; + TileLocation &operator=(const TileLocation &) = delete; protected: Tile* tile; @@ -43,55 +43,84 @@ class TileLocation HouseExitList* house_exits; // Any house exits pointing here public: - // Access tile // Can't set directly since that does not update tile count - Tile* get() noexcept { return tile; } - const Tile* get() const noexcept { return tile; } + Tile* get() noexcept { + return tile; + } + const Tile* get() const noexcept { + return tile; + } int size() const; bool empty() const; - const Position& getPosition() const noexcept { return position; } - int getX() const noexcept { return position.x; } - int getY() const noexcept { return position.y; } - int getZ() const noexcept { return position.z; } + const Position &getPosition() const noexcept { + return position; + } + int getX() const noexcept { + return position.x; + } + int getY() const noexcept { + return position.y; + } + int getZ() const noexcept { + return position.z; + } - size_t getSpawnMonsterCount() const noexcept {return spawn_monster_count;} - void increaseSpawnCount() noexcept {spawn_monster_count++;} - void decreaseSpawnMonsterCount() noexcept {spawn_monster_count--;} + size_t getSpawnMonsterCount() const noexcept { + return spawn_monster_count; + } + void increaseSpawnCount() noexcept { + spawn_monster_count++; + } + void decreaseSpawnMonsterCount() noexcept { + spawn_monster_count--; + } - size_t getSpawnNpcCount() const noexcept {return spawn_npc_count;} - void increaseSpawnNpcCount() noexcept {spawn_npc_count++;} - void decreaseSpawnNpcCount() noexcept {spawn_npc_count--;} + size_t getSpawnNpcCount() const noexcept { + return spawn_npc_count; + } + void increaseSpawnNpcCount() noexcept { + spawn_npc_count++; + } + void decreaseSpawnNpcCount() noexcept { + spawn_npc_count--; + } - size_t getWaypointCount() const noexcept {return waypoint_count;} - void increaseWaypointCount() {waypoint_count++;} - void decreaseWaypointCount() {waypoint_count--;} + size_t getWaypointCount() const noexcept { + return waypoint_count; + } + void increaseWaypointCount() { + waypoint_count++; + } + void decreaseWaypointCount() { + waypoint_count--; + } HouseExitList* createHouseExits(); - HouseExitList* getHouseExits() noexcept { return house_exits; } + HouseExitList* getHouseExits() noexcept { + return house_exits; + } friend class Floor; friend class QTreeNode; friend class Waypoints; }; -class Floor -{ +class Floor { public: Floor(int x, int y, int z); TileLocation locs[rme::MapLayers]; }; // This is not a QuadTree, but a HexTree (16 child nodes to every node), so the name is abit misleading -class QTreeNode -{ +class QTreeNode { public: - QTreeNode(BaseMap& map); + QTreeNode(BaseMap &map); virtual ~QTreeNode(); - QTreeNode(const QTreeNode&) = delete; - QTreeNode& operator=(const QTreeNode&) = delete; + QTreeNode(const QTreeNode &) = delete; + QTreeNode &operator=(const QTreeNode &) = delete; QTreeNode* getLeaf(int x, int y); // Might return nullptr QTreeNode* getLeafForce(int x, int y); // Will never return nullptr, it will create the node if it's not there @@ -121,7 +150,7 @@ class QTreeNode bool isRequested(bool underground); protected: - BaseMap& map; + BaseMap ↦ uint32_t visible; bool isLeaf; @@ -129,9 +158,9 @@ class QTreeNode union { QTreeNode* child[rme::MapLayers]; Floor* array[rme::MapLayers]; -//#if 16 != rme::MapLayers -//# error "You need to rewrite the QuadTree in order to handle more or less than 16 floors" -//#endif + // #if 16 != rme::MapLayers + // # error "You need to rewrite the QuadTree in order to handle more or less than 16 floors" + // #endif }; friend class BaseMap; diff --git a/source/map_tab.cpp b/source/map_tab.cpp index d16b8a9d..147ba28a 100644 --- a/source/map_tab.cpp +++ b/source/map_tab.cpp @@ -28,8 +28,7 @@ MapTab::MapTab(MapTabbook* aui, Editor* editor) : EditorTab(), MapWindow(aui->notebook, *editor), - aui(aui) -{ + aui(aui) { iref = newd InternalReference; iref->editor = editor; iref->owner_count = 1; @@ -42,8 +41,7 @@ MapTab::MapTab(const MapTab* other) : EditorTab(), MapWindow(other->aui, *other->iref->editor), aui(other->aui), - iref(other->iref) -{ + iref(other->iref) { iref->owner_count++; aui->AddTab(this, true); FitToMap(); @@ -52,65 +50,56 @@ MapTab::MapTab(const MapTab* other) : SetScreenCenterPosition(Position(x, y, other->GetCanvas()->GetFloor())); } -MapTab::~MapTab() -{ +MapTab::~MapTab() { iref->owner_count--; - if(iref->owner_count <= 0) { + if (iref->owner_count <= 0) { delete iref->editor; delete iref; } } -bool MapTab::IsUniqueReference() const -{ +bool MapTab::IsUniqueReference() const { return iref->owner_count == 1; } -wxWindow* MapTab::GetWindow() const -{ +wxWindow* MapTab::GetWindow() const { return const_cast(this); } -MapCanvas* MapTab::GetCanvas() const -{ +MapCanvas* MapTab::GetCanvas() const { return canvas; } -MapWindow* MapTab::GetView() const -{ +MapWindow* MapTab::GetView() const { return const_cast((const MapWindow*)this); } -wxString MapTab::GetTitle() const -{ +wxString MapTab::GetTitle() const { wxString ss; - const Map& map = iref->editor->getMap(); + const Map &map = iref->editor->getMap(); ss << wxstr(map.getName()) << (map.hasChanged() ? "*" : ""); return ss; } -Editor* MapTab::GetEditor() const -{ +Editor* MapTab::GetEditor() const { return &editor; } -Map* MapTab::GetMap() const -{ +Map* MapTab::GetMap() const { return &editor.getMap(); } -void MapTab::VisibilityCheck() -{ +void MapTab::VisibilityCheck() { EditorTab* editorTab = aui->GetCurrentTab(); MapTab* mapTab = dynamic_cast(editorTab); UpdateDialogs(mapTab && HasSameReference(mapTab)); } -void MapTab::OnSwitchEditorMode(EditorMode mode) -{ - gem->SetSprite(mode == DRAWING_MODE? EDITOR_SPRITE_DRAWING_GEM : EDITOR_SPRITE_SELECTION_GEM); - if(mode == SELECTION_MODE) +void MapTab::OnSwitchEditorMode(EditorMode mode) { + gem->SetSprite(mode == DRAWING_MODE ? EDITOR_SPRITE_DRAWING_GEM : EDITOR_SPRITE_SELECTION_GEM); + if (mode == SELECTION_MODE) { canvas->EnterSelectionMode(); - else + } else { canvas->EnterDrawingMode(); + } } diff --git a/source/map_window.cpp b/source/map_window.cpp index 4132bf21..ec682ee5 100644 --- a/source/map_window.cpp +++ b/source/map_window.cpp @@ -15,7 +15,6 @@ // along with this program. If not, see . ////////////////////////////////////////////////////////////////////// - #include "main.h" #include "map_window.h" @@ -23,11 +22,10 @@ #include "sprites.h" #include "editor.h" -MapWindow::MapWindow(wxWindow* parent, Editor& editor) : +MapWindow::MapWindow(wxWindow* parent, Editor &editor) : wxPanel(parent, PANE_MAIN), editor(editor), - replaceItemsDialog(nullptr) -{ + replaceItemsDialog(nullptr) { int GL_settings[3]; GL_settings[0] = WX_GL_RGBA; GL_settings[1] = WX_GL_DOUBLEBUFFER; @@ -52,105 +50,99 @@ MapWindow::MapWindow(wxWindow* parent, Editor& editor) : SetSizerAndFit(topsizer); } -MapWindow::~MapWindow() -{ +MapWindow::~MapWindow() { //// } -void MapWindow::ShowReplaceItemsDialog(bool selectionOnly) -{ - if(replaceItemsDialog) +void MapWindow::ShowReplaceItemsDialog(bool selectionOnly) { + if (replaceItemsDialog) { return; + } replaceItemsDialog = new ReplaceItemsDialog(this, selectionOnly); replaceItemsDialog->Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(MapWindow::OnReplaceItemsDialogClose), NULL, this); replaceItemsDialog->Show(); } -void MapWindow::CloseReplaceItemsDialog() -{ - if(replaceItemsDialog) +void MapWindow::CloseReplaceItemsDialog() { + if (replaceItemsDialog) { replaceItemsDialog->Close(); + } } -void MapWindow::OnReplaceItemsDialogClose(wxCloseEvent& event) -{ - if(replaceItemsDialog) { +void MapWindow::OnReplaceItemsDialogClose(wxCloseEvent &event) { + if (replaceItemsDialog) { replaceItemsDialog->Disconnect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(MapWindow::OnReplaceItemsDialogClose), NULL, this); replaceItemsDialog->Destroy(); replaceItemsDialog = nullptr; } } -void MapWindow::SetSize(int x, int y, bool center) -{ - if(x == 0 || y == 0) return; +void MapWindow::SetSize(int x, int y, bool center) { + if (x == 0 || y == 0) { + return; + } int windowSizeX; int windowSizeY; canvas->GetSize(&windowSizeX, &windowSizeY); - hScroll->SetScrollbar(center? (x - windowSizeX)/2 : hScroll->GetThumbPosition(), windowSizeX / x, x, windowSizeX / x); - vScroll->SetScrollbar(center? (y - windowSizeY)/2 : vScroll->GetThumbPosition(), windowSizeY / y, y, windowSizeX / y); - //wxPanel::SetSize(x, y); + hScroll->SetScrollbar(center ? (x - windowSizeX) / 2 : hScroll->GetThumbPosition(), windowSizeX / x, x, windowSizeX / x); + vScroll->SetScrollbar(center ? (y - windowSizeY) / 2 : vScroll->GetThumbPosition(), windowSizeY / y, y, windowSizeX / y); + // wxPanel::SetSize(x, y); } -void MapWindow::UpdateScrollbars(int nx, int ny) -{ +void MapWindow::UpdateScrollbars(int nx, int ny) { // nx and ny are size of this window hScroll->SetScrollbar(hScroll->GetThumbPosition(), nx / std::max(1, hScroll->GetRange()), std::max(1, hScroll->GetRange()), 96); vScroll->SetScrollbar(vScroll->GetThumbPosition(), ny / std::max(1, vScroll->GetRange()), std::max(1, vScroll->GetRange()), 96); } -void MapWindow::UpdateDialogs(bool show) -{ - if(replaceItemsDialog) +void MapWindow::UpdateDialogs(bool show) { + if (replaceItemsDialog) { replaceItemsDialog->Show(show); + } } -void MapWindow::GetViewStart(int* x, int* y) -{ +void MapWindow::GetViewStart(int* x, int* y) { *x = hScroll->GetThumbPosition(); *y = vScroll->GetThumbPosition(); } -void MapWindow::GetViewSize(int* x, int* y) -{ +void MapWindow::GetViewSize(int* x, int* y) { canvas->GetSize(x, y); *x *= canvas->GetContentScaleFactor(); *y *= canvas->GetContentScaleFactor(); } -void MapWindow::FitToMap() -{ - const Map& map = editor.getMap(); +void MapWindow::FitToMap() { + const Map &map = editor.getMap(); SetSize(map.getWidth() * rme::TileSize, map.getHeight() * rme::TileSize, true); } -Position MapWindow::GetScreenCenterPosition() -{ +Position MapWindow::GetScreenCenterPosition() { int x, y; canvas->GetScreenCenter(&x, &y); return Position(x, y, canvas->GetFloor()); } -void MapWindow::SetScreenCenterPosition(const Position& position, bool showIndicator) -{ - if(!position.isValid()) +void MapWindow::SetScreenCenterPosition(const Position &position, bool showIndicator) { + if (!position.isValid()) { return; + } int x = position.x * rme::TileSize; int y = position.y * rme::TileSize; int z = position.z; - if(position.z < 8) { + if (position.z < 8) { // Compensate for floor offset above ground x -= (rme::MapGroundLayer - z) * rme::TileSize; y -= (rme::MapGroundLayer - z) * rme::TileSize; } - const Position& center = GetScreenCenterPosition(); - if(previous_position != center) { + const Position ¢er = GetScreenCenterPosition(); + if (previous_position != center) { previous_position.x = center.x; previous_position.y = center.y; previous_position.z = center.z; @@ -159,18 +151,17 @@ void MapWindow::SetScreenCenterPosition(const Position& position, bool showIndic Scroll(x, y, true); canvas->ChangeFloor(z); - if (showIndicator) + if (showIndicator) { canvas->ShowPositionIndicator(position); + } } -void MapWindow::GoToPreviousCenterPosition() -{ +void MapWindow::GoToPreviousCenterPosition() { SetScreenCenterPosition(previous_position, true); } -void MapWindow::Scroll(int x, int y, bool center) -{ - if(center) { +void MapWindow::Scroll(int x, int y, bool center) { + if (center) { int windowSizeX, windowSizeY; canvas->GetSize(&windowSizeX, &windowSizeY); @@ -183,61 +174,57 @@ void MapWindow::Scroll(int x, int y, bool center) g_gui.UpdateMinimap(); } -void MapWindow::ScrollRelative(int x, int y) -{ - hScroll->SetThumbPosition(hScroll->GetThumbPosition()+x); - vScroll->SetThumbPosition(vScroll->GetThumbPosition()+y); +void MapWindow::ScrollRelative(int x, int y) { + hScroll->SetThumbPosition(hScroll->GetThumbPosition() + x); + vScroll->SetThumbPosition(vScroll->GetThumbPosition() + y); g_gui.UpdateMinimap(); } -void MapWindow::OnGem(wxCommandEvent& WXUNUSED(event)) -{ +void MapWindow::OnGem(wxCommandEvent &WXUNUSED(event)) { g_gui.SwitchMode(); } -void MapWindow::OnSize(wxSizeEvent& event) -{ +void MapWindow::OnSize(wxSizeEvent &event) { UpdateScrollbars(event.GetSize().GetWidth(), event.GetSize().GetHeight()); event.Skip(); } -void MapWindow::OnScroll(wxScrollEvent& event) -{ +void MapWindow::OnScroll(wxScrollEvent &event) { Refresh(); } -void MapWindow::OnScrollLineDown(wxScrollEvent& event) -{ - if(event.GetOrientation() == wxHORIZONTAL) - ScrollRelative(96,0); - else - ScrollRelative(0,96); +void MapWindow::OnScrollLineDown(wxScrollEvent &event) { + if (event.GetOrientation() == wxHORIZONTAL) { + ScrollRelative(96, 0); + } else { + ScrollRelative(0, 96); + } Refresh(); } -void MapWindow::OnScrollLineUp(wxScrollEvent& event) -{ - if(event.GetOrientation() == wxHORIZONTAL) - ScrollRelative(-96,0); - else - ScrollRelative(0,-96); +void MapWindow::OnScrollLineUp(wxScrollEvent &event) { + if (event.GetOrientation() == wxHORIZONTAL) { + ScrollRelative(-96, 0); + } else { + ScrollRelative(0, -96); + } Refresh(); } -void MapWindow::OnScrollPageDown(wxScrollEvent& event) -{ - if(event.GetOrientation() == wxHORIZONTAL) - ScrollRelative(5*96,0); - else - ScrollRelative(0,5*96); +void MapWindow::OnScrollPageDown(wxScrollEvent &event) { + if (event.GetOrientation() == wxHORIZONTAL) { + ScrollRelative(5 * 96, 0); + } else { + ScrollRelative(0, 5 * 96); + } Refresh(); } -void MapWindow::OnScrollPageUp(wxScrollEvent& event) -{ - if(event.GetOrientation() == wxHORIZONTAL) - ScrollRelative(-5*96,0); - else - ScrollRelative(0,-5*96); +void MapWindow::OnScrollPageUp(wxScrollEvent &event) { + if (event.GetOrientation() == wxHORIZONTAL) { + ScrollRelative(-5 * 96, 0); + } else { + ScrollRelative(0, -5 * 96); + } Refresh(); } diff --git a/source/map_window.h b/source/map_window.h index 27a57f26..08bc17ce 100644 --- a/source/map_window.h +++ b/source/map_window.h @@ -28,20 +28,19 @@ class DCButton; // and everything. This is the window that's inside each tab in the // editor. Does NOT control any map rendering or editing at all. // MapCanvas does that. (mapdisplay.h) -class MapWindow : public wxPanel -{ +class MapWindow : public wxPanel { public: - MapWindow(wxWindow* parent, Editor& editor); + MapWindow(wxWindow* parent, Editor &editor); virtual ~MapWindow(); // Event handlers - void OnSize(wxSizeEvent& event); - void OnScroll(wxScrollEvent& event); - void OnScrollLineDown(wxScrollEvent& event); - void OnScrollLineUp(wxScrollEvent& event); - void OnScrollPageDown(wxScrollEvent& event); - void OnScrollPageUp(wxScrollEvent& event); - void OnGem(wxCommandEvent& event); + void OnSize(wxSizeEvent &event); + void OnScroll(wxScrollEvent &event); + void OnScrollLineDown(wxScrollEvent &event); + void OnScrollLineUp(wxScrollEvent &event); + void OnScrollPageDown(wxScrollEvent &event); + void OnScrollPageUp(wxScrollEvent &event); + void OnGem(wxCommandEvent &event); // Custom interface for MapWindow @@ -67,15 +66,17 @@ class MapWindow : public wxPanel // Screen position. Position GetScreenCenterPosition(); - void SetScreenCenterPosition(const Position& position, bool showIndicator = false); + void SetScreenCenterPosition(const Position &position, bool showIndicator = false); void GoToPreviousCenterPosition(); // Return the containing canvas - MapCanvas* GetCanvas() const noexcept { return canvas; } + MapCanvas* GetCanvas() const noexcept { + return canvas; + } void ShowReplaceItemsDialog(bool selectionOnly); void CloseReplaceItemsDialog(); - void OnReplaceItemsDialogClose(wxCloseEvent& event); + void OnReplaceItemsDialogClose(wxCloseEvent &event); protected: // For internal use, call to resize the scrollbars with @@ -84,7 +85,7 @@ class MapWindow : public wxPanel void UpdateDialogs(bool show); protected: - Editor& editor; + Editor &editor; DCButton* gem; MapCanvas* canvas; wxScrollBar* hScroll; @@ -103,16 +104,21 @@ class MapWindow : public wxPanel // MapScrollbar, a special scrollbar that relays alot of events // to the canvas, which allows scrolling when the scrollbar has // focus (even though it also resents focus as hard as it can. -class MapScrollBar : public wxScrollBar -{ +class MapScrollBar : public wxScrollBar { public: MapScrollBar(MapWindow* parent, wxWindowID id, long style, wxWindow* canvas) : - wxScrollBar(parent, id, wxDefaultPosition, wxDefaultSize, style), canvas(canvas) {} - virtual ~MapScrollBar() {} - - void OnKey(wxKeyEvent& event) {canvas->GetEventHandler()->AddPendingEvent(event);} - void OnWheel(wxMouseEvent& event) {canvas->GetEventHandler()->AddPendingEvent(event);} - void OnFocus(wxFocusEvent& event) {canvas->SetFocus();} + wxScrollBar(parent, id, wxDefaultPosition, wxDefaultSize, style), canvas(canvas) { } + virtual ~MapScrollBar() { } + + void OnKey(wxKeyEvent &event) { + canvas->GetEventHandler()->AddPendingEvent(event); + } + void OnWheel(wxMouseEvent &event) { + canvas->GetEventHandler()->AddPendingEvent(event); + } + void OnFocus(wxFocusEvent &event) { + canvas->SetFocus(); + } wxWindow* canvas; DECLARE_EVENT_TABLE() diff --git a/source/materials.cpp b/source/materials.cpp index 22219b0c..2b793a12 100644 --- a/source/materials.cpp +++ b/source/materials.cpp @@ -30,23 +30,20 @@ Materials g_materials; -Materials::Materials() -{ +Materials::Materials() { //// } -Materials::~Materials() -{ +Materials::~Materials() { clear(); } -void Materials::clear() -{ - for(TilesetContainer::iterator iter = tilesets.begin(); iter != tilesets.end(); ++iter) { +void Materials::clear() { + for (TilesetContainer::iterator iter = tilesets.begin(); iter != tilesets.end(); ++iter) { delete iter->second; } - for(MaterialsExtensionList::iterator iter = extensions.begin(); iter != extensions.end(); ++iter) { + for (MaterialsExtensionList::iterator iter = extensions.begin(); iter != extensions.end(); ++iter) { delete *iter; } @@ -54,33 +51,30 @@ void Materials::clear() extensions.clear(); } -const MaterialsExtensionList& Materials::getExtensions() -{ +const MaterialsExtensionList &Materials::getExtensions() { return extensions; } -MaterialsExtensionList Materials::getExtensionsByVersion(uint16_t version_id) -{ +MaterialsExtensionList Materials::getExtensionsByVersion(uint16_t version_id) { MaterialsExtensionList ret_list; - for(MaterialsExtensionList::iterator iter = extensions.begin(); iter != extensions.end(); ++iter) { - if((*iter)->isForVersion(version_id)) { + for (MaterialsExtensionList::iterator iter = extensions.begin(); iter != extensions.end(); ++iter) { + if ((*iter)->isForVersion(version_id)) { ret_list.push_back(*iter); } } return ret_list; } -bool Materials::loadMaterials(const FileName& identifier, wxString& error, wxArrayString& warnings) -{ +bool Materials::loadMaterials(const FileName &identifier, wxString &error, wxArrayString &warnings) { pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(identifier.GetFullPath().mb_str()); - if(!result) { + if (!result) { warnings.push_back("Could not open " + identifier.GetFullName() + " (file not found or syntax error)"); return false; } pugi::xml_node node = doc.child("materials"); - if(!node) { + if (!node) { warnings.push_back(identifier.GetFullName() + ": Invalid rootheader."); return false; } @@ -89,18 +83,17 @@ bool Materials::loadMaterials(const FileName& identifier, wxString& error, wxArr return true; } -bool Materials::loadExtensions(FileName directoryName, wxString& error, wxArrayString& warnings) -{ +bool Materials::loadExtensions(FileName directoryName, wxString &error, wxArrayString &warnings) { directoryName.Mkdir(0755, wxPATH_MKDIR_FULL); // Create if it doesn't exist wxDir ext_dir(directoryName.GetPath()); - if(!ext_dir.IsOpened()) { + if (!ext_dir.IsOpened()) { error = "Could not open extensions directory."; return false; } wxString filename; - if(!ext_dir.GetFirst(&filename)) { + if (!ext_dir.GetFirst(&filename)) { // No extensions found return true; } @@ -110,43 +103,43 @@ bool Materials::loadExtensions(FileName directoryName, wxString& error, wxArrayS FileName fn; fn.SetPath(directoryName.GetPath()); fn.SetFullName(filename); - if(fn.GetExt() != "xml") { + if (fn.GetExt() != "xml") { continue; } pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(fn.GetFullPath().mb_str()); - if(!result) { + if (!result) { warnings.push_back("Could not open " + filename + " (file not found or syntax error)"); continue; } pugi::xml_node extensionNode = doc.child("materialsextension"); - if(!extensionNode) { + if (!extensionNode) { warnings.push_back(filename + ": Invalid rootheader."); continue; } pugi::xml_attribute attribute; - if(!(attribute = extensionNode.attribute("name"))) { + if (!(attribute = extensionNode.attribute("name"))) { warnings.push_back(filename + ": Couldn't read extension name."); continue; } - const std::string& extensionName = attribute.as_string(); - if(!(attribute = extensionNode.attribute("author"))) { + const std::string &extensionName = attribute.as_string(); + if (!(attribute = extensionNode.attribute("author"))) { warnings.push_back(filename + ": Couldn't read extension name."); continue; } - const std::string& extensionAuthor = attribute.as_string(); - if(!(attribute = extensionNode.attribute("description"))) { + const std::string &extensionAuthor = attribute.as_string(); + if (!(attribute = extensionNode.attribute("description"))) { warnings.push_back(filename + ": Couldn't read extension name."); continue; } - const std::string& extensionDescription = attribute.as_string(); - if(extensionName.empty() || extensionAuthor.empty() || extensionDescription.empty()) { + const std::string &extensionDescription = attribute.as_string(); + if (extensionName.empty() || extensionAuthor.empty() || extensionDescription.empty()) { warnings.push_back(filename + ": Couldn't read extension attributes (name, author, description)."); continue; } @@ -161,27 +154,27 @@ bool Materials::loadExtensions(FileName directoryName, wxString& error, wxArrayS materialExtension->url = extensionUrl; materialExtension->author_url = extensionAuthorLink; - if((attribute = extensionNode.attribute("client"))) { + if ((attribute = extensionNode.attribute("client"))) { clientVersions.clear(); - const std::string& extensionClientString = attribute.as_string(); + const std::string &extensionClientString = attribute.as_string(); size_t lastPosition = 0; size_t position = extensionClientString.find(';'); - while(position != std::string::npos) { + while (position != std::string::npos) { clientVersions.push_back(extensionClientString.substr(lastPosition, position - lastPosition)); lastPosition = position + 1; position = extensionClientString.find(';', lastPosition); } clientVersions.push_back(extensionClientString.substr(lastPosition)); - for(const std::string& version : clientVersions) { + for (const std::string &version : clientVersions) { materialExtension->addVersion(version); } std::sort(materialExtension->version_list.begin(), materialExtension->version_list.end(), VersionComparisonPredicate); auto duplicate = std::unique(materialExtension->version_list.begin(), materialExtension->version_list.end()); - while(duplicate != materialExtension->version_list.end()) { + while (duplicate != materialExtension->version_list.end()) { materialExtension->version_list.erase(duplicate); duplicate = std::unique(materialExtension->version_list.begin(), materialExtension->version_list.end()); } @@ -190,22 +183,21 @@ bool Materials::loadExtensions(FileName directoryName, wxString& error, wxArrayS } extensions.push_back(materialExtension); - if(materialExtension->isForVersion(g_gui.GetCurrentVersionID())) { + if (materialExtension->isForVersion(g_gui.GetCurrentVersionID())) { unserializeMaterials(filename, extensionNode, error, warnings); } - } while(ext_dir.GetNext(&filename)); + } while (ext_dir.GetNext(&filename)); return true; } -bool Materials::unserializeMaterials(const FileName& filename, pugi::xml_node node, wxString& error, wxArrayString& warnings) -{ +bool Materials::unserializeMaterials(const FileName &filename, pugi::xml_node node, wxString &error, wxArrayString &warnings) { wxString warning; pugi::xml_attribute attribute; - for(pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { - const std::string& childName = as_lower_str(childNode.name()); - if(childName == "include") { - if(!(attribute = childNode.attribute("file"))) { + for (pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { + const std::string &childName = as_lower_str(childNode.name()); + if (childName == "include") { + if (!(attribute = childNode.attribute("file"))) { continue; } @@ -214,32 +206,31 @@ bool Materials::unserializeMaterials(const FileName& filename, pugi::xml_node no includeName.SetName(wxString(attribute.as_string(), wxConvUTF8)); wxString subError; - if(!loadMaterials(includeName, subError, warnings)) { + if (!loadMaterials(includeName, subError, warnings)) { warnings.push_back("Error while loading file \"" + includeName.GetFullName() + "\": " + subError); } - } else if(childName == "metaitem") { + } else if (childName == "metaitem") { g_items.loadMetaItem(childNode); - } else if(childName == "border") { + } else if (childName == "border") { g_brushes.unserializeBorder(childNode, warnings); - if(warning.size()) { + if (warning.size()) { warnings.push_back("materials.xml: " + warning); } - } else if(childName == "brush") { + } else if (childName == "brush") { g_brushes.unserializeBrush(childNode, warnings); - if(warning.size()) { + if (warning.size()) { warnings.push_back("materials.xml: " + warning); } - } else if(childName == "tileset") { + } else if (childName == "tileset") { unserializeTileset(childNode, warnings); } } return true; } -void Materials::createOtherTileset() -{ +void Materials::createOtherTileset() { Tileset* others; - if(tilesets["Others"] != nullptr) { + if (tilesets["Others"] != nullptr) { others = tilesets["Others"]; others->clear(); } else { @@ -248,25 +239,26 @@ void Materials::createOtherTileset() } // There should really be an iterator to do this - for(int32_t id = 0; id <= g_items.getMaxID(); ++id) { + for (int32_t id = 0; id <= g_items.getMaxID(); ++id) { ItemType* type = g_items.getRawItemType(id); - if(!type) { + if (!type) { continue; } - if(!type->isMetaItem()) { + if (!type->isMetaItem()) { Brush* brush; - if(type->in_other_tileset) { + if (type->in_other_tileset) { others->getCategory(TILESET_RAW)->brushlist.push_back(type->raw_brush); continue; - } else if(!type->raw_brush) { + } else if (!type->raw_brush) { brush = type->raw_brush = newd RAWBrush(type->id); type->has_raw = true; g_brushes.addBrush(type->raw_brush); - } else if(!type->has_raw) { + } else if (!type->has_raw) { brush = type->raw_brush; - } else + } else { continue; + } brush->flagAsVisible(); others->getCategory(TILESET_RAW)->brushlist.push_back(type->raw_brush); @@ -274,11 +266,11 @@ void Materials::createOtherTileset() } } - for(MonsterMap::iterator iter = g_monsters.begin(); iter != g_monsters.end(); ++iter) { + for (MonsterMap::iterator iter = g_monsters.begin(); iter != g_monsters.end(); ++iter) { MonsterType* type = iter->second; - if(type->in_other_tileset) { + if (type->in_other_tileset) { others->getCategory(TILESET_MONSTER)->brushlist.push_back(type->brush); - } else if(type->brush == nullptr) { + } else if (type->brush == nullptr) { type->brush = newd MonsterBrush(type); g_brushes.addBrush(type->brush); type->brush->flagAsVisible(); @@ -289,10 +281,9 @@ void Materials::createOtherTileset() } } -void Materials::createNpcTileset() -{ +void Materials::createNpcTileset() { Tileset* npcTileset; - if(tilesets["NPCs"] != nullptr) { + if (tilesets["NPCs"] != nullptr) { npcTileset = tilesets["NPCs"]; npcTileset->clear(); } else { @@ -300,11 +291,11 @@ void Materials::createNpcTileset() tilesets["NPCs"] = npcTileset; } - for(NpcMap::iterator iter = g_npcs.begin(); iter != g_npcs.end(); ++iter) { + for (NpcMap::iterator iter = g_npcs.begin(); iter != g_npcs.end(); ++iter) { NpcType* type = iter->second; - if(type->in_other_tileset) { + if (type->in_other_tileset) { npcTileset->getCategory(TILESET_NPC)->brushlist.push_back(type->brush); - } else if(type->brush == nullptr) { + } else if (type->brush == nullptr) { type->brush = newd NpcBrush(type); g_brushes.addBrush(type->brush); type->brush->flagAsVisible(); @@ -314,48 +305,44 @@ void Materials::createNpcTileset() } } -bool Materials::unserializeTileset(pugi::xml_node node, wxArrayString& warnings) -{ +bool Materials::unserializeTileset(pugi::xml_node node, wxArrayString &warnings) { pugi::xml_attribute attribute; - if(!(attribute = node.attribute("name"))) { + if (!(attribute = node.attribute("name"))) { warnings.push_back("Couldn't read tileset name"); return false; } - const std::string& name = attribute.as_string(); + const std::string &name = attribute.as_string(); Tileset* tileset; auto it = tilesets.find(name); - if(it != tilesets.end()) { + if (it != tilesets.end()) { tileset = it->second; } else { tileset = newd Tileset(g_brushes, name); tilesets.insert(std::make_pair(name, tileset)); } - for(pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { + for (pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { tileset->loadCategory(childNode, warnings); } return true; } -bool Materials::isInTileset(Item* item, std::string tilesetName) const -{ - const ItemType& type = g_items.getItemType(item->getID()); - return type.id != 0 && ( - isInTileset(type.brush, tilesetName) || - isInTileset(type.doodad_brush, tilesetName) || - isInTileset(type.raw_brush, tilesetName)); +bool Materials::isInTileset(Item* item, std::string tilesetName) const { + const ItemType &type = g_items.getItemType(item->getID()); + return type.id != 0 && (isInTileset(type.brush, tilesetName) || isInTileset(type.doodad_brush, tilesetName) || isInTileset(type.raw_brush, tilesetName)); } -bool Materials::isInTileset(Brush* brush, std::string tilesetName) const -{ - if(!brush) +bool Materials::isInTileset(Brush* brush, std::string tilesetName) const { + if (!brush) { return false; + } TilesetContainer::const_iterator tilesetiter = tilesets.find(tilesetName); - if(tilesetiter == tilesets.end()) + if (tilesetiter == tilesets.end()) { return false; + } Tileset* tileset = tilesetiter->second; return tileset->containsBrush(brush); diff --git a/source/materials.h b/source/materials.h index ac7de762..a8995821 100644 --- a/source/materials.h +++ b/source/materials.h @@ -27,13 +27,13 @@ class Materials { void clear(); - const MaterialsExtensionList& getExtensions(); + const MaterialsExtensionList &getExtensions(); MaterialsExtensionList getExtensionsByVersion(uint16_t version_id); TilesetContainer tilesets; - bool loadMaterials(const FileName& identifier, wxString& error, wxArrayString& warnings); - bool loadExtensions(FileName identifier, wxString& error, wxArrayString& warnings); + bool loadMaterials(const FileName &identifier, wxString &error, wxArrayString &warnings); + bool loadExtensions(FileName identifier, wxString &error, wxArrayString &warnings); void createOtherTileset(); void createNpcTileset(); @@ -41,14 +41,14 @@ class Materials { bool isInTileset(Brush* brush, std::string tileset) const; protected: - bool unserializeMaterials(const FileName& filename, pugi::xml_node node, wxString& error, wxArrayString& warnings); - bool unserializeTileset(pugi::xml_node node, wxArrayString& warnings); + bool unserializeMaterials(const FileName &filename, pugi::xml_node node, wxString &error, wxArrayString &warnings); + bool unserializeTileset(pugi::xml_node node, wxArrayString &warnings); MaterialsExtensionList extensions; private: - Materials(const Materials&); - Materials& operator=(const Materials&); + Materials(const Materials &); + Materials &operator=(const Materials &); }; extern Materials g_materials; diff --git a/source/minimap_window.cpp b/source/minimap_window.cpp index 8d6987ca..353aea33 100644 --- a/source/minimap_window.cpp +++ b/source/minimap_window.cpp @@ -26,67 +26,62 @@ #include "minimap_window.h" BEGIN_EVENT_TABLE(MinimapWindow, wxPanel) - EVT_LEFT_DOWN(MinimapWindow::OnMouseClick) - EVT_SIZE(MinimapWindow::OnSize) - EVT_PAINT(MinimapWindow::OnPaint) - EVT_ERASE_BACKGROUND(MinimapWindow::OnEraseBackground) - EVT_CLOSE(MinimapWindow::OnClose) - EVT_TIMER(wxID_ANY, MinimapWindow::OnDelayedUpdate) - EVT_KEY_DOWN(MinimapWindow::OnKey) +EVT_LEFT_DOWN(MinimapWindow::OnMouseClick) +EVT_SIZE(MinimapWindow::OnSize) +EVT_PAINT(MinimapWindow::OnPaint) +EVT_ERASE_BACKGROUND(MinimapWindow::OnEraseBackground) +EVT_CLOSE(MinimapWindow::OnClose) +EVT_TIMER(wxID_ANY, MinimapWindow::OnDelayedUpdate) +EVT_KEY_DOWN(MinimapWindow::OnKey) END_EVENT_TABLE() MinimapWindow::MinimapWindow(wxWindow* parent) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(205, 130)), - update_timer(this) -{ - for(int i = 0; i < 256; ++i) { + update_timer(this) { + for (int i = 0; i < 256; ++i) { pens[i] = new wxPen(colorFromEightBit(i)); } } -MinimapWindow::~MinimapWindow() -{ - for(int i = 0; i < 256; ++i) { +MinimapWindow::~MinimapWindow() { + for (int i = 0; i < 256; ++i) { delete pens[i]; } } -void MinimapWindow::OnSize(wxSizeEvent& event) -{ +void MinimapWindow::OnSize(wxSizeEvent &event) { Refresh(); } -void MinimapWindow::OnClose(wxCloseEvent&) -{ +void MinimapWindow::OnClose(wxCloseEvent &) { g_gui.DestroyMinimap(); } -void MinimapWindow::DelayedUpdate() -{ +void MinimapWindow::DelayedUpdate() { // We only updated the window AFTER actions have taken place, that // way we don't waste too much performance on updating this window update_timer.Start(g_settings.getInteger(Config::MINIMAP_UPDATE_DELAY), true); } -void MinimapWindow::OnDelayedUpdate(wxTimerEvent& event) -{ +void MinimapWindow::OnDelayedUpdate(wxTimerEvent &event) { Refresh(); } -void MinimapWindow::OnPaint(wxPaintEvent& event) -{ +void MinimapWindow::OnPaint(wxPaintEvent &event) { wxBufferedPaintDC pdc(this); pdc.SetBackground(*wxBLACK_BRUSH); pdc.Clear(); - if(!g_gui.IsEditorOpen()) return; - Editor& editor = *g_gui.GetCurrentEditor(); - const Map& map = editor.getMap(); + if (!g_gui.IsEditorOpen()) { + return; + } + Editor &editor = *g_gui.GetCurrentEditor(); + const Map &map = editor.getMap(); int window_width = GetSize().GetWidth(); int window_height = GetSize().GetHeight(); - //printf("W:%d\tH:%d\n", window_width, window_height); + // printf("W:%d\tH:%d\n", window_width, window_height); int center_x, center_y; MapCanvas* canvas = g_gui.GetCurrentMapTab()->GetCanvas(); @@ -94,23 +89,23 @@ void MinimapWindow::OnPaint(wxPaintEvent& event) int start_x, start_y; int end_x, end_y; - start_x = center_x - window_width/2; - start_y = center_y - window_height/2; + start_x = center_x - window_width / 2; + start_y = center_y - window_height / 2; - end_x = center_x + window_width/2; - end_y = center_y + window_height/2; + end_x = center_x + window_width / 2; + end_y = center_y + window_height / 2; - if(start_x < 0) { + if (start_x < 0) { start_x = 0; end_x = window_width; - } else if(end_x > map.getWidth()) { + } else if (end_x > map.getWidth()) { start_x = map.getWidth() - window_width; end_x = map.getWidth(); } - if(start_y < 0) { + if (start_y < 0) { start_y = 0; end_y = window_height; - } else if(end_y > map.getHeight()) { + } else if (end_y > map.getHeight()) { start_y = map.getHeight() - window_height; end_y = map.getHeight(); } @@ -125,16 +120,16 @@ void MinimapWindow::OnPaint(wxPaintEvent& event) int floor = g_gui.GetCurrentFloor(); - //printf("Draw from %d:%d to %d:%d\n", start_x, start_y, end_x, end_y); + // printf("Draw from %d:%d to %d:%d\n", start_x, start_y, end_x, end_y); uint8_t last = 0; - if(g_gui.IsRenderingEnabled()) { - for(int y = start_y, window_y = 0; y <= end_y; ++y, ++window_y) { - for(int x = start_x, window_x = 0; x <= end_x; ++x, ++window_x) { + if (g_gui.IsRenderingEnabled()) { + for (int y = start_y, window_y = 0; y <= end_y; ++y, ++window_y) { + for (int x = start_x, window_x = 0; x <= end_x; ++x, ++window_x) { const Tile* tile = map.getTile(x, y, floor); - if(tile) { + if (tile) { uint8_t color = tile->getMiniMapColor(); - if(color) { - if(last != color) { + if (color) { + if (last != color) { pdc.SetPen(*pens[color]); last = color; } @@ -144,7 +139,7 @@ void MinimapWindow::OnPaint(wxPaintEvent& event) } } - if(g_settings.getInteger(Config::MINIMAP_VIEW_BOX)) { + if (g_settings.getInteger(Config::MINIMAP_VIEW_BOX)) { pdc.SetPen(*wxWHITE_PEN); // Draw the rectangle on the minimap @@ -168,11 +163,11 @@ void MinimapWindow::OnPaint(wxPaintEvent& event) view_end_x = view_start_x + screensize_x / tile_size + 1; view_end_y = view_start_y + screensize_y / tile_size + 1; - for(int x = view_start_x; x <= view_end_x; ++x) { + for (int x = view_start_x; x <= view_end_x; ++x) { pdc.DrawPoint(x - start_x, view_start_y - start_y); pdc.DrawPoint(x - start_x, view_end_y - start_y); } - for(int y = view_start_y; y < view_end_y; ++y) { + for (int y = view_start_y; y < view_end_y; ++y) { pdc.DrawPoint(view_start_x - start_x, y - start_y); pdc.DrawPoint(view_end_x - start_x, y - start_y); } @@ -180,9 +175,10 @@ void MinimapWindow::OnPaint(wxPaintEvent& event) } } -void MinimapWindow::OnMouseClick(wxMouseEvent& event) -{ - if(!g_gui.IsEditorOpen()) return; +void MinimapWindow::OnMouseClick(wxMouseEvent &event) { + if (!g_gui.IsEditorOpen()) { + return; + } int new_map_x = last_start_x + event.GetX(); int new_map_y = last_start_y + event.GetY(); g_gui.SetScreenCenterPosition(Position(new_map_x, new_map_y, g_gui.GetCurrentFloor())); @@ -190,9 +186,8 @@ void MinimapWindow::OnMouseClick(wxMouseEvent& event) g_gui.RefreshView(); } -void MinimapWindow::OnKey(wxKeyEvent& event) -{ - if(g_gui.GetCurrentTab() != nullptr) { +void MinimapWindow::OnKey(wxKeyEvent &event) { + if (g_gui.GetCurrentTab() != nullptr) { g_gui.GetCurrentMapTab()->GetEventHandler()->AddPendingEvent(event); } } diff --git a/source/minimap_window.h b/source/minimap_window.h index e623c9f9..8a1dd518 100644 --- a/source/minimap_window.h +++ b/source/minimap_window.h @@ -23,18 +23,19 @@ class MinimapWindow : public wxPanel { MinimapWindow(wxWindow* parent); virtual ~MinimapWindow(); - void OnPaint(wxPaintEvent&); - void OnEraseBackground(wxEraseEvent&) {} - void OnMouseClick(wxMouseEvent&); - void OnSize(wxSizeEvent&); - void OnClose(wxCloseEvent&); + void OnPaint(wxPaintEvent &); + void OnEraseBackground(wxEraseEvent &) { } + void OnMouseClick(wxMouseEvent &); + void OnSize(wxSizeEvent &); + void OnClose(wxCloseEvent &); void DelayedUpdate(); - void OnDelayedUpdate(wxTimerEvent& event); - void OnKey(wxKeyEvent& event); + void OnDelayedUpdate(wxTimerEvent &event); + void OnKey(wxKeyEvent &event); + protected: wxPen* pens[256]; - wxTimer update_timer; + wxTimer update_timer; int last_start_x; int last_start_y; diff --git a/source/monster.cpp b/source/monster.cpp index 9ad9d199..5cc17c59 100644 --- a/source/monster.cpp +++ b/source/monster.cpp @@ -23,23 +23,22 @@ Monster::Monster(MonsterType* type) : direction(NORTH), spawntime(0), saved(false), - selected(false) -{ - if(type) + selected(false) { + if (type) { type_name = type->name; + } } -Monster::Monster(const std::string& type_name) :type_name(type_name), +Monster::Monster(const std::string &type_name) : + type_name(type_name), direction(NORTH), spawntime(0), saved(false), - selected(false) -{ + selected(false) { //// } -Monster* Monster::deepCopy() const -{ +Monster* Monster::deepCopy() const { Monster* copy = newd Monster(type_name); copy->spawntime = spawntime; copy->direction = direction; @@ -48,50 +47,59 @@ Monster* Monster::deepCopy() const return copy; } -const Outfit& Monster::getLookType() const -{ +const Outfit &Monster::getLookType() const { const MonsterType* type = g_monsters[type_name]; - if(type) + if (type) { return type->outfit; + } static const Outfit otfi; // Empty outfit return otfi; } -std::string Monster::getName() const -{ +std::string Monster::getName() const { const MonsterType* type = g_monsters[type_name]; - if(type) { + if (type) { return type->name; } return ""; } -MonsterBrush* Monster::getBrush() const -{ +MonsterBrush* Monster::getBrush() const { const MonsterType* type = g_monsters[type_name]; - if(type) { + if (type) { return type->brush; } return nullptr; } -std::string Monster::DirID2Name(uint16_t id) -{ +std::string Monster::DirID2Name(uint16_t id) { switch (id) { - case NORTH: return "North"; - case EAST: return "East"; - case SOUTH: return "South"; - case WEST: return "West"; - default: return "Unknown"; + case NORTH: + return "North"; + case EAST: + return "East"; + case SOUTH: + return "South"; + case WEST: + return "West"; + default: + return "Unknown"; } } -uint16_t Monster::DirName2ID(std::string dir) -{ +uint16_t Monster::DirName2ID(std::string dir) { to_lower_str(dir); - if(dir == "north") return NORTH; - if(dir == "east") return EAST; - if(dir == "south") return SOUTH; - if(dir == "west") return WEST; + if (dir == "north") { + return NORTH; + } + if (dir == "east") { + return EAST; + } + if (dir == "south") { + return SOUTH; + } + if (dir == "west") { + return WEST; + } return SOUTH; } diff --git a/source/monster.h b/source/monster.h index 45a4decb..43691cc5 100644 --- a/source/monster.h +++ b/source/monster.h @@ -24,28 +24,48 @@ class Monster { public: Monster(MonsterType* type); - Monster(const std::string& type_name); + Monster(const std::string &type_name); Monster* deepCopy() const; - const Outfit& getLookType() const; + const Outfit &getLookType() const; - bool isSaved() const noexcept { return saved; } - void save() noexcept { saved = true; } - void reset() noexcept { saved = false; } + bool isSaved() const noexcept { + return saved; + } + void save() noexcept { + saved = true; + } + void reset() noexcept { + saved = false; + } - bool isSelected() const noexcept { return selected; } - void deselect() noexcept { selected = false; } - void select() noexcept { selected = true; } + bool isSelected() const noexcept { + return selected; + } + void deselect() noexcept { + selected = false; + } + void select() noexcept { + selected = true; + } std::string getName() const; MonsterBrush* getBrush() const; - int getSpawnMonsterTime() const noexcept {return spawntime;} - void setSpawnMonsterTime(int time) noexcept { spawntime = time; } + int getSpawnMonsterTime() const noexcept { + return spawntime; + } + void setSpawnMonsterTime(int time) noexcept { + spawntime = time; + } - Direction getDirection() const noexcept { return direction; } - void setDirection(Direction _direction) noexcept { direction = _direction; } + Direction getDirection() const noexcept { + return direction; + } + void setDirection(Direction _direction) noexcept { + direction = _direction; + } // Static conversions static std::string DirID2Name(uint16_t id); diff --git a/source/monster_brush.cpp b/source/monster_brush.cpp index 43d6cbb2..88e34d4f 100644 --- a/source/monster_brush.cpp +++ b/source/monster_brush.cpp @@ -29,35 +29,31 @@ MonsterBrush::MonsterBrush(MonsterType* type) : Brush(), - monster_type(type) -{ + monster_type(type) { ASSERT(type->brush == nullptr); type->brush = this; } -MonsterBrush::~MonsterBrush() -{ +MonsterBrush::~MonsterBrush() { //// } -int MonsterBrush::getLookID() const -{ +int MonsterBrush::getLookID() const { return 0; } -std::string MonsterBrush::getName() const -{ - if(monster_type) +std::string MonsterBrush::getName() const { + if (monster_type) { return monster_type->name; + } return "Monster Brush"; } -bool MonsterBrush::canDraw(BaseMap* map, const Position& position) const -{ +bool MonsterBrush::canDraw(BaseMap* map, const Position &position) const { Tile* tile = map->getTile(position); - if(monster_type && tile && !tile->isBlocking()) { - if(tile->getLocation()->getSpawnMonsterCount() != 0 || g_settings.getInteger(Config::AUTO_CREATE_SPAWN_MONSTER)) { - if(tile->isPZ()) { + if (monster_type && tile && !tile->isBlocking()) { + if (tile->getLocation()->getSpawnMonsterCount() != 0 || g_settings.getInteger(Config::AUTO_CREATE_SPAWN_MONSTER)) { + if (tile->isPZ()) { return false; } else { return true; @@ -67,20 +63,18 @@ bool MonsterBrush::canDraw(BaseMap* map, const Position& position) const return false; } -void MonsterBrush::undraw(BaseMap* map, Tile* tile) -{ +void MonsterBrush::undraw(BaseMap* map, Tile* tile) { delete tile->monster; tile->monster = nullptr; } -void MonsterBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void MonsterBrush::draw(BaseMap* map, Tile* tile, void* parameter) { ASSERT(tile); ASSERT(parameter); - if(canDraw(map, tile->getPosition())) { + if (canDraw(map, tile->getPosition())) { undraw(map, tile); - if(monster_type) { - if(tile->spawnMonster == nullptr && tile->getLocation()->getSpawnMonsterCount() == 0) { + if (monster_type) { + if (tile->spawnMonster == nullptr && tile->getLocation()->getSpawnMonsterCount() == 0) { // manually place spawnMonster on location tile->spawnMonster = newd SpawnMonster(1); } diff --git a/source/monster_brush.h b/source/monster_brush.h index 26337930..993b9a6d 100644 --- a/source/monster_brush.h +++ b/source/monster_brush.h @@ -23,27 +23,38 @@ //============================================================================= // MonsterBrush, place monsters -class MonsterBrush : public Brush -{ +class MonsterBrush : public Brush { public: MonsterBrush(MonsterType* type); // Create a RAWBrush of the specified type virtual ~MonsterBrush(); - bool isMonster() const { return true; } - MonsterBrush* asMonster() { return static_cast(this); } + bool isMonster() const { + return true; + } + MonsterBrush* asMonster() { + return static_cast(this); + } - virtual bool canDraw(BaseMap* map, const Position& position) const; + virtual bool canDraw(BaseMap* map, const Position &position) const; virtual void draw(BaseMap* map, Tile* tile, void* parameter); void draw_creature(BaseMap* map, Tile* tile); virtual void undraw(BaseMap* map, Tile* tile); - MonsterType* getType() const {return monster_type;} + MonsterType* getType() const { + return monster_type; + } virtual int getLookID() const; // We don't have a look type, this will always return 0 virtual std::string getName() const; - virtual bool canDrag() const { return false; } - virtual bool canSmear() const { return true; } - virtual bool oneSizeFitsAll() const { return true; } + virtual bool canDrag() const { + return false; + } + virtual bool canSmear() const { + return true; + } + virtual bool oneSizeFitsAll() const { + return true; + } protected: MonsterType* monster_type; diff --git a/source/monsters.cpp b/source/monsters.cpp index c6b1d4d5..681d8c89 100644 --- a/source/monsters.cpp +++ b/source/monsters.cpp @@ -30,24 +30,21 @@ MonsterType::MonsterType() : in_other_tileset(false), standard(false), name(""), - brush(nullptr) -{ + brush(nullptr) { //// } -MonsterType::MonsterType(const MonsterType& ct) : +MonsterType::MonsterType(const MonsterType &ct) : missing(ct.missing), in_other_tileset(ct.in_other_tileset), standard(ct.standard), name(ct.name), outfit(ct.outfit), - brush(ct.brush) -{ + brush(ct.brush) { //// } -MonsterType& MonsterType::operator=(const MonsterType& ct) -{ +MonsterType &MonsterType::operator=(const MonsterType &ct) { missing = ct.missing; in_other_tileset = ct.in_other_tileset; standard = ct.standard; @@ -57,15 +54,13 @@ MonsterType& MonsterType::operator=(const MonsterType& ct) return *this; } -MonsterType::~MonsterType() -{ +MonsterType::~MonsterType() { //// } -MonsterType* MonsterType::loadFromXML(pugi::xml_node node, wxArrayString& warnings) -{ +MonsterType* MonsterType::loadFromXML(pugi::xml_node node, wxArrayString &warnings) { pugi::xml_attribute attribute; - if(!(attribute = node.attribute("name"))) { + if (!(attribute = node.attribute("name"))) { warnings.push_back("Couldn't read name tag of monster node."); return nullptr; } @@ -73,14 +68,14 @@ MonsterType* MonsterType::loadFromXML(pugi::xml_node node, wxArrayString& warnin MonsterType* ct = newd MonsterType(); ct->name = attribute.as_string(); - if((attribute = node.attribute("looktype"))) { + if ((attribute = node.attribute("looktype"))) { ct->outfit.lookType = attribute.as_int(); - if(g_gui.gfx.getCreatureSprite(ct->outfit.lookType) == nullptr) { + if (g_gui.gfx.getCreatureSprite(ct->outfit.lookType) == nullptr) { warnings.push_back("Invalid monster \"" + wxstr(ct->name) + "\" look type #" + std::to_string(ct->outfit.lookType)); } } - if((attribute = node.attribute("lookitem"))) { + if ((attribute = node.attribute("lookitem"))) { ct->outfit.lookItem = attribute.as_int(); } @@ -88,39 +83,38 @@ MonsterType* MonsterType::loadFromXML(pugi::xml_node node, wxArrayString& warnin ct->outfit.lookMount = attribute.as_int(); } - if((attribute = node.attribute("lookaddon"))) { + if ((attribute = node.attribute("lookaddon"))) { ct->outfit.lookAddon = attribute.as_int(); } - if((attribute = node.attribute("lookhead"))) { + if ((attribute = node.attribute("lookhead"))) { ct->outfit.lookHead = attribute.as_int(); } - if((attribute = node.attribute("lookbody"))) { + if ((attribute = node.attribute("lookbody"))) { ct->outfit.lookBody = attribute.as_int(); } - if((attribute = node.attribute("looklegs"))) { + if ((attribute = node.attribute("looklegs"))) { ct->outfit.lookLegs = attribute.as_int(); } - if((attribute = node.attribute("lookfeet"))) { + if ((attribute = node.attribute("lookfeet"))) { ct->outfit.lookFeet = attribute.as_int(); } return ct; } -MonsterType* MonsterType::loadFromOTXML(const FileName& filename, pugi::xml_document& doc, wxArrayString& warnings) -{ +MonsterType* MonsterType::loadFromOTXML(const FileName &filename, pugi::xml_document &doc, wxArrayString &warnings) { ASSERT(doc != nullptr); pugi::xml_node node; - if(!(node = doc.child("monster"))) { + if (!(node = doc.child("monster"))) { warnings.push_back("This file is not a monster file"); return nullptr; } pugi::xml_attribute attribute; - if(!(attribute = node.attribute("name"))) { + if (!(attribute = node.attribute("name"))) { warnings.push_back("Couldn't read name tag of monster node."); return nullptr; } @@ -128,16 +122,16 @@ MonsterType* MonsterType::loadFromOTXML(const FileName& filename, pugi::xml_docu MonsterType* ct = newd MonsterType(); ct->name = attribute.as_string(); - for(pugi::xml_node optionNode = node.first_child(); optionNode; optionNode = optionNode.next_sibling()) { - if(as_lower_str(optionNode.name()) != "look") { + for (pugi::xml_node optionNode = node.first_child(); optionNode; optionNode = optionNode.next_sibling()) { + if (as_lower_str(optionNode.name()) != "look") { continue; } - if((attribute = optionNode.attribute("type"))) { + if ((attribute = optionNode.attribute("type"))) { ct->outfit.lookType = attribute.as_int(); } - if((attribute = optionNode.attribute("item")) || (attribute = optionNode.attribute("lookex")) || (attribute = optionNode.attribute("typeex"))) { + if ((attribute = optionNode.attribute("item")) || (attribute = optionNode.attribute("lookex")) || (attribute = optionNode.attribute("typeex"))) { ct->outfit.lookItem = attribute.as_int(); } @@ -145,58 +139,53 @@ MonsterType* MonsterType::loadFromOTXML(const FileName& filename, pugi::xml_docu ct->outfit.lookMount = attribute.as_int(); } - if((attribute = optionNode.attribute("addon"))) { + if ((attribute = optionNode.attribute("addon"))) { ct->outfit.lookAddon = attribute.as_int(); } - if((attribute = optionNode.attribute("head"))) { + if ((attribute = optionNode.attribute("head"))) { ct->outfit.lookHead = attribute.as_int(); } - if((attribute = optionNode.attribute("body"))) { + if ((attribute = optionNode.attribute("body"))) { ct->outfit.lookBody = attribute.as_int(); } - if((attribute = optionNode.attribute("legs"))) { + if ((attribute = optionNode.attribute("legs"))) { ct->outfit.lookLegs = attribute.as_int(); } - if((attribute = optionNode.attribute("feet"))) { + if ((attribute = optionNode.attribute("feet"))) { ct->outfit.lookFeet = attribute.as_int(); } } return ct; } -MonsterDatabase::MonsterDatabase() -{ +MonsterDatabase::MonsterDatabase() { //// } -MonsterDatabase::~MonsterDatabase() -{ +MonsterDatabase::~MonsterDatabase() { clear(); } -void MonsterDatabase::clear() -{ - for(MonsterMap::iterator iter = monster_map.begin(); iter != monster_map.end(); ++iter) { +void MonsterDatabase::clear() { + for (MonsterMap::iterator iter = monster_map.begin(); iter != monster_map.end(); ++iter) { delete iter->second; } monster_map.clear(); } -MonsterType* MonsterDatabase::operator[](const std::string& name) -{ +MonsterType* MonsterDatabase::operator[](const std::string &name) { MonsterMap::iterator iter = monster_map.find(as_lower_str(name)); - if(iter != monster_map.end()) { + if (iter != monster_map.end()) { return iter->second; } return nullptr; } -MonsterType* MonsterDatabase::addMissingMonsterType(const std::string& name) -{ +MonsterType* MonsterDatabase::addMissingMonsterType(const std::string &name) { assert((*this)[name] == nullptr); MonsterType* ct = newd MonsterType(); @@ -208,8 +197,7 @@ MonsterType* MonsterDatabase::addMissingMonsterType(const std::string& name) return ct; } -MonsterType* MonsterDatabase::addMonsterType(const std::string& name, const Outfit& outfit) -{ +MonsterType* MonsterDatabase::addMonsterType(const std::string &name, const Outfit &outfit) { assert((*this)[name] == nullptr); MonsterType* ct = newd MonsterType(); @@ -221,40 +209,38 @@ MonsterType* MonsterDatabase::addMonsterType(const std::string& name, const Outf return ct; } -bool MonsterDatabase::hasMissing() const -{ - for(MonsterMap::const_iterator iter = monster_map.begin(); iter != monster_map.end(); ++iter) { - if(iter->second->missing) { +bool MonsterDatabase::hasMissing() const { + for (MonsterMap::const_iterator iter = monster_map.begin(); iter != monster_map.end(); ++iter) { + if (iter->second->missing) { return true; } } return false; } -bool MonsterDatabase::loadFromXML(const FileName& filename, bool standard, wxString& error, wxArrayString& warnings) -{ +bool MonsterDatabase::loadFromXML(const FileName &filename, bool standard, wxString &error, wxArrayString &warnings) { pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(filename.GetFullPath().mb_str()); - if(!result) { + if (!result) { error = "Couldn't open file \"" + filename.GetFullName() + "\", invalid format?"; return false; } pugi::xml_node node = doc.child("monsters"); - if(!node) { + if (!node) { error = "Invalid file signature, this file is not a valid monsters file."; return false; } - for(pugi::xml_node monsterNode = node.first_child(); monsterNode; monsterNode = monsterNode.next_sibling()) { - if(as_lower_str(monsterNode.name()) != "monster") { + for (pugi::xml_node monsterNode = node.first_child(); monsterNode; monsterNode = monsterNode.next_sibling()) { + if (as_lower_str(monsterNode.name()) != "monster") { continue; } MonsterType* monsterType = MonsterType::loadFromXML(monsterNode, warnings); - if(monsterType) { + if (monsterType) { monsterType->standard = standard; - if((*this)[monsterType->name]) { + if ((*this)[monsterType->name]) { warnings.push_back("Duplicate monster type name \"" + wxstr(monsterType->name) + "\"! Discarding..."); delete monsterType; } else { @@ -265,24 +251,23 @@ bool MonsterDatabase::loadFromXML(const FileName& filename, bool standard, wxStr return true; } -bool MonsterDatabase::importXMLFromOT(const FileName& filename, wxString& error, wxArrayString& warnings) -{ +bool MonsterDatabase::importXMLFromOT(const FileName &filename, wxString &error, wxArrayString &warnings) { pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(filename.GetFullPath().mb_str()); - if(!result) { + if (!result) { error = "Couldn't open file \"" + filename.GetFullName() + "\", invalid format?"; return false; } pugi::xml_node node; - if((node = doc.child("monsters"))) { - for(pugi::xml_node monsterNode = node.first_child(); monsterNode; monsterNode = monsterNode.next_sibling()) { - if(as_lower_str(monsterNode.name()) != "monster") { + if ((node = doc.child("monsters"))) { + for (pugi::xml_node monsterNode = node.first_child(); monsterNode; monsterNode = monsterNode.next_sibling()) { + if (as_lower_str(monsterNode.name()) != "monster") { continue; } pugi::xml_attribute attribute; - if(!(attribute = monsterNode.attribute("file"))) { + if (!(attribute = monsterNode.attribute("file"))) { continue; } @@ -291,14 +276,14 @@ bool MonsterDatabase::importXMLFromOT(const FileName& filename, wxString& error, pugi::xml_document monsterDoc; pugi::xml_parse_result monsterResult = monsterDoc.load_file(monsterFile.GetFullPath().mb_str()); - if(!monsterResult) { + if (!monsterResult) { continue; } MonsterType* monsterType = MonsterType::loadFromOTXML(monsterFile, monsterDoc, warnings); - if(monsterType) { + if (monsterType) { MonsterType* current = (*this)[monsterType->name]; - if(current) { + if (current) { *current = *monsterType; delete monsterType; } else { @@ -316,12 +301,12 @@ bool MonsterDatabase::importXMLFromOT(const FileName& filename, wxString& error, } } } - } else if((node = doc.child("monster"))) { + } else if ((node = doc.child("monster"))) { MonsterType* monsterType = MonsterType::loadFromOTXML(filename, doc, warnings); - if(monsterType) { + if (monsterType) { MonsterType* current = (*this)[monsterType->name]; - if(current) { + if (current) { *current = *monsterType; delete monsterType; } else { @@ -345,23 +330,22 @@ bool MonsterDatabase::importXMLFromOT(const FileName& filename, wxString& error, return true; } -bool MonsterDatabase::saveToXML(const FileName& filename) -{ +bool MonsterDatabase::saveToXML(const FileName &filename) { pugi::xml_document doc; pugi::xml_node decl = doc.prepend_child(pugi::node_declaration); decl.append_attribute("version") = "1.0"; pugi::xml_node monsterNodes = doc.append_child("monsters"); - for(const auto& monsterEntry : monster_map) { + for (const auto &monsterEntry : monster_map) { MonsterType* monsterType = monsterEntry.second; - if(!monsterType->standard) { + if (!monsterType->standard) { pugi::xml_node monsterNode = monsterNodes.append_child("monster"); - + monsterNode.append_attribute("name") = monsterType->name.c_str(); monsterNode.append_attribute("type") = "monster"; - const Outfit& outfit = monsterType->outfit; + const Outfit &outfit = monsterType->outfit; monsterNode.append_attribute("looktype") = outfit.lookType; monsterNode.append_attribute("lookitem") = outfit.lookItem; monsterNode.append_attribute("lookaddon") = outfit.lookAddon; diff --git a/source/monsters.h b/source/monsters.h index ba4f12d5..0be83b96 100644 --- a/source/monsters.h +++ b/source/monsters.h @@ -28,8 +28,7 @@ class MonsterBrush; typedef std::map MonsterMap; -class MonsterDatabase -{ +class MonsterDatabase { protected: MonsterMap monster_map; @@ -42,25 +41,29 @@ class MonsterDatabase void clear(); - MonsterType* operator[](const std::string& name); - MonsterType* addMissingMonsterType(const std::string& name); - MonsterType* addMonsterType(const std::string& name, const Outfit& outfit); + MonsterType* operator[](const std::string &name); + MonsterType* addMissingMonsterType(const std::string &name); + MonsterType* addMonsterType(const std::string &name, const Outfit &outfit); bool hasMissing() const; - iterator begin() noexcept { return monster_map.begin(); } - iterator end() noexcept { return monster_map.end(); } + iterator begin() noexcept { + return monster_map.begin(); + } + iterator end() noexcept { + return monster_map.end(); + } - bool loadFromXML(const FileName& filename, bool standard, wxString& error, wxArrayString& warnings); - bool importXMLFromOT(const FileName& filename, wxString& error, wxArrayString& warnings); + bool loadFromXML(const FileName &filename, bool standard, wxString &error, wxArrayString &warnings); + bool importXMLFromOT(const FileName &filename, wxString &error, wxArrayString &warnings); - bool saveToXML(const FileName& filename); + bool saveToXML(const FileName &filename); }; class MonsterType { public: MonsterType(); - MonsterType(const MonsterType& ct); - MonsterType& operator=(const MonsterType& ct); + MonsterType(const MonsterType &ct); + MonsterType &operator=(const MonsterType &ct); ~MonsterType(); bool missing; @@ -70,8 +73,8 @@ class MonsterType { Outfit outfit; MonsterBrush* brush; - static MonsterType* loadFromXML(pugi::xml_node node, wxArrayString& warnings); - static MonsterType* loadFromOTXML(const FileName& filename, pugi::xml_document& node, wxArrayString& warnings); + static MonsterType* loadFromXML(pugi::xml_node node, wxArrayString &warnings); + static MonsterType* loadFromOTXML(const FileName &filename, pugi::xml_document &node, wxArrayString &warnings); }; extern MonsterDatabase g_monsters; diff --git a/source/mt_rand.cpp b/source/mt_rand.cpp index 1c7ecca1..3b9f79ca 100644 --- a/source/mt_rand.cpp +++ b/source/mt_rand.cpp @@ -17,11 +17,11 @@ #include "main.h" -static inline unsigned long int mt_get (void *vstate); -static double mt_get_double (void *vstate); -static void mt_set (void *state, unsigned long int s); +static inline unsigned long int mt_get(void* vstate); +static double mt_get_double(void* vstate); +static void mt_set(void* state, unsigned long int s); -#define N 624 /* Period parameters */ +#define N 624 /* Period parameters */ #define M 397 /* most significant w-r bits */ @@ -31,87 +31,79 @@ static const unsigned long UPPER_MASK = 0x80000000UL; static const unsigned long LOWER_MASK = 0x7fffffffUL; typedef struct - { - unsigned long mt[N]; - int mti; - } -mt_state_t; +{ + unsigned long mt[N]; + int mti; +} mt_state_t; static inline unsigned long -mt_get (void *vstate) -{ - mt_state_t *state = (mt_state_t *) vstate; +mt_get(void* vstate) { + mt_state_t* state = (mt_state_t*)vstate; - unsigned long k ; - unsigned long int *const mt = state->mt; + unsigned long k; + unsigned long int* const mt = state->mt; #define MAGIC(y) (((y)&0x1) ? 0x9908b0dfUL : 0) - if(state->mti >= N) - { /* generate N words at one time */ - int kk; + if (state->mti >= N) { /* generate N words at one time */ + int kk; - for(kk = 0; kk < N - M; kk++) - { - unsigned long y = (mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK); - mt[kk] = mt[kk + M] ^ (y >> 1) ^ MAGIC(y); - } - for(; kk < N - 1; kk++) - { - unsigned long y = (mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK); - mt[kk] = mt[kk + (M - N)] ^ (y >> 1) ^ MAGIC(y); - } + for (kk = 0; kk < N - M; kk++) { + unsigned long y = (mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK); + mt[kk] = mt[kk + M] ^ (y >> 1) ^ MAGIC(y); + } + for (; kk < N - 1; kk++) { + unsigned long y = (mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK); + mt[kk] = mt[kk + (M - N)] ^ (y >> 1) ^ MAGIC(y); + } - { - unsigned long y = (mt[N - 1] & UPPER_MASK) | (mt[0] & LOWER_MASK); - mt[N - 1] = mt[M - 1] ^ (y >> 1) ^ MAGIC(y); - } + { + unsigned long y = (mt[N - 1] & UPPER_MASK) | (mt[0] & LOWER_MASK); + mt[N - 1] = mt[M - 1] ^ (y >> 1) ^ MAGIC(y); + } - state->mti = 0; - } + state->mti = 0; + } - /* Tempering */ + /* Tempering */ - k = mt[state->mti]; - k ^= (k >> 11); - k ^= (k << 7) & 0x9d2c5680UL; - k ^= (k << 15) & 0xefc60000UL; - k ^= (k >> 18); + k = mt[state->mti]; + k ^= (k >> 11); + k ^= (k << 7) & 0x9d2c5680UL; + k ^= (k << 15) & 0xefc60000UL; + k ^= (k >> 18); - state->mti++; + state->mti++; - return k; + return k; } static double -mt_get_double (void * vstate) -{ - return mt_get (vstate) / 4294967296.0 ; +mt_get_double(void* vstate) { + return mt_get(vstate) / 4294967296.0; } static void -mt_set (void *vstate, unsigned long int s) -{ - mt_state_t *state = (mt_state_t *) vstate; - int i; +mt_set(void* vstate, unsigned long int s) { + mt_state_t* state = (mt_state_t*)vstate; + int i; - if(s == 0) - s = 4357; /* the default seed is 4357 */ + if (s == 0) { + s = 4357; /* the default seed is 4357 */ + } - state->mt[0]= s & 0xffffffffUL; + state->mt[0] = s & 0xffffffffUL; - for(i = 1; i < N; i++) - { - /* See Knuth's "Art of Computer Programming" Vol. 2, 3rd - Ed. p.106 for multiplier. */ + for (i = 1; i < N; i++) { + /* See Knuth's "Art of Computer Programming" Vol. 2, 3rd + Ed. p.106 for multiplier. */ - state->mt[i] = - (1812433253UL * (state->mt[i-1] ^ (state->mt[i-1] >> 30)) + i); + state->mt[i] = (1812433253UL * (state->mt[i - 1] ^ (state->mt[i - 1] >> 30)) + i); - state->mt[i] &= 0xffffffffUL; - } + state->mt[i] &= 0xffffffffUL; + } - state->mti = i; + state->mti = i; } static mt_state_t mt_state; diff --git a/source/net_connection.cpp b/source/net_connection.cpp index 68291148..981b48d0 100644 --- a/source/net_connection.cpp +++ b/source/net_connection.cpp @@ -18,36 +18,33 @@ #include "main.h" #include "net_connection.h" -NetworkMessage::NetworkMessage() -{ +NetworkMessage::NetworkMessage() { clear(); } -void NetworkMessage::clear() -{ +void NetworkMessage::clear() { buffer.resize(4); position = 4; size = 0; } -void NetworkMessage::expand(const size_t length) -{ - if(position + length >= buffer.size()) { +void NetworkMessage::expand(const size_t length) { + if (position + length >= buffer.size()) { buffer.resize(position + length + 1); } size += length; } -template<> std::string NetworkMessage::read() -{ +template <> +std::string NetworkMessage::read() { const uint16_t length = read(); char* strBuffer = reinterpret_cast(&buffer[position]); position += length; return std::string(strBuffer, length); } -template<> Position NetworkMessage::read() -{ +template <> +Position NetworkMessage::read() { Position position; position.x = read(); position.y = read(); @@ -55,8 +52,8 @@ template<> Position NetworkMessage::read() return position; } -template<> void NetworkMessage::write(const std::string& value) -{ +template <> +void NetworkMessage::write(const std::string &value) { const size_t length = value.length(); write(length); @@ -65,8 +62,8 @@ template<> void NetworkMessage::write(const std::string& value) position += length; } -template<> void NetworkMessage::write(const Position& value) -{ +template <> +void NetworkMessage::write(const Position &value) { write(value.x); write(value.y); write(value.z); @@ -74,53 +71,48 @@ template<> void NetworkMessage::write(const Position& value) // NetworkConnection NetworkConnection::NetworkConnection() : - service(nullptr), thread(), stopped(false) -{ + service(nullptr), thread(), stopped(false) { // } -NetworkConnection::~NetworkConnection() -{ +NetworkConnection::~NetworkConnection() { stop(); } -NetworkConnection& NetworkConnection::getInstance() -{ +NetworkConnection &NetworkConnection::getInstance() { static NetworkConnection connection; return connection; } -bool NetworkConnection::start() -{ - if(thread.joinable()) { - if(stopped) { +bool NetworkConnection::start() { + if (thread.joinable()) { + if (stopped) { return false; } return true; } stopped = false; - if(!service) { + if (!service) { service = new asio::io_service; } thread = std::thread([this]() -> void { - asio::io_service& serviceRef = *service; + asio::io_service &serviceRef = *service; try { - while(!stopped) { + while (!stopped) { serviceRef.run_one(); serviceRef.reset(); } - } catch (std::exception& e) { + } catch (std::exception &e) { std::cout << e.what() << std::endl; } }); return true; } -void NetworkConnection::stop() -{ - if(!service) { +void NetworkConnection::stop() { + if (!service) { return; } @@ -132,7 +124,6 @@ void NetworkConnection::stop() service = nullptr; } -asio::io_service& NetworkConnection::get_service() -{ +asio::io_service &NetworkConnection::get_service() { return *service; } diff --git a/source/net_connection.h b/source/net_connection.h index e6657a5a..31b5ae35 100644 --- a/source/net_connection.h +++ b/source/net_connection.h @@ -26,23 +26,22 @@ #include #include -struct NetworkMessage -{ +struct NetworkMessage { NetworkMessage(); void clear(); void expand(const size_t length); // - template T read() - { - T& value = *reinterpret_cast(&buffer[position]); + template + T read() { + T &value = *reinterpret_cast(&buffer[position]); position += sizeof(T); return value; } - template void write(const T& value) - { + template + void write(const T &value) { expand(sizeof(T)); memcpy(&buffer[position], &value, sizeof(T)); position += sizeof(T); @@ -54,31 +53,34 @@ struct NetworkMessage size_t size; }; -template<> std::string NetworkMessage::read(); -template<> Position NetworkMessage::read(); -template<> void NetworkMessage::write(const std::string& value); -template<> void NetworkMessage::write(const Position& value); +template <> +std::string NetworkMessage::read(); +template <> +Position NetworkMessage::read(); +template <> +void NetworkMessage::write(const std::string &value); +template <> +void NetworkMessage::write(const Position &value); -class NetworkConnection -{ - private: - NetworkConnection(); - NetworkConnection(const NetworkConnection& copy) = delete; +class NetworkConnection { +private: + NetworkConnection(); + NetworkConnection(const NetworkConnection ©) = delete; - public: - ~NetworkConnection(); +public: + ~NetworkConnection(); - static NetworkConnection& getInstance(); + static NetworkConnection &getInstance(); - bool start(); - void stop(); + bool start(); + void stop(); - asio::io_service& get_service(); + asio::io_service &get_service(); - private: - asio::io_service* service; - std::thread thread; - bool stopped; +private: + asio::io_service* service; + std::thread thread; + bool stopped; }; #endif diff --git a/source/npc.cpp b/source/npc.cpp index cd4eb8f3..d2051664 100644 --- a/source/npc.cpp +++ b/source/npc.cpp @@ -19,19 +19,19 @@ #include "npc.h" -Npc::Npc(NpcType* type) : direction(NORTH), spawnNpcTime(0), saved(false), selected(false) -{ - if(type) +Npc::Npc(NpcType* type) : + direction(NORTH), spawnNpcTime(0), saved(false), selected(false) { + if (type) { type_name = type->name; + } } -Npc::Npc(const std::string& type_name) : type_name(type_name), direction(NORTH), spawnNpcTime(0), saved(false), selected(false) -{ +Npc::Npc(const std::string &type_name) : + type_name(type_name), direction(NORTH), spawnNpcTime(0), saved(false), selected(false) { //// } -Npc* Npc::deepCopy() const -{ +Npc* Npc::deepCopy() const { Npc* copy = new Npc(type_name); copy->spawnNpcTime = spawnNpcTime; copy->direction = direction; @@ -40,59 +40,67 @@ Npc* Npc::deepCopy() const return copy; } -const Outfit& Npc::getLookType() const -{ +const Outfit &Npc::getLookType() const { const NpcType* type = g_npcs[type_name]; - if(type) + if (type) { return type->outfit; + } static const Outfit otfi; // Empty outfit return otfi; } -bool Npc::isNpc() const -{ +bool Npc::isNpc() const { const NpcType* type = g_npcs[type_name]; - if(type) { + if (type) { return type->isNpc; } return false; } -std::string Npc::getName() const -{ +std::string Npc::getName() const { const NpcType* type = g_npcs[type_name]; - if(type) { + if (type) { return type->name; } return ""; } -NpcBrush* Npc::getBrush() const -{ +NpcBrush* Npc::getBrush() const { const NpcType* type = g_npcs[type_name]; - if(type) { + if (type) { return type->brush; } return nullptr; } -std::string Npc::DirID2Name(uint16_t id) -{ +std::string Npc::DirID2Name(uint16_t id) { switch (id) { - case NORTH: return "North"; - case EAST: return "East"; - case SOUTH: return "South"; - case WEST: return "West"; - default: return "Unknown"; + case NORTH: + return "North"; + case EAST: + return "East"; + case SOUTH: + return "South"; + case WEST: + return "West"; + default: + return "Unknown"; } } -uint16_t Npc::DirName2ID(std::string dir) -{ +uint16_t Npc::DirName2ID(std::string dir) { to_lower_str(dir); - if(dir == "north") return NORTH; - if(dir == "east") return EAST; - if(dir == "south") return SOUTH; - if(dir == "west") return WEST; + if (dir == "north") { + return NORTH; + } + if (dir == "east") { + return EAST; + } + if (dir == "south") { + return SOUTH; + } + if (dir == "west") { + return WEST; + } return SOUTH; } diff --git a/source/npc.h b/source/npc.h index 67c58965..1fc125b5 100644 --- a/source/npc.h +++ b/source/npc.h @@ -24,30 +24,50 @@ class Npc { public: Npc(NpcType* type); - Npc(const std::string& type_name); + Npc(const std::string &type_name); Npc* deepCopy() const; - const Outfit& getLookType() const; + const Outfit &getLookType() const; - bool isSaved() const noexcept { return saved; } - void save() noexcept { saved = true; } - void reset() noexcept { saved = false; } + bool isSaved() const noexcept { + return saved; + } + void save() noexcept { + saved = true; + } + void reset() noexcept { + saved = false; + } - bool isSelected() const noexcept { return selected; } - void deselect() noexcept { selected = false; } - void select() noexcept { selected = true; } + bool isSelected() const noexcept { + return selected; + } + void deselect() noexcept { + selected = false; + } + void select() noexcept { + selected = true; + } bool isNpc() const; std::string getName() const; NpcBrush* getBrush() const; - int getSpawnNpcTime() const noexcept {return spawnNpcTime;} - void setSpawnNpcTime(int time) noexcept { spawnNpcTime = time; } + int getSpawnNpcTime() const noexcept { + return spawnNpcTime; + } + void setSpawnNpcTime(int time) noexcept { + spawnNpcTime = time; + } - Direction getDirection() const noexcept { return direction; } - void setDirection(Direction _direction) noexcept { direction = _direction; } + Direction getDirection() const noexcept { + return direction; + } + void setDirection(Direction _direction) noexcept { + direction = _direction; + } // Static conversions static std::string DirID2Name(uint16_t id); diff --git a/source/npc_brush.cpp b/source/npc_brush.cpp index f70b4142..36e0de6b 100644 --- a/source/npc_brush.cpp +++ b/source/npc_brush.cpp @@ -29,35 +29,31 @@ NpcBrush::NpcBrush(NpcType* type) : Brush(), - npc_type(type) -{ + npc_type(type) { ASSERT(type->brush == nullptr); - type->brush/* = this*/; + type->brush /* = this*/; } -NpcBrush::~NpcBrush() -{ +NpcBrush::~NpcBrush() { //// } -int NpcBrush::getLookID() const -{ +int NpcBrush::getLookID() const { return 0; } -std::string NpcBrush::getName() const -{ - if(npc_type) +std::string NpcBrush::getName() const { + if (npc_type) { return npc_type->name; + } return "Npc Brush"; } -bool NpcBrush::canDraw(BaseMap* map, const Position& position) const -{ +bool NpcBrush::canDraw(BaseMap* map, const Position &position) const { Tile* tile = map->getTile(position); - if(npc_type && tile && !tile->isBlocking()) { + if (npc_type && tile && !tile->isBlocking()) { if (tile->getLocation()->getSpawnNpcCount() != 0 || g_settings.getInteger(Config::AUTO_CREATE_SPAWN_NPC)) { - if(tile->isPZ()) { + if (tile->isPZ()) { return true; } else { return true; @@ -67,20 +63,18 @@ bool NpcBrush::canDraw(BaseMap* map, const Position& position) const return false; } -void NpcBrush::undraw(BaseMap* map, Tile* tile) -{ +void NpcBrush::undraw(BaseMap* map, Tile* tile) { delete tile->npc; tile->npc = nullptr; } -void NpcBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void NpcBrush::draw(BaseMap* map, Tile* tile, void* parameter) { ASSERT(tile); ASSERT(parameter); - if(canDraw(map, tile->getPosition())) { + if (canDraw(map, tile->getPosition())) { undraw(map, tile); - if(npc_type) { - if(tile->spawnNpc == nullptr && tile->getLocation()->getSpawnNpcCount() == 0) { + if (npc_type) { + if (tile->spawnNpc == nullptr && tile->getLocation()->getSpawnNpcCount() == 0) { // manually place npc spawn on location tile->spawnNpc = newd SpawnNpc(1); } diff --git a/source/npc_brush.h b/source/npc_brush.h index 47ebd6d6..2fa00e8a 100644 --- a/source/npc_brush.h +++ b/source/npc_brush.h @@ -23,26 +23,37 @@ //============================================================================= // NpcBrush, place npcs -class NpcBrush : public Brush -{ +class NpcBrush : public Brush { public: NpcBrush(NpcType* type); // Create a RAWBrush of the specified type virtual ~NpcBrush(); - bool isNpc() const { return true; } - NpcBrush* asNpc() { return static_cast(this); } + bool isNpc() const { + return true; + } + NpcBrush* asNpc() { + return static_cast(this); + } - virtual bool canDraw(BaseMap* map, const Position& position) const; + virtual bool canDraw(BaseMap* map, const Position &position) const; virtual void draw(BaseMap* map, Tile* tile, void* parameter); virtual void undraw(BaseMap* map, Tile* tile); - NpcType* getType() const {return npc_type;} + NpcType* getType() const { + return npc_type; + } virtual int getLookID() const; // We don't have a look type, this will always return 0 virtual std::string getName() const; - virtual bool canDrag() const { return false; } - virtual bool canSmear() const { return true; } - virtual bool oneSizeFitsAll() const { return true; } + virtual bool canDrag() const { + return false; + } + virtual bool canSmear() const { + return true; + } + virtual bool oneSizeFitsAll() const { + return true; + } protected: NpcType* npc_type; diff --git a/source/npcs.cpp b/source/npcs.cpp index f48c1b87..ac3794ad 100644 --- a/source/npcs.cpp +++ b/source/npcs.cpp @@ -30,24 +30,21 @@ NpcType::NpcType() : in_other_tileset(false), standard(false), name(""), - brush(nullptr) -{ + brush(nullptr) { //// } -NpcType::NpcType(const NpcType& npc) : +NpcType::NpcType(const NpcType &npc) : missing(npc.missing), in_other_tileset(npc.in_other_tileset), standard(npc.standard), name(npc.name), outfit(npc.outfit), - brush(npc.brush) -{ + brush(npc.brush) { //// } -NpcType& NpcType::operator=(const NpcType& npc) -{ +NpcType &NpcType::operator=(const NpcType &npc) { missing = npc.missing; in_other_tileset = npc.in_other_tileset; standard = npc.standard; @@ -57,15 +54,13 @@ NpcType& NpcType::operator=(const NpcType& npc) return *this; } -NpcType::~NpcType() -{ +NpcType::~NpcType() { //// } -NpcType* NpcType::loadFromXML(pugi::xml_node node, wxArrayString& warnings) -{ +NpcType* NpcType::loadFromXML(pugi::xml_node node, wxArrayString &warnings) { pugi::xml_attribute attribute; - if(!(attribute = node.attribute("name"))) { + if (!(attribute = node.attribute("name"))) { warnings.push_back("Couldn't read name tag of npc node."); return nullptr; } @@ -73,51 +68,50 @@ NpcType* NpcType::loadFromXML(pugi::xml_node node, wxArrayString& warnings) NpcType* npcType = newd NpcType(); npcType->name = attribute.as_string(); - if((attribute = node.attribute("looktype"))) { + if ((attribute = node.attribute("looktype"))) { npcType->outfit.lookType = attribute.as_int(); - if(g_gui.gfx.getCreatureSprite(npcType->outfit.lookType) == nullptr) { + if (g_gui.gfx.getCreatureSprite(npcType->outfit.lookType) == nullptr) { warnings.push_back("Invalid npc \"" + wxstr(npcType->name) + "\" look type #" + std::to_string(npcType->outfit.lookType)); } } - if((attribute = node.attribute("lookitem"))) { + if ((attribute = node.attribute("lookitem"))) { npcType->outfit.lookItem = attribute.as_int(); } - if((attribute = node.attribute("lookaddon"))) { + if ((attribute = node.attribute("lookaddon"))) { npcType->outfit.lookAddon = attribute.as_int(); } - if((attribute = node.attribute("lookhead"))) { + if ((attribute = node.attribute("lookhead"))) { npcType->outfit.lookHead = attribute.as_int(); } - if((attribute = node.attribute("lookbody"))) { + if ((attribute = node.attribute("lookbody"))) { npcType->outfit.lookBody = attribute.as_int(); } - if((attribute = node.attribute("looklegs"))) { + if ((attribute = node.attribute("looklegs"))) { npcType->outfit.lookLegs = attribute.as_int(); } - if((attribute = node.attribute("lookfeet"))) { + if ((attribute = node.attribute("lookfeet"))) { npcType->outfit.lookFeet = attribute.as_int(); } return npcType; } -NpcType* NpcType::loadFromOTXML(const FileName& filename, pugi::xml_document& doc, wxArrayString& warnings) -{ +NpcType* NpcType::loadFromOTXML(const FileName &filename, pugi::xml_document &doc, wxArrayString &warnings) { ASSERT(doc != nullptr); pugi::xml_node node; - if(!(node = doc.child("npc"))) { + if (!(node = doc.child("npc"))) { warnings.push_back("This file is not a npc file"); return nullptr; } pugi::xml_attribute attribute; - if(!(attribute = node.attribute("name"))) { + if (!(attribute = node.attribute("name"))) { warnings.push_back("Couldn't read name tag of npc node."); return nullptr; } @@ -126,71 +120,66 @@ NpcType* NpcType::loadFromOTXML(const FileName& filename, pugi::xml_document& do npcType->name = nstr(filename.GetName()); npcType->name = nstr(filename.GetName()); - for(pugi::xml_node optionNode = node.first_child(); optionNode; optionNode = optionNode.next_sibling()) { - if(as_lower_str(optionNode.name()) != "look") { + for (pugi::xml_node optionNode = node.first_child(); optionNode; optionNode = optionNode.next_sibling()) { + if (as_lower_str(optionNode.name()) != "look") { continue; } - if((attribute = optionNode.attribute("type"))) { + if ((attribute = optionNode.attribute("type"))) { npcType->outfit.lookType = attribute.as_int(); } - if((attribute = optionNode.attribute("item")) || (attribute = optionNode.attribute("lookex")) || (attribute = optionNode.attribute("typeex"))) { + if ((attribute = optionNode.attribute("item")) || (attribute = optionNode.attribute("lookex")) || (attribute = optionNode.attribute("typeex"))) { npcType->outfit.lookItem = attribute.as_int(); } - if((attribute = optionNode.attribute("addon"))) { + if ((attribute = optionNode.attribute("addon"))) { npcType->outfit.lookAddon = attribute.as_int(); } - if((attribute = optionNode.attribute("head"))) { + if ((attribute = optionNode.attribute("head"))) { npcType->outfit.lookHead = attribute.as_int(); } - if((attribute = optionNode.attribute("body"))) { + if ((attribute = optionNode.attribute("body"))) { npcType->outfit.lookBody = attribute.as_int(); } - if((attribute = optionNode.attribute("legs"))) { + if ((attribute = optionNode.attribute("legs"))) { npcType->outfit.lookLegs = attribute.as_int(); } - if((attribute = optionNode.attribute("feet"))) { + if ((attribute = optionNode.attribute("feet"))) { npcType->outfit.lookFeet = attribute.as_int(); } } return npcType; } -NpcDatabase::NpcDatabase() -{ +NpcDatabase::NpcDatabase() { //// } -NpcDatabase::~NpcDatabase() -{ +NpcDatabase::~NpcDatabase() { clear(); } -void NpcDatabase::clear() -{ - for(NpcMap::iterator iter = npcMap.begin(); iter != npcMap.end(); ++iter) { +void NpcDatabase::clear() { + for (NpcMap::iterator iter = npcMap.begin(); iter != npcMap.end(); ++iter) { delete iter->second; } npcMap.clear(); } -NpcType* NpcDatabase::operator[](const std::string& name) -{ +NpcType* NpcDatabase::operator[](const std::string &name) { NpcMap::iterator iter = npcMap.find(as_lower_str(name)); - if(iter != npcMap.end()) { + if (iter != npcMap.end()) { return iter->second; } return nullptr; } -NpcType* NpcDatabase::addMissingNpcType(const std::string& name) -{ +NpcType* NpcDatabase::addMissingNpcType(const std::string &name) { assert((*this)[name] == nullptr); NpcType* npcType = newd NpcType(); @@ -202,8 +191,7 @@ NpcType* NpcDatabase::addMissingNpcType(const std::string& name) return npcType; } -NpcType* NpcDatabase::addNpcType(const std::string& name, const Outfit& outfit) -{ +NpcType* NpcDatabase::addNpcType(const std::string &name, const Outfit &outfit) { assert((*this)[name] == nullptr); NpcType* npcType = newd NpcType(); @@ -215,40 +203,38 @@ NpcType* NpcDatabase::addNpcType(const std::string& name, const Outfit& outfit) return npcType; } -bool NpcDatabase::hasMissing() const -{ - for(NpcMap::const_iterator iter = npcMap.begin(); iter != npcMap.end(); ++iter) { - if(iter->second->missing) { +bool NpcDatabase::hasMissing() const { + for (NpcMap::const_iterator iter = npcMap.begin(); iter != npcMap.end(); ++iter) { + if (iter->second->missing) { return true; } } return false; } -bool NpcDatabase::loadFromXML(const FileName& filename, bool standard, wxString& error, wxArrayString& warnings) -{ +bool NpcDatabase::loadFromXML(const FileName &filename, bool standard, wxString &error, wxArrayString &warnings) { pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(filename.GetFullPath().mb_str()); - if(!result) { + if (!result) { error = "Couldn't open file \"" + filename.GetFullName() + "\", invalid format?"; return false; } pugi::xml_node node = doc.child("npcs"); - if(!node) { + if (!node) { error = "Invalid file signature, this file is not a valid npc file."; return false; } - for(pugi::xml_node npcNode = node.first_child(); npcNode; npcNode = npcNode.next_sibling()) { - if(as_lower_str(npcNode.name()) != "npc") { + for (pugi::xml_node npcNode = node.first_child(); npcNode; npcNode = npcNode.next_sibling()) { + if (as_lower_str(npcNode.name()) != "npc") { continue; } NpcType* npcType = NpcType::loadFromXML(npcNode, warnings); - if(npcType) { + if (npcType) { npcType->standard = standard; - if((*this)[npcType->name]) { + if ((*this)[npcType->name]) { warnings.push_back("Duplicate npc with name \"" + wxstr(npcType->name) + "\"! Discarding..."); delete npcType; } else { @@ -259,22 +245,21 @@ bool NpcDatabase::loadFromXML(const FileName& filename, bool standard, wxString& return true; } -bool NpcDatabase::importXMLFromOT(const FileName& filename, wxString& error, wxArrayString& warnings) -{ +bool NpcDatabase::importXMLFromOT(const FileName &filename, wxString &error, wxArrayString &warnings) { pugi::xml_document doc; pugi::xml_parse_result result = doc.load_file(filename.GetFullPath().mb_str()); - if(!result) { + if (!result) { error = "Couldn't open file \"" + filename.GetFullName() + "\", invalid format?"; return false; } pugi::xml_node node; - if(node = doc.child("npc")) { + if (node = doc.child("npc")) { NpcType* npcType = NpcType::loadFromOTXML(filename, doc, warnings); - if(npcType) { + if (npcType) { NpcType* current = (*this)[npcType->name]; - if(current) { + if (current) { *current = *npcType; delete npcType; } else { @@ -298,23 +283,22 @@ bool NpcDatabase::importXMLFromOT(const FileName& filename, wxString& error, wxA return true; } -bool NpcDatabase::saveToXML(const FileName& filename) -{ +bool NpcDatabase::saveToXML(const FileName &filename) { pugi::xml_document doc; pugi::xml_node decl = doc.prepend_child(pugi::node_declaration); decl.append_attribute("version") = "1.0"; pugi::xml_node npcNodes = doc.append_child("npcs"); - for(const auto& npcEntry : npcMap) { + for (const auto &npcEntry : npcMap) { NpcType* npcType = npcEntry.second; - if(!npcType->standard) { + if (!npcType->standard) { pugi::xml_node npcNode = npcNodes.append_child("npc"); npcNode.append_attribute("name") = npcType->name.c_str(); npcNode.append_attribute("type") = "npc"; - const Outfit& outfit = npcType->outfit; + const Outfit &outfit = npcType->outfit; npcNode.append_attribute("looktype") = outfit.lookType; npcNode.append_attribute("lookitem") = outfit.lookItem; npcNode.append_attribute("lookaddon") = outfit.lookAddon; diff --git a/source/npcs.h b/source/npcs.h index 408d5539..48f57dd1 100644 --- a/source/npcs.h +++ b/source/npcs.h @@ -28,8 +28,7 @@ class NpcBrush; typedef std::map NpcMap; -class NpcDatabase -{ +class NpcDatabase { protected: NpcMap npcMap; @@ -42,25 +41,29 @@ class NpcDatabase void clear(); - NpcType* operator[](const std::string& name); - NpcType* addMissingNpcType(const std::string& name); - NpcType* addNpcType(const std::string& name, const Outfit& outfit); + NpcType* operator[](const std::string &name); + NpcType* addMissingNpcType(const std::string &name); + NpcType* addNpcType(const std::string &name, const Outfit &outfit); bool hasMissing() const; - iterator begin() noexcept {return npcMap.begin();} - iterator end() noexcept {return npcMap.end();} + iterator begin() noexcept { + return npcMap.begin(); + } + iterator end() noexcept { + return npcMap.end(); + } - bool loadFromXML(const FileName& filename, bool standard, wxString& error, wxArrayString& warnings); - bool importXMLFromOT(const FileName& filename, wxString& error, wxArrayString& warnings); + bool loadFromXML(const FileName &filename, bool standard, wxString &error, wxArrayString &warnings); + bool importXMLFromOT(const FileName &filename, wxString &error, wxArrayString &warnings); - bool saveToXML(const FileName& filename); + bool saveToXML(const FileName &filename); }; class NpcType { public: NpcType(); - NpcType(const NpcType& ct); - NpcType& operator=(const NpcType& ct); + NpcType(const NpcType &ct); + NpcType &operator=(const NpcType &ct); ~NpcType(); bool isNpc; @@ -71,8 +74,8 @@ class NpcType { Outfit outfit; NpcBrush* brush; - static NpcType* loadFromXML(pugi::xml_node node, wxArrayString& warnings); - static NpcType* loadFromOTXML(const FileName& filename, pugi::xml_document& node, wxArrayString& warnings); + static NpcType* loadFromXML(pugi::xml_node node, wxArrayString &warnings); + static NpcType* loadFromOTXML(const FileName &filename, pugi::xml_document &node, wxArrayString &warnings); }; extern NpcDatabase g_npcs; diff --git a/source/numbertextctrl.cpp b/source/numbertextctrl.cpp index 2155c2c4..7bab21cf 100644 --- a/source/numbertextctrl.cpp +++ b/source/numbertextctrl.cpp @@ -19,95 +19,84 @@ #include "numbertextctrl.h" BEGIN_EVENT_TABLE(NumberTextCtrl, wxTextCtrl) - EVT_KILL_FOCUS(NumberTextCtrl::OnKillFocus) - EVT_TEXT_ENTER(wxID_ANY, NumberTextCtrl::OnTextEnter) +EVT_KILL_FOCUS(NumberTextCtrl::OnKillFocus) +EVT_TEXT_ENTER(wxID_ANY, NumberTextCtrl::OnTextEnter) END_EVENT_TABLE() -NumberTextCtrl::NumberTextCtrl(wxWindow* parent, wxWindowID id, - long value, long minvalue, long maxvalue, - const wxPoint& pos, const wxSize& sz, - long style, const wxString& name) : +NumberTextCtrl::NumberTextCtrl(wxWindow* parent, wxWindowID id, long value, long minvalue, long maxvalue, const wxPoint &pos, const wxSize &sz, long style, const wxString &name) : wxTextCtrl(parent, id, (wxString() << value), pos, sz, style, wxTextValidator(wxFILTER_NUMERIC), name), - minval(minvalue), maxval(maxvalue), lastval(value) -{ + minval(minvalue), maxval(maxvalue), lastval(value) { //// } -NumberTextCtrl::NumberTextCtrl(wxWindow* parent, wxWindowID id, - long value, long minvalue, long maxvalue, - long style, const wxString& name, - const wxPoint& pos, const wxSize& sz) : +NumberTextCtrl::NumberTextCtrl(wxWindow* parent, wxWindowID id, long value, long minvalue, long maxvalue, long style, const wxString &name, const wxPoint &pos, const wxSize &sz) : wxTextCtrl(parent, id, (wxString() << value), pos, sz, style, wxTextValidator(wxFILTER_NUMERIC), name), - minval(minvalue), maxval(maxvalue), lastval(value) -{ + minval(minvalue), maxval(maxvalue), lastval(value) { //// } -NumberTextCtrl::~NumberTextCtrl() -{ +NumberTextCtrl::~NumberTextCtrl() { //// } -void NumberTextCtrl::OnKillFocus(wxFocusEvent& evt) -{ +void NumberTextCtrl::OnKillFocus(wxFocusEvent &evt) { CheckRange(); evt.Skip(); } -void NumberTextCtrl::OnTextEnter(wxCommandEvent& evt) -{ +void NumberTextCtrl::OnTextEnter(wxCommandEvent &evt) { CheckRange(); } -void NumberTextCtrl::SetIntValue(long value) -{ +void NumberTextCtrl::SetIntValue(long value) { wxString sv; sv << value; // Will generate events SetValue(sv); } -long NumberTextCtrl::GetIntValue() -{ +long NumberTextCtrl::GetIntValue() { long l; - if(GetValue().ToLong(&l)) + if (GetValue().ToLong(&l)) { return l; + } return 0; } -void NumberTextCtrl::SetMinValue(long value) -{ - if(value == minval) +void NumberTextCtrl::SetMinValue(long value) { + if (value == minval) { return; + } minval = value; CheckRange(); } -void NumberTextCtrl::SetMaxValue(long value) -{ - if(value == maxval) +void NumberTextCtrl::SetMaxValue(long value) { + if (value == maxval) { return; + } maxval = value; CheckRange(); } -void NumberTextCtrl::CheckRange() -{ +void NumberTextCtrl::CheckRange() { wxString text = GetValue(); wxString ntext; - for(size_t s = 0; s < text.size(); ++s) { - if(text[s] >= '0' && text[s] <= '9') + for (size_t s = 0; s < text.size(); ++s) { + if (text[s] >= '0' && text[s] <= '9') { ntext.Append(text[s]); + } } // Check that value is in range long v; - if(ntext.size() != 0 && ntext.ToLong(&v)) { - if(v < minval) + if (ntext.size() != 0 && ntext.ToLong(&v)) { + if (v < minval) { v = minval; - else if(v > maxval) + } else if (v > maxval) { v = maxval; + } ntext.clear(); ntext << v; @@ -118,9 +107,8 @@ void NumberTextCtrl::CheckRange() } // Check if there was any change - if(ntext != text) { + if (ntext != text) { // ChangeValue doesn't generate events ChangeValue(ntext); } } - diff --git a/source/numbertextctrl.h b/source/numbertextctrl.h index 43651c8f..8db42ba0 100644 --- a/source/numbertextctrl.h +++ b/source/numbertextctrl.h @@ -19,21 +19,14 @@ #define _RME_NUMBER_TEXT_CTRL_H_ // Text ctrl that only allows number input -class NumberTextCtrl : public wxTextCtrl -{ +class NumberTextCtrl : public wxTextCtrl { public: - NumberTextCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, - long value = 0, long minvalue = 0, long maxvalue = 100, - const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, - long style = 0, const wxString& name = wxTextCtrlNameStr); - NumberTextCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, - long value = 0, long minvalue = 0, long maxvalue = 100, - long style = 0, const wxString& name = wxTextCtrlNameStr, - const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize); + NumberTextCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, long value = 0, long minvalue = 0, long maxvalue = 100, const wxPoint &pos = wxDefaultPosition, const wxSize &sz = wxDefaultSize, long style = 0, const wxString &name = wxTextCtrlNameStr); + NumberTextCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, long value = 0, long minvalue = 0, long maxvalue = 100, long style = 0, const wxString &name = wxTextCtrlNameStr, const wxPoint &pos = wxDefaultPosition, const wxSize &sz = wxDefaultSize); ~NumberTextCtrl(); - void OnKillFocus(wxFocusEvent&); - void OnTextEnter(wxCommandEvent&); + void OnKillFocus(wxFocusEvent &); + void OnTextEnter(wxCommandEvent &); long GetIntValue(); void SetIntValue(long value); diff --git a/source/old_properties_window.cpp b/source/old_properties_window.cpp index ba7fccf4..a10f45e9 100644 --- a/source/old_properties_window.cpp +++ b/source/old_properties_window.cpp @@ -36,9 +36,9 @@ // Old Properties Window BEGIN_EVENT_TABLE(OldPropertiesWindow, wxDialog) - EVT_SET_FOCUS(OldPropertiesWindow::OnFocusChange) - EVT_BUTTON(wxID_OK, OldPropertiesWindow::OnClickOK) - EVT_BUTTON(wxID_CANCEL, OldPropertiesWindow::OnClickCancel) +EVT_SET_FOCUS(OldPropertiesWindow::OnFocusChange) +EVT_BUTTON(wxID_OK, OldPropertiesWindow::OnClickOK) +EVT_BUTTON(wxID_CANCEL, OldPropertiesWindow::OnClickCancel) END_EVENT_TABLE() OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, const Tile* tile_parent, Item* item, wxPoint pos) : @@ -52,12 +52,11 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c splash_type_field(nullptr), text_field(nullptr), description_field(nullptr), - destination_field(nullptr) -{ + destination_field(nullptr) { ASSERT(edit_item); wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); - if(Container* container = dynamic_cast(edit_item)) { + if (Container* container = dynamic_cast(edit_item)) { // Container wxSizer* boxsizer = newd wxStaticBoxSizer(wxVERTICAL, this, "Container Properties"); @@ -82,18 +81,18 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c bool use_large_sprites = g_settings.getBoolean(Config::USE_LARGE_CONTAINER_ICONS); wxSizer* horizontal_sizer = nullptr; - const int additional_height_increment = (use_large_sprites? 40 : 24); + const int additional_height_increment = (use_large_sprites ? 40 : 24); int additional_height = 0; int32_t maxColumns; - if(use_large_sprites) { + if (use_large_sprites) { maxColumns = 6; } else { maxColumns = 12; } - for(uint32_t index = 0; index < container->getVolume(); ++index) { - if(!horizontal_sizer) { + for (uint32_t index = 0; index < container->getVolume(); ++index) { + if (!horizontal_sizer) { horizontal_sizer = newd wxBoxSizer(wxHORIZONTAL); } @@ -103,14 +102,14 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c container_items.push_back(containerItemButton); horizontal_sizer->Add(containerItemButton); - if(((index + 1) % maxColumns) == 0) { + if (((index + 1) % maxColumns) == 0) { contents_sizer->Add(horizontal_sizer); horizontal_sizer = nullptr; additional_height += additional_height_increment; } } - if(horizontal_sizer != nullptr) { + if (horizontal_sizer != nullptr) { contents_sizer->Add(horizontal_sizer); additional_height += additional_height_increment; } @@ -119,8 +118,8 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c topsizer->Add(boxsizer, wxSizerFlags(0).Expand().Border(wxALL, 20)); - //SetSize(260, 150 + additional_height); - } else if(edit_item->canHoldText() || edit_item->canHoldDescription()) { + // SetSize(260, 150 + additional_height); + } else if (edit_item->canHoldText() || edit_item->canHoldDescription()) { // Book wxSizer* boxsizer = newd wxStaticBoxSizer(wxVERTICAL, this, "Writeable Properties"); @@ -150,8 +149,8 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c topsizer->Add(boxsizer, wxSizerFlags(0).Expand().Border(wxALL, 20)); - //SetSize(220, 310); - } else if(edit_item->isSplash() || edit_item->isFluidContainer()) { + // SetSize(220, 310); + } else if (edit_item->isSplash() || edit_item->isFluidContainer()) { // Splash wxSizer* boxsizer = newd wxStaticBoxSizer(wxVERTICAL, this, "Splash Properties"); @@ -165,17 +164,17 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c // Splash types splash_type_field = newd wxChoice(this, wxID_ANY); - if(edit_item->isFluidContainer()) { + if (edit_item->isFluidContainer()) { splash_type_field->Append(wxstr(Item::LiquidID2Name(LIQUID_NONE)), newd int32_t(LIQUID_NONE)); } - for(SplashType splashType = LIQUID_FIRST; splashType != LIQUID_LAST; ++splashType) { + for (SplashType splashType = LIQUID_FIRST; splashType != LIQUID_LAST; ++splashType) { splash_type_field->Append(wxstr(Item::LiquidID2Name(splashType)), newd int32_t(splashType)); } - if(item->getSubtype()) { - const std::string& what = Item::LiquidID2Name(item->getSubtype()); - if(what == "Unknown") { + if (item->getSubtype()) { + const std::string &what = Item::LiquidID2Name(item->getSubtype()); + if (what == "Unknown") { splash_type_field->Append(wxstr(Item::LiquidID2Name(LIQUID_NONE)), newd int32_t(LIQUID_NONE)); } splash_type_field->SetStringSelection(wxstr(what)); @@ -197,8 +196,8 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c topsizer->Add(boxsizer, wxSizerFlags(0).Expand().Border(wxALL, 20)); - //SetSize(220, 190); - } else if(Depot* depot = dynamic_cast(edit_item)) { + // SetSize(220, 190); + } else if (Depot* depot = dynamic_cast(edit_item)) { // Depot wxSizer* boxsizer = newd wxStaticBoxSizer(wxVERTICAL, this, "Depot Properties"); wxFlexGridSizer* subsizer = newd wxFlexGridSizer(2, 10, 10); @@ -207,30 +206,31 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c subsizer->Add(newd wxStaticText(this, wxID_ANY, "ID " + i2ws(item->getID()))); subsizer->Add(newd wxStaticText(this, wxID_ANY, "\"" + wxstr(item->getName()) + "\"")); - const Towns& towns = map->towns; + const Towns &towns = map->towns; subsizer->Add(newd wxStaticText(this, wxID_ANY, "Depot ID")); depot_id_field = newd wxChoice(this, wxID_ANY); int to_select_index = 0; - if(towns.count() > 0) { + if (towns.count() > 0) { bool found = false; - for(TownMap::const_iterator town_iter = towns.begin(); - town_iter != towns.end(); - ++town_iter) - { - if(town_iter->second->getID() == depot->getDepotID()) { + for (TownMap::const_iterator town_iter = towns.begin(); + town_iter != towns.end(); + ++town_iter) { + if (town_iter->second->getID() == depot->getDepotID()) { found = true; } depot_id_field->Append(wxstr(town_iter->second->getName()), newd int(town_iter->second->getID())); - if(!found) ++to_select_index; + if (!found) { + ++to_select_index; + } } - if(!found) { - if(depot->getDepotID() != 0) { + if (!found) { + if (depot->getDepotID() != 0) { depot_id_field->Append("Undefined Town (id:" + i2ws(depot->getDepotID()) + ")", newd int(depot->getDepotID())); } } } depot_id_field->Append("No Town", newd int(0)); - if(depot->getDepotID() == 0) { + if (depot->getDepotID() == 0) { to_select_index = depot_id_field->GetCount() - 1; } depot_id_field->SetSelection(to_select_index); @@ -239,17 +239,17 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c boxsizer->Add(subsizer, wxSizerFlags(5).Expand()); topsizer->Add(boxsizer, wxSizerFlags(0).Expand().Border(wxALL, 20)); - //SetSize(220, 140); + // SetSize(220, 140); } else { // Normal item Door* door = dynamic_cast(edit_item); Teleport* teleport = dynamic_cast(edit_item); wxString description; - if(door) { + if (door) { ASSERT(tile_parent); description = "Door Properties"; - } else if(teleport) { + } else if (teleport) { description = "Teleport Properties"; } else { description = "Item Properties"; @@ -258,9 +258,13 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c wxSizer* boxsizer = newd wxStaticBoxSizer(wxVERTICAL, this, description); int num_items = 4; - //if(item->canHoldDescription()) num_items += 1; - if(door) num_items += 1; - if(teleport) num_items += 1; + // if(item->canHoldDescription()) num_items += 1; + if (door) { + num_items += 1; + } + if (teleport) { + num_items += 1; + } wxFlexGridSizer* subsizer = newd wxFlexGridSizer(2, 10, 10); subsizer->AddGrowableCol(1); @@ -268,12 +272,16 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c subsizer->Add(newd wxStaticText(this, wxID_ANY, "ID " + i2ws(item->getID()))); subsizer->Add(newd wxStaticText(this, wxID_ANY, "\"" + wxstr(item->getName()) + "\"")); - subsizer->Add(newd wxStaticText(this, wxID_ANY, (item->isCharged()? "Charges" : "Count"))); + subsizer->Add(newd wxStaticText(this, wxID_ANY, (item->isCharged() ? "Charges" : "Count"))); int max_count = 100; - if(item->isClientCharged()) max_count = 250; - if(item->isExtraCharged()) max_count = 65500; + if (item->isClientCharged()) { + max_count = 250; + } + if (item->isExtraCharged()) { + max_count = 65500; + } count_field = newd wxSpinCtrl(this, wxID_ANY, i2ws(edit_item->getCount()), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, max_count, edit_item->getCount()); - if(!item->isStackable() && !item->isCharged()) { + if (!item->isStackable() && !item->isCharged()) { count_field->Enable(false); } subsizer->Add(count_field, wxSizerFlags(1).Expand()); @@ -294,10 +302,10 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c } */ - if(door) { + if (door) { subsizer->Add(newd wxStaticText(this, wxID_ANY, "Door ID")); door_id_field = newd wxSpinCtrl(this, wxID_ANY, i2ws(door->getDoorID()), wxDefaultPosition, wxSize(-1, 20), wxSP_ARROW_KEYS, 0, 0xFF, door->getDoorID()); - if(!edit_tile || !edit_tile->isHouseTile()) { + if (!edit_tile || !edit_tile->isHouseTile()) { door_id_field->Disable(); } subsizer->Add(door_id_field, wxSizerFlags(1).Expand()); @@ -306,14 +314,14 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c boxsizer->Add(subsizer, wxSizerFlags(1).Expand()); topsizer->Add(boxsizer, wxSizerFlags(0).Expand().Border(wxLEFT | wxRIGHT, 20)); - if(teleport) { + if (teleport) { destination_field = new PositionCtrl(this, "Destination", teleport->getX(), teleport->getY(), teleport->getZ(), map->getWidth(), map->getHeight()); topsizer->Add(destination_field, wxSizerFlags(0).Expand().Border(wxLEFT | wxRIGHT, 20)); } } // Others attributes - const ItemType& type = g_items.getItemType(edit_item->getID()); + const ItemType &type = g_items.getItemType(edit_item->getID()); wxStaticBoxSizer* others_sizer = newd wxStaticBoxSizer(wxVERTICAL, this, "Others"); wxFlexGridSizer* others_subsizer = newd wxFlexGridSizer(2, 5, 10); others_subsizer->AddGrowableCol(1); @@ -354,8 +362,7 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c splash_type_field(nullptr), text_field(nullptr), description_field(nullptr), - destination_field(nullptr) -{ + destination_field(nullptr) { ASSERT(edit_monster); wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); @@ -369,14 +376,14 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c subsizer->Add(newd wxStaticText(this, wxID_ANY, "\"" + wxstr(edit_monster->getName()) + "\""), wxSizerFlags(1).Expand()); subsizer->Add(newd wxStaticText(this, wxID_ANY, "Spawn interval")); - count_field = newd wxSpinCtrl(this, wxID_ANY, i2ws(edit_monster->getSpawnMonsterTime()), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 10, 3600, edit_monster->getSpawnMonsterTime()); - // count_field->SetSelection(-1, -1); + count_field = newd wxSpinCtrl(this, wxID_ANY, i2ws(edit_monster->getSpawnMonsterTime()), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 10, 3600, edit_monster->getSpawnMonsterTime()); + // count_field->SetSelection(-1, -1); subsizer->Add(count_field, wxSizerFlags(1).Expand()); subsizer->Add(newd wxStaticText(this, wxID_ANY, "Direction")); direction_field = newd wxChoice(this, wxID_ANY); - for(Direction dir = DIRECTION_FIRST; dir <= DIRECTION_LAST; ++dir) { + for (Direction dir = DIRECTION_FIRST; dir <= DIRECTION_LAST; ++dir) { direction_field->Append(wxstr(Monster::DirID2Name(dir)), newd int32_t(dir)); } direction_field->SetSelection(edit_monster->getDirection()); @@ -385,7 +392,7 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c boxsizer->Add(subsizer, wxSizerFlags(1).Expand()); topsizer->Add(boxsizer, wxSizerFlags(3).Expand().Border(wxALL, 20)); - //SetSize(220, 0); + // SetSize(220, 0); wxSizer* std_sizer = newd wxBoxSizer(wxHORIZONTAL); std_sizer->Add(newd wxButton(this, wxID_OK, "OK"), wxSizerFlags(1).Center()); @@ -407,14 +414,13 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c splash_type_field(nullptr), text_field(nullptr), description_field(nullptr), - destination_field(nullptr) -{ + destination_field(nullptr) { ASSERT(edit_spawn_monster); wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); wxSizer* boxsizer = newd wxStaticBoxSizer(wxVERTICAL, this, "Spawn Monster Properties"); - //if(item->canHoldDescription()) num_items += 1; + // if(item->canHoldDescription()) num_items += 1; wxFlexGridSizer* subsizer = newd wxFlexGridSizer(2, 10, 10); subsizer->AddGrowableCol(1); @@ -448,8 +454,7 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c splash_type_field(nullptr), text_field(nullptr), description_field(nullptr), - destination_field(nullptr) -{ + destination_field(nullptr) { ASSERT(edit_npc); wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); @@ -463,14 +468,14 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c subsizer->Add(newd wxStaticText(this, wxID_ANY, "\"" + wxstr(edit_npc->getName()) + "\""), wxSizerFlags(1).Expand()); subsizer->Add(newd wxStaticText(this, wxID_ANY, "Spawn interval")); - count_field = newd wxSpinCtrl(this, wxID_ANY, i2ws(edit_npc->getSpawnNpcTime()), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 10, 3600, edit_npc->getSpawnNpcTime()); - // count_field->SetSelection(-1, -1); + count_field = newd wxSpinCtrl(this, wxID_ANY, i2ws(edit_npc->getSpawnNpcTime()), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 10, 3600, edit_npc->getSpawnNpcTime()); + // count_field->SetSelection(-1, -1); subsizer->Add(count_field, wxSizerFlags(1).Expand()); subsizer->Add(newd wxStaticText(this, wxID_ANY, "Direction")); direction_field = newd wxChoice(this, wxID_ANY); - for(Direction dir = DIRECTION_FIRST; dir <= DIRECTION_LAST; ++dir) { + for (Direction dir = DIRECTION_FIRST; dir <= DIRECTION_LAST; ++dir) { direction_field->Append(wxstr(Npc::DirID2Name(dir)), newd int32_t(dir)); } direction_field->SetSelection(edit_npc->getDirection()); @@ -479,7 +484,7 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c boxsizer->Add(subsizer, wxSizerFlags(1).Expand()); topsizer->Add(boxsizer, wxSizerFlags(3).Expand().Border(wxALL, 20)); - //SetSize(220, 0); + // SetSize(220, 0); wxSizer* std_sizer = newd wxBoxSizer(wxHORIZONTAL); std_sizer->Add(newd wxButton(this, wxID_OK, "OK"), wxSizerFlags(1).Center()); @@ -501,14 +506,13 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c splash_type_field(nullptr), text_field(nullptr), description_field(nullptr), - destination_field(nullptr) -{ + destination_field(nullptr) { ASSERT(edit_spawn_npc); wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); wxSizer* boxsizer = newd wxStaticBoxSizer(wxVERTICAL, this, "Npc Spawn Properties"); - //if(item->canHoldDescription()) num_items += 1; + // if(item->canHoldDescription()) num_items += 1; wxFlexGridSizer* subsizer = newd wxFlexGridSizer(2, 10, 10); subsizer->AddGrowableCol(1); @@ -531,61 +535,59 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c Centre(wxBOTH); } -OldPropertiesWindow::~OldPropertiesWindow() -{ +OldPropertiesWindow::~OldPropertiesWindow() { // Warning: edit_item may no longer be valid, DONT USE IT! - if(splash_type_field) { - for(uint32_t i = 0; i < splash_type_field->GetCount(); ++i) { + if (splash_type_field) { + for (uint32_t i = 0; i < splash_type_field->GetCount(); ++i) { delete reinterpret_cast(splash_type_field->GetClientData(i)); } } - if(direction_field) { - for(uint32_t i = 0; i < direction_field->GetCount(); ++i) { + if (direction_field) { + for (uint32_t i = 0; i < direction_field->GetCount(); ++i) { delete reinterpret_cast(direction_field->GetClientData(i)); } } - if(depot_id_field) { - for(uint32_t i = 0; i < depot_id_field->GetCount(); ++i) { + if (depot_id_field) { + for (uint32_t i = 0; i < depot_id_field->GetCount(); ++i) { delete reinterpret_cast(depot_id_field->GetClientData(i)); } } } -void OldPropertiesWindow::OnFocusChange(wxFocusEvent& event) -{ +void OldPropertiesWindow::OnFocusChange(wxFocusEvent &event) { wxWindow* win = event.GetWindow(); - if(wxSpinCtrl* spin = dynamic_cast(win)) + if (wxSpinCtrl* spin = dynamic_cast(win)) { spin->SetSelection(-1, -1); - else if(wxTextCtrl* text = dynamic_cast(win)) + } else if (wxTextCtrl* text = dynamic_cast(win)) { text->SetSelection(-1, -1); + } } -void OldPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) -{ - if(edit_item) { +void OldPropertiesWindow::OnClickOK(wxCommandEvent &WXUNUSED(event)) { + if (edit_item) { int new_uid = (unique_id_field ? unique_id_field->GetValue() : 0); int new_aid = (action_id_field ? action_id_field->GetValue() : 0); bool uid_changed = false; bool aid_changed = false; - if(!edit_item->getDepot()) { + if (!edit_item->getDepot()) { uid_changed = new_uid != edit_item->getUniqueID(); aid_changed = new_aid != edit_item->getActionID(); - if(uid_changed) { - if(new_uid != 0 && (new_uid < rme::MinUniqueId || new_uid > rme::MaxUniqueId)) { + if (uid_changed) { + if (new_uid != 0 && (new_uid < rme::MinUniqueId || new_uid > rme::MaxUniqueId)) { wxString message = "Unique ID must be between %d and %d."; g_gui.PopupDialog(this, "Error", wxString::Format(message, rme::MinUniqueId, rme::MaxUniqueId), wxOK); return; } - if(g_gui.GetCurrentMap().hasUniqueId(new_uid)) { + if (g_gui.GetCurrentMap().hasUniqueId(new_uid)) { g_gui.PopupDialog(this, "Error", "Unique ID must be unique, this UID is already taken.", wxOK); return; } } - if(aid_changed) { - if(new_aid != 0 && (new_aid < rme::MinActionId || new_aid > rme::MaxActionId)) { + if (aid_changed) { + if (new_aid != 0 && (new_aid < rme::MinActionId || new_aid > rme::MaxActionId)) { wxString message = "Action ID must be between %d and %d."; g_gui.PopupDialog(this, "Error", wxString::Format(message, rme::MinActionId, rme::MaxActionId), wxOK); return; @@ -593,28 +595,28 @@ void OldPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) } } - if(edit_item->canHoldText() || edit_item->canHoldDescription()) { + if (edit_item->canHoldText() || edit_item->canHoldDescription()) { // Book std::string text = nstr(text_field->GetValue()); - if(text.length() >= 0xFFFF) { + if (text.length() >= 0xFFFF) { g_gui.PopupDialog(this, "Error", "Text is longer than 65535 characters, this is not supported by OpenTibia. Reduce the length of the text.", wxOK); return; } - if(edit_item->canHoldText() && text.length() > edit_item->getMaxWriteLength()) { + if (edit_item->canHoldText() && text.length() > edit_item->getMaxWriteLength()) { int ret = g_gui.PopupDialog(this, "Error", "Text is longer than the maximum supported length of this book type, do you still want to change it?", wxYES | wxNO); - if(ret != wxID_YES) { + if (ret != wxID_YES) { return; } } edit_item->setText(text); - } else if(edit_item->isSplash() || edit_item->isFluidContainer()) { + } else if (edit_item->isSplash() || edit_item->isFluidContainer()) { // Splash int* new_type = reinterpret_cast(splash_type_field->GetClientData(splash_type_field->GetSelection())); - if(new_type) { + if (new_type) { edit_item->setSubtype(*new_type); } // Clean up client data - } else if(Depot* depot = edit_item->getDepot()) { + } else if (Depot* depot = edit_item->getDepot()) { // Depot int* new_depotid = reinterpret_cast(depot_id_field->GetClientData(depot_id_field->GetSelection())); depot->setDepotID(*new_depotid); @@ -623,13 +625,13 @@ void OldPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) Door* door = edit_item->getDoor(); Teleport* teleport = edit_item->getTeleport(); - int new_count = count_field? count_field->GetValue() : 1; + int new_count = count_field ? count_field->GetValue() : 1; std::string new_desc; - if(edit_item->canHoldDescription() && description_field) { + if (edit_item->canHoldDescription() && description_field) { description_field->GetValue(); } uint8_t new_door_id = 0; - if(door) { + if (door) { new_door_id = door_id_field->GetValue(); } @@ -642,14 +644,14 @@ void OldPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) } */ - if(door && g_settings.getInteger(Config::WARN_FOR_DUPLICATE_ID)) { - if(edit_tile && edit_tile->isHouseTile()) { + if (door && g_settings.getInteger(Config::WARN_FOR_DUPLICATE_ID)) { + if (edit_tile && edit_tile->isHouseTile()) { const House* house = edit_map->houses.getHouse(edit_tile->getHouseID()); - if(house) { + if (house) { Position pos = house->getDoorPositionByID(new_door_id); - if(pos.isValid() && pos != edit_tile->getPosition()) { + if (pos.isValid() && pos != edit_tile->getPosition()) { int ret = g_gui.PopupDialog(this, "Warning", "This doorid conflicts with another one in this house, are you sure you want to continue?", wxYES | wxNO); - if(ret == wxID_NO) { + if (ret == wxID_NO) { return; } } @@ -657,11 +659,11 @@ void OldPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) } } - if(teleport) { + if (teleport) { Position destination = destination_field->GetPosition(); - if(!edit_map->getTile(destination) || edit_map->getTile(destination)->isBlocking()) { + if (!edit_map->getTile(destination) || edit_map->getTile(destination)->isBlocking()) { int ret = g_gui.PopupDialog(this, "Warning", "This teleport leads nowhere, or to an invalid location. Do you want to change the destination?", wxYES | wxNO); - if(ret == wxID_YES) { + if (ret == wxID_YES) { return; } } @@ -669,65 +671,65 @@ void OldPropertiesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) } // Done validating, set the values. - if(edit_item->canHoldDescription()) { + if (edit_item->canHoldDescription()) { edit_item->setText(new_desc); } - if(edit_item->isStackable() || edit_item->isCharged()) { + if (edit_item->isStackable() || edit_item->isCharged()) { edit_item->setSubtype(new_count); } - if(door) { + if (door) { door->setDoorID(new_door_id); } } - if(uid_changed) { + if (uid_changed) { edit_item->setUniqueID(new_uid); } - if(aid_changed) { + if (aid_changed) { edit_item->setActionID(new_aid); } - } else if(edit_monster) { + } else if (edit_monster) { int new_spawn_monster_time = count_field->GetValue(); edit_monster->setSpawnMonsterTime(new_spawn_monster_time); int* new_dir = reinterpret_cast(direction_field->GetClientData( - direction_field->GetSelection())); + direction_field->GetSelection() + )); - if(new_dir) { + if (new_dir) { edit_monster->setDirection((Direction)*new_dir); } - } else if(edit_npc) { + } else if (edit_npc) { int new_spawn_npc_time = count_field->GetValue(); edit_npc->setSpawnNpcTime(new_spawn_npc_time); int* new_dir = reinterpret_cast(direction_field->GetClientData( - direction_field->GetSelection())); + direction_field->GetSelection() + )); - if(new_dir) { + if (new_dir) { edit_npc->setDirection((Direction)*new_dir); } - } else if(edit_spawn_monster) { + } else if (edit_spawn_monster) { int new_spawn_monster_size = count_field->GetValue(); edit_spawn_monster->setSize(new_spawn_monster_size); - } else if(edit_spawn_npc) { + } else if (edit_spawn_npc) { int new_spawn_npc_size = count_field->GetValue(); edit_spawn_npc->setSize(new_spawn_npc_size); - } + } EndModal(1); } -void OldPropertiesWindow::OnClickCancel(wxCommandEvent& WXUNUSED(event)) -{ +void OldPropertiesWindow::OnClickCancel(wxCommandEvent &WXUNUSED(event)) { // Just close this window EndModal(0); } -void OldPropertiesWindow::Update() -{ +void OldPropertiesWindow::Update() { Container* container = dynamic_cast(edit_item); - if(container) { - for(uint32_t i = 0; i < container->getVolume(); ++i) { + if (container) { + for (uint32_t i = 0; i < container->getVolume(); ++i) { container_items[i]->setItem(container->getItem(i)); } } diff --git a/source/old_properties_window.h b/source/old_properties_window.h index 00b3a392..7f41b955 100644 --- a/source/old_properties_window.h +++ b/source/old_properties_window.h @@ -25,8 +25,7 @@ class ContainerItemButton; class ContainerItemPopupMenu; -class OldPropertiesWindow : public ObjectPropertiesWindowBase -{ +class OldPropertiesWindow : public ObjectPropertiesWindowBase { public: OldPropertiesWindow(wxWindow* parent, const Map* map, const Tile* tile, Item* item, wxPoint = wxDefaultPosition); OldPropertiesWindow(wxWindow* parent, const Map* map, const Tile* tile, Monster* monster, wxPoint = wxDefaultPosition); @@ -35,10 +34,10 @@ class OldPropertiesWindow : public ObjectPropertiesWindowBase OldPropertiesWindow(wxWindow* parent, const Map* map, const Tile* tile, SpawnNpc* spawnNpc, wxPoint = wxDefaultPosition); virtual ~OldPropertiesWindow(); - void OnFocusChange(wxFocusEvent&); + void OnFocusChange(wxFocusEvent &); - void OnClickOK(wxCommandEvent&); - void OnClickCancel(wxCommandEvent&); + void OnClickOK(wxCommandEvent &); + void OnClickCancel(wxCommandEvent &); void Update(); @@ -62,4 +61,3 @@ class OldPropertiesWindow : public ObjectPropertiesWindowBase }; #endif - diff --git a/source/otml.h b/source/otml.h index cdac5e03..5f64d739 100644 --- a/source/otml.h +++ b/source/otml.h @@ -40,84 +40,91 @@ using OTMLNodeWeakPtr = std::weak_ptr; using OTMLNodeList = std::vector; namespace otml_util { - template - bool cast(const T& in, R& out) { + template + bool cast(const T &in, R &out) { std::stringstream ss; ss << in; ss >> out; return !!ss && ss.eof(); } - template - bool cast(const T& in, std::string& out) { + template + bool cast(const T &in, std::string &out) { std::stringstream ss; ss << in; out = ss.str(); return true; } - template<> - inline bool cast(const std::string& in, std::string& out) { + template <> + inline bool cast(const std::string &in, std::string &out) { out = in; return true; } - template<> - inline bool cast(const std::string& in, bool& b) { - if(in == "true") + template <> + inline bool cast(const std::string &in, bool &b) { + if (in == "true") { b = true; - else if(in == "false") + } else if (in == "false") { b = false; - else + } else { return false; + } return true; } - template<> - inline bool cast(const std::string& in, char& c) { - if(in.length() != 1) + template <> + inline bool cast(const std::string &in, char &c) { + if (in.length() != 1) { return false; + } c = in[0]; return true; } - template<> - inline bool cast(const std::string& in, long& l) { - if(in.find_first_not_of("-0123456789") != std::string::npos) + template <> + inline bool cast(const std::string &in, long &l) { + if (in.find_first_not_of("-0123456789") != std::string::npos) { return false; + } std::size_t t = in.find_last_of('-'); - if(t != std::string::npos && t != 0) + if (t != std::string::npos && t != 0) { return false; + } l = atol(in.c_str()); return true; } - template<> - inline bool cast(const std::string& in, int& i) { + template <> + inline bool cast(const std::string &in, int &i) { long l; - if(cast(in, l)) { + if (cast(in, l)) { i = l; return true; } return false; } - template<> - inline bool cast(const std::string& in, double& d) { - if(in.find_first_not_of("-0123456789.") != std::string::npos) + template <> + inline bool cast(const std::string &in, double &d) { + if (in.find_first_not_of("-0123456789.") != std::string::npos) { return false; + } std::size_t t = in.find_last_of('-'); - if(t != std::string::npos && t != 0) + if (t != std::string::npos && t != 0) { return false; + } t = in.find_first_of('.'); - if(t != std::string::npos && (t == 0 || t == in.length() - 1 || in.find_first_of('.', t + 1) != std::string::npos)) + if (t != std::string::npos && (t == 0 || t == in.length() - 1 || in.find_first_of('.', t + 1) != std::string::npos)) { return false; + } d = atof(in.c_str()); return true; } - template<> - inline bool cast(const bool& in, std::string& out) { + template <> + inline bool cast(const bool &in, std::string &out) { out = (in ? "true" : "false"); return true; } @@ -125,26 +132,32 @@ namespace otml_util { class BadCast : public std::bad_cast { public: virtual ~BadCast() throw() { } - virtual const char* what() { return "failed to cast value"; } + virtual const char* what() { + return "failed to cast value"; + } }; - template - R safeCast(const T& t) { + template + R safeCast(const T &t) { R r; - if(!cast(t, r)) + if (!cast(t, r)) { throw BadCast(); + } return r; } }; class OTMLException : public std::exception { public: - OTMLException(const std::string& error) : m_what(error) { } - OTMLException(const OTMLNodePtr& node, const std::string& error); - OTMLException(const OTMLDocumentPtr& doc, const std::string& error, int line = -1); - virtual ~OTMLException() throw() { }; + OTMLException(const std::string &error) : + m_what(error) { } + OTMLException(const OTMLNodePtr &node, const std::string &error); + OTMLException(const OTMLDocumentPtr &doc, const std::string &error, int line = -1); + virtual ~OTMLException() throw() {}; - virtual const char* what() const throw() { return m_what.c_str(); } + virtual const char* what() const throw() { + return m_what.c_str(); + } protected: std::string m_what; @@ -157,66 +170,101 @@ class OTMLNode : public OTMLNodeEnableSharedFromThis { static OTMLNodePtr create(std::string tag = "", bool unique = false); static OTMLNodePtr create(std::string tag, std::string value); - std::string tag() const { return m_tag; } - int size() const { return m_children.size(); } - OTMLNodePtr parent() const { return m_parent.lock(); } - std::string source() const { return m_source; } - std::string rawValue() const { return m_value; } + std::string tag() const { + return m_tag; + } + int size() const { + return m_children.size(); + } + OTMLNodePtr parent() const { + return m_parent.lock(); + } + std::string source() const { + return m_source; + } + std::string rawValue() const { + return m_value; + } - bool isUnique() const { return m_unique; } - bool isNull() const { return m_null; } + bool isUnique() const { + return m_unique; + } + bool isNull() const { + return m_null; + } - bool hasTag() const { return !m_tag.empty(); } - bool hasValue() const { return !m_value.empty(); } + bool hasTag() const { + return !m_tag.empty(); + } + bool hasValue() const { + return !m_value.empty(); + } bool hasChildren() const; - bool hasChildAt(const std::string& childTag) { return !!get(childTag); } - bool hasChildAtIndex(int childIndex) { return !!getIndex(childIndex); } + bool hasChildAt(const std::string &childTag) { + return !!get(childTag); + } + bool hasChildAtIndex(int childIndex) { + return !!getIndex(childIndex); + } - void setTag(std::string tag) { m_tag = tag; } - void setValue(const std::string& value) { m_value = value; } - void setNull(bool null) { m_null = null; } - void setUnique(bool unique) { m_unique = unique; } - void setParent(const OTMLNodePtr& parent) { m_parent = parent; } - void setSource(const std::string& source) { m_source = source; } + void setTag(std::string tag) { + m_tag = tag; + } + void setValue(const std::string &value) { + m_value = value; + } + void setNull(bool null) { + m_null = null; + } + void setUnique(bool unique) { + m_unique = unique; + } + void setParent(const OTMLNodePtr &parent) { + m_parent = parent; + } + void setSource(const std::string &source) { + m_source = source; + } - OTMLNodePtr get(const std::string& childTag) const; + OTMLNodePtr get(const std::string &childTag) const; OTMLNodePtr getIndex(int childIndex) const; - OTMLNodePtr at(const std::string& childTag); + OTMLNodePtr at(const std::string &childTag); OTMLNodePtr atIndex(int childIndex); - void addChild(const OTMLNodePtr& newChild); - bool removeChild(const OTMLNodePtr& oldChild); - bool replaceChild(const OTMLNodePtr& oldChild, const OTMLNodePtr& newChild); - void merge(const OTMLNodePtr& node); - void copy(const OTMLNodePtr& node); + void addChild(const OTMLNodePtr &newChild); + bool removeChild(const OTMLNodePtr &oldChild); + bool replaceChild(const OTMLNodePtr &oldChild, const OTMLNodePtr &newChild); + void merge(const OTMLNodePtr &node); + void copy(const OTMLNodePtr &node); void clear(); OTMLNodeList children() const; OTMLNodePtr clone() const; - template + template T value(); - template - T valueAt(const std::string& childTag); - template + template + T valueAt(const std::string &childTag); + template T valueAtIndex(int childIndex); - template - T valueAt(const std::string& childTag, const T& def); - template - T valueAtIndex(int childIndex, const T& def); - - template - void write(const T& v); - template - void writeAt(const std::string& childTag, const T& v); - template - void writeIn(const T& v); + template + T valueAt(const std::string &childTag, const T &def); + template + T valueAtIndex(int childIndex, const T &def); + + template + void write(const T &v); + template + void writeAt(const std::string &childTag, const T &v); + template + void writeIn(const T &v); virtual std::string emit(); protected: - OTMLNode() : m_unique(false), m_null(false) { } + OTMLNode() : + m_unique(false), m_null(false) { } OTMLNodeList m_children; OTMLNodeWeakPtr m_parent; @@ -231,10 +279,10 @@ class OTMLDocument : public OTMLNode { public: virtual ~OTMLDocument() { } static OTMLDocumentPtr create(); - static OTMLDocumentPtr parse(const std::string& fileName); - static OTMLDocumentPtr parse(std::istream& in, const std::string& source); + static OTMLDocumentPtr parse(const std::string &fileName); + static OTMLDocumentPtr parse(std::istream &in, const std::string &source); std::string emit(); - bool save(const std::string& fileName); + bool save(const std::string &fileName); private: OTMLDocument() { } @@ -242,7 +290,7 @@ class OTMLDocument : public OTMLNode { class OTMLParser { public: - OTMLParser(OTMLDocumentPtr doc, std::istream& in) : + OTMLParser(OTMLDocumentPtr doc, std::istream &in) : currentDepth(0), currentLine(0), doc(doc), currentParent(doc), in(in) { } @@ -250,39 +298,41 @@ class OTMLParser { private: std::string getNextLine(); - int getLineDepth(const std::string& line, bool multilining = false); + int getLineDepth(const std::string &line, bool multilining = false); void parseLine(std::string line); - void parseNode(const std::string& data); + void parseNode(const std::string &data); int currentDepth; int currentLine; OTMLDocumentPtr doc; OTMLNodePtr currentParent; OTMLNodePtr previousNode; - std::istream& in; + std::istream ∈ }; class OTMLEmitter { public: - static std::string emitNode(const OTMLNodePtr& node, int currentDepth = -1); + static std::string emitNode(const OTMLNodePtr &node, int currentDepth = -1); }; -inline OTMLException::OTMLException(const OTMLNodePtr& node, const std::string& error) { +inline OTMLException::OTMLException(const OTMLNodePtr &node, const std::string &error) { std::stringstream ss; ss << "OTML error"; - if(!node->source().empty()) + if (!node->source().empty()) { ss << " in '" << node->source() << "'"; + } ss << ": " << error; m_what = ss.str(); } -inline OTMLException::OTMLException(const OTMLDocumentPtr& doc, const std::string& error, int line) { +inline OTMLException::OTMLException(const OTMLDocumentPtr &doc, const std::string &error, int line) { std::stringstream ss; ss << "OTML error"; - if(doc && !doc->source().empty()) { + if (doc && !doc->source().empty()) { ss << " in '" << doc->source() << "'"; - if(line >= 0) + if (line >= 0) { ss << " at line " << line; + } } ss << ": " << error; m_what = ss.str(); @@ -305,39 +355,42 @@ inline OTMLNodePtr OTMLNode::create(std::string tag, std::string value) { inline bool OTMLNode::hasChildren() const { int count = 0; - for(OTMLNodeList::const_iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { - const OTMLNodePtr& child = *it; - if(!child->isNull()) + for (OTMLNodeList::const_iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { + const OTMLNodePtr &child = *it; + if (!child->isNull()) { count++; + } } return count > 0; } -inline OTMLNodePtr OTMLNode::get(const std::string& childTag) const { - for(OTMLNodeList::const_iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { - const OTMLNodePtr& child = *it; - if(child->tag() == childTag && !child->isNull()) +inline OTMLNodePtr OTMLNode::get(const std::string &childTag) const { + for (OTMLNodeList::const_iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { + const OTMLNodePtr &child = *it; + if (child->tag() == childTag && !child->isNull()) { return child; + } } return OTMLNodePtr(); } inline OTMLNodePtr OTMLNode::getIndex(int childIndex) const { - if(childIndex < size() && childIndex >= 0) + if (childIndex < size() && childIndex >= 0) { return m_children[childIndex]; + } return OTMLNodePtr(); } -inline OTMLNodePtr OTMLNode::at(const std::string& childTag) { +inline OTMLNodePtr OTMLNode::at(const std::string &childTag) { OTMLNodePtr res; - for(OTMLNodeList::iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { - const OTMLNodePtr& child = *it; - if(child->tag() == childTag && !child->isNull()) { + for (OTMLNodeList::iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { + const OTMLNodePtr &child = *it; + if (child->tag() == childTag && !child->isNull()) { res = child; break; } } - if(!res) { + if (!res) { std::stringstream ss; ss << "child node with tag '" << childTag << "' not found"; throw OTMLException(shared_from_this(), ss.str()); @@ -346,7 +399,7 @@ inline OTMLNodePtr OTMLNode::at(const std::string& childTag) { } inline OTMLNodePtr OTMLNode::atIndex(int childIndex) { - if(childIndex >= size() || childIndex < 0) { + if (childIndex >= size() || childIndex < 0) { std::stringstream ss; ss << "child node with index '" << childIndex << "' not found"; throw OTMLException(shared_from_this(), ss.str()); @@ -354,14 +407,14 @@ inline OTMLNodePtr OTMLNode::atIndex(int childIndex) { return m_children[childIndex]; } -inline void OTMLNode::addChild(const OTMLNodePtr& newChild) { - if(newChild->hasTag()) { - for(OTMLNodeList::iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { - const OTMLNodePtr& node = *it; - if(node->tag() == newChild->tag() && (node->isUnique() || newChild->isUnique())) { +inline void OTMLNode::addChild(const OTMLNodePtr &newChild) { + if (newChild->hasTag()) { + for (OTMLNodeList::iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { + const OTMLNodePtr &node = *it; + if (node->tag() == newChild->tag() && (node->isUnique() || newChild->isUnique())) { newChild->setUnique(true); - if(node->hasChildren() && newChild->hasChildren()) { + if (node->hasChildren() && newChild->hasChildren()) { OTMLNodePtr tmpNode = node->clone(); tmpNode->merge(newChild); newChild->copy(tmpNode); @@ -369,14 +422,14 @@ inline void OTMLNode::addChild(const OTMLNodePtr& newChild) { replaceChild(node, newChild); OTMLNodeList::iterator it = m_children.begin(); - while(it != m_children.end()) { + while (it != m_children.end()) { OTMLNodePtr node = (*it); - if(node != newChild && node->tag() == newChild->tag()) { + if (node != newChild && node->tag() == newChild->tag()) { node->setParent(OTMLNodePtr()); it = m_children.erase(it); - } - else + } else { ++it; + } } return; } @@ -386,9 +439,9 @@ inline void OTMLNode::addChild(const OTMLNodePtr& newChild) { newChild->setParent(shared_from_this()); } -inline bool OTMLNode::removeChild(const OTMLNodePtr& oldChild) { +inline bool OTMLNode::removeChild(const OTMLNodePtr &oldChild) { OTMLNodeList::iterator it = std::find(m_children.begin(), m_children.end(), oldChild); - if(it != m_children.end()) { + if (it != m_children.end()) { m_children.erase(it); oldChild->setParent(OTMLNodePtr()); return true; @@ -396,9 +449,9 @@ inline bool OTMLNode::removeChild(const OTMLNodePtr& oldChild) { return false; } -inline bool OTMLNode::replaceChild(const OTMLNodePtr& oldChild, const OTMLNodePtr& newChild) { +inline bool OTMLNode::replaceChild(const OTMLNodePtr &oldChild, const OTMLNodePtr &newChild) { OTMLNodeList::iterator it = std::find(m_children.begin(), m_children.end(), oldChild); - if(it != m_children.end()) { + if (it != m_children.end()) { oldChild->setParent(OTMLNodePtr()); newChild->setParent(shared_from_this()); it = m_children.erase(it); @@ -408,23 +461,22 @@ inline bool OTMLNode::replaceChild(const OTMLNodePtr& oldChild, const OTMLNodePt return false; } -inline void OTMLNode::copy(const OTMLNodePtr& node) -{ +inline void OTMLNode::copy(const OTMLNodePtr &node) { setTag(node->tag()); setValue(node->rawValue()); setUnique(node->isUnique()); setNull(node->isNull()); setSource(node->source()); clear(); - for(OTMLNodeList::iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { - const OTMLNodePtr& child = *it; + for (OTMLNodeList::iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { + const OTMLNodePtr &child = *it; addChild(child->clone()); } } -inline void OTMLNode::merge(const OTMLNodePtr& node) { - for(OTMLNodeList::iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { - const OTMLNodePtr& child = *it; +inline void OTMLNode::merge(const OTMLNodePtr &node) { + for (OTMLNodeList::iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { + const OTMLNodePtr &child = *it; addChild(child->clone()); } setTag(node->tag()); @@ -432,8 +484,8 @@ inline void OTMLNode::merge(const OTMLNodePtr& node) { } inline void OTMLNode::clear() { - for(OTMLNodeList::iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { - const OTMLNodePtr& child = *it; + for (OTMLNodeList::iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { + const OTMLNodePtr &child = *it; child->setParent(OTMLNodePtr()); } m_children.clear(); @@ -441,10 +493,11 @@ inline void OTMLNode::clear() { inline OTMLNodeList OTMLNode::children() const { OTMLNodeList children; - for(OTMLNodeList::const_iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { - const OTMLNodePtr& child = *it; - if(!child->isNull()) + for (OTMLNodeList::const_iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { + const OTMLNodePtr &child = *it; + if (!child->isNull()) { children.push_back(child); + } } return children; } @@ -456,8 +509,8 @@ inline OTMLNodePtr OTMLNode::clone() const { myClone->setUnique(m_unique); myClone->setNull(m_null); myClone->setSource(m_source); - for(OTMLNodeList::const_iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { - const OTMLNodePtr& child = *it; + for (OTMLNodeList::const_iterator it = m_children.begin(), end = m_children.end(); it != end; ++it) { + const OTMLNodePtr &child = *it; myClone->addChild(child->clone()); } return myClone; @@ -467,7 +520,7 @@ inline std::string OTMLNode::emit() { return OTMLEmitter::emitNode(shared_from_this(), 0); } -template<> +template <> inline std::string OTMLNode::value() { std::string value = m_value; if (value.starts_with("\"") && value.ends_with("\"")) { @@ -481,56 +534,60 @@ inline std::string OTMLNode::value() { return value; } -template +template T OTMLNode::value() { T ret; - if(!otml_util::cast(m_value, ret)) + if (!otml_util::cast(m_value, ret)) { throw OTMLException(shared_from_this(), "failed to cast node value"); + } return ret; } -template -T OTMLNode::valueAt(const std::string& childTag) { +template +T OTMLNode::valueAt(const std::string &childTag) { OTMLNodePtr node = at(childTag); return node->value(); } -template +template T OTMLNode::valueAtIndex(int childIndex) { OTMLNodePtr node = atIndex(childIndex); return node->value(); } -template -T OTMLNode::valueAt(const std::string& childTag, const T& def) { - if(OTMLNodePtr node = get(childTag)) - if(!node->isNull()) +template +T OTMLNode::valueAt(const std::string &childTag, const T &def) { + if (OTMLNodePtr node = get(childTag)) { + if (!node->isNull()) { return node->value(); + } + } return def; } -template -T OTMLNode::valueAtIndex(int childIndex, const T& def) { - if(OTMLNodePtr node = getIndex(childIndex)) +template +T OTMLNode::valueAtIndex(int childIndex, const T &def) { + if (OTMLNodePtr node = getIndex(childIndex)) { return node->value(); + } return def; } -template -void OTMLNode::write(const T& v) { +template +void OTMLNode::write(const T &v) { m_value = otml_util::safeCast(v); } -template -void OTMLNode::writeAt(const std::string& childTag, const T& v) { +template +void OTMLNode::writeAt(const std::string &childTag, const T &v) { OTMLNodePtr child = OTMLNode::create(childTag); child->setUnique(true); child->write(v); addChild(child); } -template -void OTMLNode::writeIn(const T& v) { +template +void OTMLNode::writeIn(const T &v) { OTMLNodePtr child = OTMLNode::create(); child->write(v); addChild(child); @@ -542,9 +599,9 @@ inline OTMLDocumentPtr OTMLDocument::create() { return doc; } -inline OTMLDocumentPtr OTMLDocument::parse(const std::string& fileName) { +inline OTMLDocumentPtr OTMLDocument::parse(const std::string &fileName) { std::ifstream fin(fileName.c_str()); - if(!fin.good()) { + if (!fin.good()) { std::stringstream ss; ss << "failed to open file " << fileName; throw OTMLException(ss.str()); @@ -552,7 +609,7 @@ inline OTMLDocumentPtr OTMLDocument::parse(const std::string& fileName) { return parse(fin, fileName); } -inline OTMLDocumentPtr OTMLDocument::parse(std::istream& in, const std::string& source) { +inline OTMLDocumentPtr OTMLDocument::parse(std::istream &in, const std::string &source) { OTMLDocumentPtr doc(new OTMLDocument); doc->setSource(source); OTMLParser parser(doc, in); @@ -564,10 +621,10 @@ inline std::string OTMLDocument::emit() { return OTMLEmitter::emitNode(shared_from_this()) + "\n"; } -inline bool OTMLDocument::save(const std::string& fileName) { +inline bool OTMLDocument::save(const std::string &fileName) { m_source = fileName; std::ofstream fout(fileName.c_str()); - if(fout.good()) { + if (fout.good()) { fout << emit(); fout.close(); return true; @@ -575,58 +632,66 @@ inline bool OTMLDocument::save(const std::string& fileName) { return false; } -inline std::string OTMLEmitter::emitNode(const OTMLNodePtr& node, int currentDepth) { +inline std::string OTMLEmitter::emitNode(const OTMLNodePtr &node, int currentDepth) { std::stringstream ss; - if(currentDepth >= 0) { - for(int i = 0; i= 0) { + for (int i = 0; i < currentDepth; ++i) { ss << " "; - if(node->hasTag()) { + } + if (node->hasTag()) { ss << node->tag(); - if(node->hasValue() || node->isUnique() || node->isNull()) + if (node->hasValue() || node->isUnique() || node->isNull()) { ss << ":"; - } - else + } + } else { ss << "-"; - if(node->isNull()) + } + if (node->isNull()) { ss << " ~"; - else if(node->hasValue()) { + } else if (node->hasValue()) { ss << " "; std::string value = node->rawValue(); - if(value.find("\n") != std::string::npos) { - if(value[value.length() - 1] == '\n' && value[value.length() - 2] == '\n') + if (value.find("\n") != std::string::npos) { + if (value[value.length() - 1] == '\n' && value[value.length() - 2] == '\n') { ss << "|+"; - else if(value[value.length() - 1] == '\n') + } else if (value[value.length() - 1] == '\n') { ss << "|"; - else + } else { ss << "|-"; - for(std::size_t pos = 0; pos < value.length(); ++pos) { + } + for (std::size_t pos = 0; pos < value.length(); ++pos) { ss << "\n"; - for(int i = 0; isize(); ++i) { - if(currentDepth >= 0 || i != 0) + for (int i = 0; i < node->size(); ++i) { + if (currentDepth >= 0 || i != 0) { ss << "\n"; + } ss << emitNode(node->atIndex(i), currentDepth + 1); } return ss.str(); } inline void OTMLParser::parse() { - if(!in.good()) + if (!in.good()) { throw OTMLException(doc, "cannot read from input stream"); - while(!in.eof()) + } + while (!in.eof()) { parseLine(getNextLine()); + } } inline std::string OTMLParser::getNextLine() { @@ -636,90 +701,95 @@ inline std::string OTMLParser::getNextLine() { return line; } -inline int OTMLParser::getLineDepth(const std::string& line, bool multilining) { +inline int OTMLParser::getLineDepth(const std::string &line, bool multilining) { std::size_t spaces = 0; - while(line[spaces] == ' ') + while (line[spaces] == ' ') { spaces++; + } int depth = spaces / 2; - if(!multilining || depth <= currentDepth) { - if(line[spaces] == '\t') + if (!multilining || depth <= currentDepth) { + if (line[spaces] == '\t') { throw OTMLException(doc, "indentation with tabs are not allowed", currentLine); - if(spaces % 2 != 0) + } + if (spaces % 2 != 0) { throw OTMLException(doc, "must indent every 2 spaces", currentLine); + } } return depth; } inline void OTMLParser::parseLine(std::string line) { int depth = getLineDepth(line); - if (depth == -1) + if (depth == -1) { return; + } trim(line); - if (line.empty()) + if (line.empty()) { return; - if (line.substr(0, 2) == "//") + } + if (line.substr(0, 2) == "//") { return; + } if (depth == currentDepth + 1) { currentParent = previousNode; - } - else if (depth < currentDepth) { - for (int i = 0; i < currentDepth - depth; ++i) + } else if (depth < currentDepth) { + for (int i = 0; i < currentDepth - depth; ++i) { currentParent = currentParent->parent(); - } - else if (depth != currentDepth) { + } + } else if (depth != currentDepth) { throw OTMLException(doc, "invalid indentation depth, are you indenting correctly?", currentLine); } currentDepth = depth; parseNode(line); } -inline void OTMLParser::parseNode(const std::string& data) { +inline void OTMLParser::parseNode(const std::string &data) { std::string tag; std::string value; std::size_t dotsPos = data.find_first_of(':'); int nodeLine = currentLine; - if(!data.empty() && data[0] == '-') { + if (!data.empty() && data[0] == '-') { value = data.substr(1); trim(value); - } - else if(dotsPos != std::string::npos) { + } else if (dotsPos != std::string::npos) { tag = data.substr(0, dotsPos); - if(data.size() > dotsPos + 1) + if (data.size() > dotsPos + 1) { value = data.substr(dotsPos + 1); - } - else { + } + } else { tag = data; } trim(tag); trim(value); - if(value == "|" || value == "|-" || value == "|+") { + if (value == "|" || value == "|-" || value == "|+") { std::string multiLineData; do { size_t lastPos = in.tellg(); std::string line = getNextLine(); int depth = getLineDepth(line, true); - if(depth > currentDepth) { + if (depth > currentDepth) { multiLineData += line.substr((currentDepth + 1) * 2); - } - else { + } else { trim(line); - if(!line.empty()) { + if (!line.empty()) { in.seekg(lastPos, std::ios::beg); currentLine--; break; } } multiLineData += "\n"; - } while(!in.eof()); - if(value == "|" || value == "|-") { + } while (!in.eof()); + if (value == "|" || value == "|-") { int lastPos = multiLineData.length(); - while(multiLineData[--lastPos] == '\n') + while (multiLineData[--lastPos] == '\n') { multiLineData.erase(lastPos, 1); + } - if(value == "|") + if (value == "|") { multiLineData.append("\n"); + } } value = multiLineData; } @@ -727,23 +797,23 @@ inline void OTMLParser::parseNode(const std::string& data) { node->setUnique(dotsPos != std::string::npos); node->setTag(tag); node->setSource(doc->source() + ":" + otml_util::safeCast(nodeLine)); - if(value == "~") + if (value == "~") { node->setNull(true); - else { + } else { if (value.starts_with("[") && value.ends_with("]")) { std::string tmp = value.substr(1, value.length() - 2); std::regex sep(","); std::sregex_token_iterator it(tmp.begin(), tmp.end(), sep, -1); std::sregex_token_iterator end; std::vector tokens(it, end); - for (const auto& token : tokens) { + for (const auto &token : tokens) { std::string v = *it; trim(v); node->writeIn(v); } - } - else + } else { node->setValue(value); + } } currentParent->addChild(node); diff --git a/source/outfit.h b/source/outfit.h index 348c90aa..bf92d689 100644 --- a/source/outfit.h +++ b/source/outfit.h @@ -19,8 +19,9 @@ #define RME_OUTFIT_H_ struct Outfit { - Outfit() : lookType(0), lookItem(0), lookMount(0), lookAddon(0), lookHead(0), lookBody(0), lookLegs(0), lookFeet(0) {} - ~Outfit() {} + Outfit() : + lookType(0), lookItem(0), lookMount(0), lookAddon(0), lookHead(0), lookBody(0), lookLegs(0), lookFeet(0) { } + ~Outfit() { } int lookType; int lookItem; int lookMount; diff --git a/source/palette_brushlist.cpp b/source/palette_brushlist.cpp index 125e0430..4e605d67 100644 --- a/source/palette_brushlist.cpp +++ b/source/palette_brushlist.cpp @@ -26,27 +26,26 @@ // A common class for terrain/doodad/item/raw palette BEGIN_EVENT_TABLE(BrushPalettePanel, PalettePanel) - EVT_CHOICEBOOK_PAGE_CHANGING(wxID_ANY, BrushPalettePanel::OnSwitchingPage) - EVT_CHOICEBOOK_PAGE_CHANGED(wxID_ANY, BrushPalettePanel::OnPageChanged) +EVT_CHOICEBOOK_PAGE_CHANGING(wxID_ANY, BrushPalettePanel::OnSwitchingPage) +EVT_CHOICEBOOK_PAGE_CHANGED(wxID_ANY, BrushPalettePanel::OnPageChanged) END_EVENT_TABLE() -BrushPalettePanel::BrushPalettePanel(wxWindow* parent, const TilesetContainer& tilesets, TilesetCategoryType category, wxWindowID id) : +BrushPalettePanel::BrushPalettePanel(wxWindow* parent, const TilesetContainer &tilesets, TilesetCategoryType category, wxWindowID id) : PalettePanel(parent, id), palette_type(category), choicebook(nullptr), - size_panel(nullptr) -{ + size_panel(nullptr) { wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); // Create the tileset panel wxSizer* ts_sizer = newd wxStaticBoxSizer(wxVERTICAL, this, "Tileset"); - wxChoicebook* tmp_choicebook = newd wxChoicebook(this, wxID_ANY, wxDefaultPosition, wxSize(180,250)); + wxChoicebook* tmp_choicebook = newd wxChoicebook(this, wxID_ANY, wxDefaultPosition, wxSize(180, 250)); ts_sizer->Add(tmp_choicebook, 1, wxEXPAND); topsizer->Add(ts_sizer, 1, wxEXPAND); - for(TilesetContainer::const_iterator iter = tilesets.begin(); iter != tilesets.end(); ++iter) { + for (TilesetContainer::const_iterator iter = tilesets.begin(); iter != tilesets.end(); ++iter) { const TilesetCategory* tcg = iter->second->getCategory(category); - if(tcg && tcg->size() > 0) { + if (tcg && tcg->size() > 0) { BrushPanel* panel = newd BrushPanel(tmp_choicebook); panel->AssignTileset(tcg); tmp_choicebook->AddPage(panel, wxstr(iter->second->name)); @@ -58,120 +57,120 @@ BrushPalettePanel::BrushPalettePanel(wxWindow* parent, const TilesetContainer& t choicebook = tmp_choicebook; } -BrushPalettePanel::~BrushPalettePanel() -{ +BrushPalettePanel::~BrushPalettePanel() { //// } -void BrushPalettePanel::InvalidateContents() -{ - for(size_t iz = 0; iz < choicebook->GetPageCount(); ++iz) { +void BrushPalettePanel::InvalidateContents() { + for (size_t iz = 0; iz < choicebook->GetPageCount(); ++iz) { BrushPanel* panel = dynamic_cast(choicebook->GetPage(iz)); panel->InvalidateContents(); } PalettePanel::InvalidateContents(); } -void BrushPalettePanel::LoadCurrentContents() -{ +void BrushPalettePanel::LoadCurrentContents() { wxWindow* page = choicebook->GetCurrentPage(); BrushPanel* panel = dynamic_cast(page); - if(panel) { + if (panel) { panel->OnSwitchIn(); } PalettePanel::LoadCurrentContents(); } -void BrushPalettePanel::LoadAllContents() -{ - for(size_t iz = 0; iz < choicebook->GetPageCount(); ++iz) { +void BrushPalettePanel::LoadAllContents() { + for (size_t iz = 0; iz < choicebook->GetPageCount(); ++iz) { BrushPanel* panel = dynamic_cast(choicebook->GetPage(iz)); panel->LoadContents(); } PalettePanel::LoadAllContents(); } -PaletteType BrushPalettePanel::GetType() const -{ +PaletteType BrushPalettePanel::GetType() const { return palette_type; } -void BrushPalettePanel::SetListType(BrushListType ltype) -{ - if(!choicebook) return; - for(size_t iz = 0; iz < choicebook->GetPageCount(); ++iz) { +void BrushPalettePanel::SetListType(BrushListType ltype) { + if (!choicebook) { + return; + } + for (size_t iz = 0; iz < choicebook->GetPageCount(); ++iz) { BrushPanel* panel = dynamic_cast(choicebook->GetPage(iz)); panel->SetListType(ltype); } } -void BrushPalettePanel::SetListType(wxString ltype) -{ - if(!choicebook) return; - for(size_t iz = 0; iz < choicebook->GetPageCount(); ++iz) { +void BrushPalettePanel::SetListType(wxString ltype) { + if (!choicebook) { + return; + } + for (size_t iz = 0; iz < choicebook->GetPageCount(); ++iz) { BrushPanel* panel = dynamic_cast(choicebook->GetPage(iz)); panel->SetListType(ltype); } } -Brush* BrushPalettePanel::GetSelectedBrush() const -{ - if(!choicebook) return nullptr; +Brush* BrushPalettePanel::GetSelectedBrush() const { + if (!choicebook) { + return nullptr; + } wxWindow* page = choicebook->GetCurrentPage(); BrushPanel* panel = dynamic_cast(page); Brush* res = nullptr; - if(panel) { - for(ToolBarList::const_iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { + if (panel) { + for (ToolBarList::const_iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { res = (*iter)->GetSelectedBrush(); - if(res) return res; + if (res) { + return res; + } } res = panel->GetSelectedBrush(); } return res; } -void BrushPalettePanel::SelectFirstBrush() -{ - if(!choicebook) return; +void BrushPalettePanel::SelectFirstBrush() { + if (!choicebook) { + return; + } wxWindow* page = choicebook->GetCurrentPage(); BrushPanel* panel = dynamic_cast(page); panel->SelectFirstBrush(); } -bool BrushPalettePanel::SelectBrush(const Brush* whatbrush) -{ - if(!choicebook) { +bool BrushPalettePanel::SelectBrush(const Brush* whatbrush) { + if (!choicebook) { return false; } BrushPanel* panel = dynamic_cast(choicebook->GetCurrentPage()); - if(!panel) { + if (!panel) { return false; } - for(PalettePanel* toolBar : tool_bars) { - if(toolBar->SelectBrush(whatbrush)) { + for (PalettePanel* toolBar : tool_bars) { + if (toolBar->SelectBrush(whatbrush)) { panel->SelectBrush(nullptr); return true; } } - if(panel->SelectBrush(whatbrush)) { - for(PalettePanel* toolBar : tool_bars) { + if (panel->SelectBrush(whatbrush)) { + for (PalettePanel* toolBar : tool_bars) { toolBar->SelectBrush(nullptr); } return true; } - for(size_t iz = 0; iz < choicebook->GetPageCount(); ++iz) { - if((int)iz == choicebook->GetSelection()) { + for (size_t iz = 0; iz < choicebook->GetPageCount(); ++iz) { + if ((int)iz == choicebook->GetSelection()) { continue; } panel = dynamic_cast(choicebook->GetPage(iz)); - if(panel && panel->SelectBrush(whatbrush)) { + if (panel && panel->SelectBrush(whatbrush)) { choicebook->ChangeSelection(iz); - for(PalettePanel* toolBar : tool_bars) { + for (PalettePanel* toolBar : tool_bars) { toolBar->SelectBrush(nullptr); } return true; @@ -180,18 +179,17 @@ bool BrushPalettePanel::SelectBrush(const Brush* whatbrush) return false; } -void BrushPalettePanel::OnSwitchingPage(wxChoicebookEvent& event) -{ +void BrushPalettePanel::OnSwitchingPage(wxChoicebookEvent &event) { event.Skip(); - if(!choicebook) { + if (!choicebook) { return; } BrushPanel* old_panel = dynamic_cast(choicebook->GetCurrentPage()); - if(old_panel) { + if (old_panel) { old_panel->OnSwitchOut(); - for(ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { + for (ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { Brush* tmp = (*iter)->GetSelectedBrush(); - if(tmp) { + if (tmp) { remembered_brushes[old_panel] = tmp; } } @@ -199,17 +197,16 @@ void BrushPalettePanel::OnSwitchingPage(wxChoicebookEvent& event) wxWindow* page = choicebook->GetPage(event.GetSelection()); BrushPanel* panel = dynamic_cast(page); - if(panel) { + if (panel) { panel->OnSwitchIn(); - for(ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { + for (ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { (*iter)->SelectBrush(remembered_brushes[panel]); } } } -void BrushPalettePanel::OnPageChanged(wxChoicebookEvent& event) -{ - if(!choicebook) { +void BrushPalettePanel::OnPageChanged(wxChoicebookEvent &event) { + if (!choicebook) { return; } g_gui.ActivatePalette(GetParentPalette()); @@ -228,65 +225,58 @@ void BrushPalettePanel::OnSwitchIn() { // A container of brush buttons BEGIN_EVENT_TABLE(BrushPanel, wxPanel) - // Listbox style - EVT_LISTBOX(wxID_ANY, BrushPanel::OnClickListBoxRow) +// Listbox style +EVT_LISTBOX(wxID_ANY, BrushPanel::OnClickListBoxRow) END_EVENT_TABLE() -BrushPanel::BrushPanel(wxWindow *parent) : +BrushPanel::BrushPanel(wxWindow* parent) : wxPanel(parent, wxID_ANY), tileset(nullptr), brushbox(nullptr), loaded(false), - list_type(BRUSHLIST_LISTBOX) -{ + list_type(BRUSHLIST_LISTBOX) { sizer = newd wxBoxSizer(wxVERTICAL); SetSizerAndFit(sizer); } -BrushPanel::~BrushPanel() -{ +BrushPanel::~BrushPanel() { //// } -void BrushPanel::AssignTileset(const TilesetCategory* _tileset) -{ - if(_tileset != tileset) { +void BrushPanel::AssignTileset(const TilesetCategory* _tileset) { + if (_tileset != tileset) { InvalidateContents(); tileset = _tileset; } } -void BrushPanel::SetListType(BrushListType ltype) -{ - if(list_type != ltype) { +void BrushPanel::SetListType(BrushListType ltype) { + if (list_type != ltype) { InvalidateContents(); list_type = ltype; } } -void BrushPanel::SetListType(wxString ltype) -{ - if(ltype == "small icons") { +void BrushPanel::SetListType(wxString ltype) { + if (ltype == "small icons") { SetListType(BRUSHLIST_SMALL_ICONS); - } else if(ltype == "large icons") { + } else if (ltype == "large icons") { SetListType(BRUSHLIST_LARGE_ICONS); - } else if(ltype == "listbox") { + } else if (ltype == "listbox") { SetListType(BRUSHLIST_LISTBOX); - } else if(ltype == "textlistbox") { + } else if (ltype == "textlistbox") { SetListType(BRUSHLIST_TEXT_LISTBOX); } } -void BrushPanel::InvalidateContents() -{ +void BrushPanel::InvalidateContents() { sizer->Clear(true); loaded = false; brushbox = nullptr; } -void BrushPanel::LoadContents() -{ - if(loaded) { +void BrushPanel::LoadContents() { + if (loaded) { return; } loaded = true; @@ -310,38 +300,35 @@ void BrushPanel::LoadContents() brushbox->SelectFirstBrush(); } -void BrushPanel::SelectFirstBrush() -{ - if(loaded) { +void BrushPanel::SelectFirstBrush() { + if (loaded) { ASSERT(brushbox != nullptr); brushbox->SelectFirstBrush(); } } -Brush* BrushPanel::GetSelectedBrush() const -{ - if(loaded) { +Brush* BrushPanel::GetSelectedBrush() const { + if (loaded) { ASSERT(brushbox != nullptr); return brushbox->GetSelectedBrush(); } - if(tileset && tileset->size() > 0) { + if (tileset && tileset->size() > 0) { return tileset->brushlist[0]; } return nullptr; } -bool BrushPanel::SelectBrush(const Brush* whatbrush) -{ - if(loaded) { - //std::cout << loaded << std::endl; - //std::cout << brushbox << std::endl; +bool BrushPanel::SelectBrush(const Brush* whatbrush) { + if (loaded) { + // std::cout << loaded << std::endl; + // std::cout << brushbox << std::endl; ASSERT(brushbox != nullptr); return brushbox->SelectBrush(whatbrush); } - for(BrushVector::const_iterator iter = tileset->brushlist.begin(); iter != tileset->brushlist.end(); ++iter) { - if(*iter == whatbrush) { + for (BrushVector::const_iterator iter = tileset->brushlist.begin(); iter != tileset->brushlist.end(); ++iter) { + if (*iter == whatbrush) { LoadContents(); return brushbox->SelectBrush(whatbrush); } @@ -349,29 +336,27 @@ bool BrushPanel::SelectBrush(const Brush* whatbrush) return false; } -void BrushPanel::OnSwitchIn() -{ +void BrushPanel::OnSwitchIn() { LoadContents(); } -void BrushPanel::OnSwitchOut() -{ +void BrushPanel::OnSwitchOut() { //// } -void BrushPanel::OnClickListBoxRow(wxCommandEvent& event) -{ +void BrushPanel::OnClickListBoxRow(wxCommandEvent &event) { ASSERT(tileset->getType() >= TILESET_UNKNOWN && tileset->getType() <= TILESET_HOUSE); // We just notify the GUI of the action, it will take care of everything else ASSERT(brushbox); size_t n = event.GetSelection(); - wxWindow* w = this; - while((w = w->GetParent()) && dynamic_cast(w) == nullptr); + while ((w = w->GetParent()) && dynamic_cast(w) == nullptr) + ; - if(w) + if (w) { g_gui.ActivatePalette(static_cast(w)); + } g_gui.SelectBrush(tileset->brushlist[n], tileset->getType()); } @@ -380,18 +365,17 @@ void BrushPanel::OnClickListBoxRow(wxCommandEvent& event) // BrushIconBox BEGIN_EVENT_TABLE(BrushIconBox, wxScrolledWindow) - // Listbox style - EVT_TOGGLEBUTTON(wxID_ANY, BrushIconBox::OnClickBrushButton) +// Listbox style +EVT_TOGGLEBUTTON(wxID_ANY, BrushIconBox::OnClickBrushButton) END_EVENT_TABLE() -BrushIconBox::BrushIconBox(wxWindow *parent, const TilesetCategory *_tileset, RenderSize rsz) : +BrushIconBox::BrushIconBox(wxWindow* parent, const TilesetCategory* _tileset, RenderSize rsz) : wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL), BrushBoxInterface(_tileset), - icon_size(rsz) -{ + icon_size(rsz) { ASSERT(tileset->getType() >= TILESET_UNKNOWN && tileset->getType() <= TILESET_HOUSE); int width; - if(icon_size == RENDER_SIZE_32x32) { + if (icon_size == RENDER_SIZE_32x32) { width = std::max(g_settings.getInteger(Config::PALETTE_COL_COUNT) / 2 + 1, 1); } else { width = std::max(g_settings.getInteger(Config::PALETTE_COL_COUNT) + 1, 1); @@ -401,11 +385,11 @@ BrushIconBox::BrushIconBox(wxWindow *parent, const TilesetCategory *_tileset, Re wxSizer* stacksizer = newd wxBoxSizer(wxVERTICAL); wxSizer* rowsizer = nullptr; int item_counter = 0; - for(BrushVector::const_iterator iter = tileset->brushlist.begin(); iter != tileset->brushlist.end(); ++iter) { + for (BrushVector::const_iterator iter = tileset->brushlist.begin(); iter != tileset->brushlist.end(); ++iter) { ASSERT(*iter); ++item_counter; - if(!rowsizer) { + if (!rowsizer) { rowsizer = newd wxBoxSizer(wxHORIZONTAL); } @@ -413,52 +397,48 @@ BrushIconBox::BrushIconBox(wxWindow *parent, const TilesetCategory *_tileset, Re rowsizer->Add(bb); brush_buttons.push_back(bb); - if(item_counter % width == 0) { // newd row + if (item_counter % width == 0) { // newd row stacksizer->Add(rowsizer); rowsizer = nullptr; } } - if(rowsizer) { + if (rowsizer) { stacksizer->Add(rowsizer); } - SetScrollbars(20,20, 8, item_counter/width, 0, 0); + SetScrollbars(20, 20, 8, item_counter / width, 0, 0); SetSizer(stacksizer); } -BrushIconBox::~BrushIconBox() -{ +BrushIconBox::~BrushIconBox() { //// } -void BrushIconBox::SelectFirstBrush() -{ - if(tileset && tileset->size() > 0) { +void BrushIconBox::SelectFirstBrush() { + if (tileset && tileset->size() > 0) { DeselectAll(); brush_buttons[0]->SetValue(true); EnsureVisible((size_t)0); } } -Brush* BrushIconBox::GetSelectedBrush() const -{ - if(!tileset) { +Brush* BrushIconBox::GetSelectedBrush() const { + if (!tileset) { return nullptr; } - for(std::vector::const_iterator it = brush_buttons.begin(); it != brush_buttons.end(); ++it) { - if((*it)->GetValue()) { + for (std::vector::const_iterator it = brush_buttons.begin(); it != brush_buttons.end(); ++it) { + if ((*it)->GetValue()) { return (*it)->brush; } } return nullptr; } -bool BrushIconBox::SelectBrush(const Brush* whatbrush) -{ +bool BrushIconBox::SelectBrush(const Brush* whatbrush) { DeselectAll(); - for(std::vector::iterator it = brush_buttons.begin(); it != brush_buttons.end(); ++it) { - if((*it)->brush == whatbrush) { + for (std::vector::iterator it = brush_buttons.begin(); it != brush_buttons.end(); ++it) { + if ((*it)->brush == whatbrush) { (*it)->SetValue(true); EnsureVisible(*it); return true; @@ -467,15 +447,13 @@ bool BrushIconBox::SelectBrush(const Brush* whatbrush) return false; } -void BrushIconBox::DeselectAll() -{ - for(std::vector::iterator it = brush_buttons.begin(); it != brush_buttons.end(); ++it) { +void BrushIconBox::DeselectAll() { + for (std::vector::iterator it = brush_buttons.begin(); it != brush_buttons.end(); ++it) { (*it)->SetValue(false); } } -void BrushIconBox::EnsureVisible(BrushButton* btn) -{ +void BrushIconBox::EnsureVisible(BrushButton* btn) { int windowSizeX, windowSizeY; GetVirtualSize(&windowSizeX, &windowSizeY); @@ -497,26 +475,26 @@ void BrushIconBox::EnsureVisible(BrushButton* btn) GetClientSize(&clientSizeX, &clientSizeY); int endScrollPosY = startScrollPosY + clientSizeY / scrollUnitY; - if(scrollPosY < startScrollPosY || scrollPosY > endScrollPosY){ - //only scroll if the button isnt visible + if (scrollPosY < startScrollPosY || scrollPosY > endScrollPosY) { + // only scroll if the button isnt visible Scroll(-1, scrollPosY); } } -void BrushIconBox::EnsureVisible(size_t n) -{ +void BrushIconBox::EnsureVisible(size_t n) { EnsureVisible(brush_buttons[n]); } -void BrushIconBox::OnClickBrushButton(wxCommandEvent& event) -{ +void BrushIconBox::OnClickBrushButton(wxCommandEvent &event) { wxObject* obj = event.GetEventObject(); BrushButton* btn = dynamic_cast(obj); - if(btn) { + if (btn) { wxWindow* w = this; - while((w = w->GetParent()) && dynamic_cast(w) == nullptr); - if(w) + while ((w = w->GetParent()) && dynamic_cast(w) == nullptr) + ; + if (w) { g_gui.ActivatePalette(static_cast(w)); + } g_gui.SelectBrush(btn->brush, tileset->getType()); } } @@ -525,46 +503,41 @@ void BrushIconBox::OnClickBrushButton(wxCommandEvent& event) // BrushListBox BEGIN_EVENT_TABLE(BrushListBox, wxVListBox) - EVT_KEY_DOWN(BrushListBox::OnKey) +EVT_KEY_DOWN(BrushListBox::OnKey) END_EVENT_TABLE() BrushListBox::BrushListBox(wxWindow* parent, const TilesetCategory* tileset) : wxVListBox(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLB_SINGLE), - BrushBoxInterface(tileset) -{ + BrushBoxInterface(tileset) { SetItemCount(tileset->size()); } -BrushListBox::~BrushListBox() -{ +BrushListBox::~BrushListBox() { //// } -void BrushListBox::SelectFirstBrush() -{ +void BrushListBox::SelectFirstBrush() { SetSelection(0); wxWindow::ScrollLines(-1); } -Brush* BrushListBox::GetSelectedBrush() const -{ - if(!tileset) { +Brush* BrushListBox::GetSelectedBrush() const { + if (!tileset) { return nullptr; } int n = GetSelection(); - if(n != wxNOT_FOUND) { + if (n != wxNOT_FOUND) { return tileset->brushlist[n]; - } else if(tileset->size() > 0) { + } else if (tileset->size() > 0) { return tileset->brushlist[0]; } return nullptr; } -bool BrushListBox::SelectBrush(const Brush* whatbrush) -{ - for(size_t n = 0; n < tileset->size(); ++n) { - if(tileset->brushlist[n] == whatbrush) { +bool BrushListBox::SelectBrush(const Brush* whatbrush) { + for (size_t n = 0; n < tileset->size(); ++n) { + if (tileset->brushlist[n] == whatbrush) { SetSelection(n); return true; } @@ -572,48 +545,46 @@ bool BrushListBox::SelectBrush(const Brush* whatbrush) return false; } -void BrushListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const -{ +void BrushListBox::OnDrawItem(wxDC &dc, const wxRect &rect, size_t n) const { ASSERT(n < tileset->size()); Sprite* spr = g_gui.gfx.getSprite(tileset->brushlist[n]->getLookID()); - if(spr) { + if (spr) { spr->DrawTo(&dc, SPRITE_SIZE_32x32, rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight()); } - if(IsSelected(n)) { - if(HasFocus()) + if (IsSelected(n)) { + if (HasFocus()) { dc.SetTextForeground(wxColor(0xFF, 0xFF, 0xFF)); - else + } else { dc.SetTextForeground(wxColor(0x00, 0x00, 0xFF)); + } } else { dc.SetTextForeground(wxColor(0x00, 0x00, 0x00)); } dc.DrawText(wxstr(tileset->brushlist[n]->getName()), rect.GetX() + 40, rect.GetY() + 6); } -wxCoord BrushListBox::OnMeasureItem(size_t n) const -{ +wxCoord BrushListBox::OnMeasureItem(size_t n) const { return 32; } -void BrushListBox::OnKey(wxKeyEvent& event) -{ - switch(event.GetKeyCode()) { +void BrushListBox::OnKey(wxKeyEvent &event) { + switch (event.GetKeyCode()) { case WXK_UP: case WXK_DOWN: case WXK_LEFT: case WXK_RIGHT: - if(g_settings.getInteger(Config::LISTBOX_EATS_ALL_EVENTS)) { - case WXK_PAGEUP: - case WXK_PAGEDOWN: - case WXK_HOME: - case WXK_END: - event.Skip(true); + if (g_settings.getInteger(Config::LISTBOX_EATS_ALL_EVENTS)) { + case WXK_PAGEUP: + case WXK_PAGEDOWN: + case WXK_HOME: + case WXK_END: + event.Skip(true); } else { - [[fallthrough]]; - default: - if(g_gui.GetCurrentTab() != nullptr) { - g_gui.GetCurrentMapTab()->GetEventHandler()->AddPendingEvent(event); + [[fallthrough]]; + default: + if (g_gui.GetCurrentTab() != nullptr) { + g_gui.GetCurrentMapTab()->GetEventHandler()->AddPendingEvent(event); + } } - } } } diff --git a/source/palette_brushlist.h b/source/palette_brushlist.h index 1171f8ec..f3ea0e94 100644 --- a/source/palette_brushlist.h +++ b/source/palette_brushlist.h @@ -30,8 +30,11 @@ enum BrushListType { class BrushBoxInterface { public: - BrushBoxInterface(const TilesetCategory* _tileset) : tileset(_tileset), loaded(false) {ASSERT(tileset);} - virtual ~BrushBoxInterface() {} + BrushBoxInterface(const TilesetCategory* _tileset) : + tileset(_tileset), loaded(false) { + ASSERT(tileset); + } + virtual ~BrushBoxInterface() { } virtual wxWindow* GetSelfWindow() = 0; @@ -41,6 +44,7 @@ class BrushBoxInterface { virtual Brush* GetSelectedBrush() const = 0; // Select the brush in the parameter, this only changes the look of the panel virtual bool SelectBrush(const Brush* brush) = 0; + protected: const TilesetCategory* const tileset; bool loaded; @@ -51,7 +55,9 @@ class BrushListBox : public wxVListBox, public BrushBoxInterface { BrushListBox(wxWindow* parent, const TilesetCategory* _tileset); ~BrushListBox(); - wxWindow* GetSelfWindow() {return this;} + wxWindow* GetSelfWindow() { + return this; + } // Select the first brush void SelectFirstBrush(); @@ -61,10 +67,10 @@ class BrushListBox : public wxVListBox, public BrushBoxInterface { bool SelectBrush(const Brush* brush); // Event handlers - virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const; + virtual void OnDrawItem(wxDC &dc, const wxRect &rect, size_t n) const; virtual wxCoord OnMeasureItem(size_t n) const; - void OnKey(wxKeyEvent& event); + void OnKey(wxKeyEvent &event); DECLARE_EVENT_TABLE(); }; @@ -74,7 +80,9 @@ class BrushIconBox : public wxScrolledWindow, public BrushBoxInterface { BrushIconBox(wxWindow* parent, const TilesetCategory* _tileset, RenderSize rsz); ~BrushIconBox(); - wxWindow* GetSelfWindow() {return this;} + wxWindow* GetSelfWindow() { + return this; + } // Scrolls the window to the position of the named brush button void EnsureVisible(BrushButton* btn); @@ -88,10 +96,12 @@ class BrushIconBox : public wxScrolledWindow, public BrushBoxInterface { bool SelectBrush(const Brush* brush); // Event handling... - void OnClickBrushButton(wxCommandEvent& event); + void OnClickBrushButton(wxCommandEvent &event); + protected: // Used internally to deselect all buttons before selecting a newd one. void DeselectAll(); + protected: std::vector brush_buttons; RenderSize icon_size; @@ -135,7 +145,7 @@ class BrushPanel : public wxPanel { void OnSwitchOut(); // wxWidgets event handlers - void OnClickListBoxRow(wxCommandEvent& event); + void OnClickListBoxRow(wxCommandEvent &event); protected: const TilesetCategory* tileset; @@ -149,7 +159,7 @@ class BrushPanel : public wxPanel { class BrushPalettePanel : public PalettePanel { public: - BrushPalettePanel(wxWindow* parent, const TilesetContainer& tilesets, TilesetCategoryType category, wxWindowID id = wxID_ANY); + BrushPalettePanel(wxWindow* parent, const TilesetContainer &tilesets, TilesetCategoryType category, wxWindowID id = wxID_ANY); ~BrushPalettePanel(); // Interface @@ -177,8 +187,9 @@ class BrushPalettePanel : public PalettePanel { void OnSwitchIn(); // Event handler for child window - void OnSwitchingPage(wxChoicebookEvent& event); - void OnPageChanged(wxChoicebookEvent& event); + void OnSwitchingPage(wxChoicebookEvent &event); + void OnPageChanged(wxChoicebookEvent &event); + protected: PaletteType palette_type; wxChoicebook* choicebook; diff --git a/source/palette_common.cpp b/source/palette_common.cpp index ba22a60d..1bba4651 100644 --- a/source/palette_common.cpp +++ b/source/palette_common.cpp @@ -29,151 +29,141 @@ // Palette Panel BEGIN_EVENT_TABLE(PalettePanel, wxPanel) - EVT_TIMER(PALETTE_DELAYED_REFRESH_TIMER, WaypointPalettePanel::OnRefreshTimer) +EVT_TIMER(PALETTE_DELAYED_REFRESH_TIMER, WaypointPalettePanel::OnRefreshTimer) END_EVENT_TABLE() PalettePanel::PalettePanel(wxWindow* parent, wxWindowID id, long style) : wxPanel(parent, id, wxDefaultPosition, wxDefaultSize, style), refresh_timer(this, PALETTE_DELAYED_REFRESH_TIMER), - last_brush_size(0) -{ + last_brush_size(0) { //// } -PalettePanel::~PalettePanel() -{ +PalettePanel::~PalettePanel() { //// } -PaletteWindow* PalettePanel::GetParentPalette() const -{ +PaletteWindow* PalettePanel::GetParentPalette() const { const wxWindow* w = this; - while((w = w->GetParent()) && dynamic_cast(w) == nullptr); + while ((w = w->GetParent()) && dynamic_cast(w) == nullptr) + ; return const_cast(static_cast(w)); } -void PalettePanel::InvalidateContents() -{ - for(ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { +void PalettePanel::InvalidateContents() { + for (ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { (*iter)->InvalidateContents(); } } -void PalettePanel::LoadCurrentContents() -{ - for(ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { +void PalettePanel::LoadCurrentContents() { + for (ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { (*iter)->OnSwitchIn(); } Fit(); } -void PalettePanel::LoadAllContents() -{ - for(ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { +void PalettePanel::LoadAllContents() { + for (ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { (*iter)->LoadAllContents(); } } -void PalettePanel::AddToolPanel(PalettePanel* panel) -{ +void PalettePanel::AddToolPanel(PalettePanel* panel) { wxSizer* sp_sizer = newd wxStaticBoxSizer(wxVERTICAL, this, panel->GetName()); sp_sizer->Add(panel, 0, wxEXPAND); GetSizer()->Add(sp_sizer, 0, wxEXPAND); - //GetSizer()->SetDimension(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxDefaultCoord); - //GetSizer()->Layout(); + // GetSizer()->SetDimension(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxDefaultCoord); + // GetSizer()->Layout(); Fit(); // tool_bars.push_back(panel); } -void PalettePanel::SetToolbarIconSize(bool large_icons) -{ - for(ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { +void PalettePanel::SetToolbarIconSize(bool large_icons) { + for (ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { (*iter)->SetToolbarIconSize(large_icons); } } -wxString PalettePanel::GetName() const -{ - switch(GetType()) { - case TILESET_TERRAIN: return "Terrain Palette"; - case TILESET_DOODAD: return "Doodad Palette"; - case TILESET_ITEM: return "Item Palette"; - case TILESET_MONSTER: return "Monster Palette"; - case TILESET_NPC: return "Npc Palette"; - case TILESET_HOUSE: return "House Palette"; - case TILESET_RAW: return "RAW Palette"; - case TILESET_WAYPOINT: return "Waypoint Palette"; - case TILESET_UNKNOWN: return "Unknown"; +wxString PalettePanel::GetName() const { + switch (GetType()) { + case TILESET_TERRAIN: + return "Terrain Palette"; + case TILESET_DOODAD: + return "Doodad Palette"; + case TILESET_ITEM: + return "Item Palette"; + case TILESET_MONSTER: + return "Monster Palette"; + case TILESET_NPC: + return "Npc Palette"; + case TILESET_HOUSE: + return "House Palette"; + case TILESET_RAW: + return "RAW Palette"; + case TILESET_WAYPOINT: + return "Waypoint Palette"; + case TILESET_UNKNOWN: + return "Unknown"; } return wxEmptyString; } -PaletteType PalettePanel::GetType() const -{ +PaletteType PalettePanel::GetType() const { return TILESET_UNKNOWN; } -Brush* PalettePanel::GetSelectedBrush() const -{ +Brush* PalettePanel::GetSelectedBrush() const { return nullptr; } -int PalettePanel::GetSelectedBrushSize() const -{ +int PalettePanel::GetSelectedBrushSize() const { return 0; } -void PalettePanel::SelectFirstBrush() -{ +void PalettePanel::SelectFirstBrush() { // Do nothing } -bool PalettePanel::SelectBrush(const Brush* whatbrush) -{ +bool PalettePanel::SelectBrush(const Brush* whatbrush) { return false; } -void PalettePanel::OnUpdateBrushSize(BrushShape shape, int size) -{ - for(ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { +void PalettePanel::OnUpdateBrushSize(BrushShape shape, int size) { + for (ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { (*iter)->OnUpdateBrushSize(shape, size); } } -void PalettePanel::OnSwitchIn() -{ - for(ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { +void PalettePanel::OnSwitchIn() { + for (ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { (*iter)->OnSwitchIn(); } g_gui.ActivatePalette(GetParentPalette()); g_gui.SetBrushSize(last_brush_size); } -void PalettePanel::OnSwitchOut() -{ +void PalettePanel::OnSwitchOut() { last_brush_size = g_gui.GetBrushSize(); - for(ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { + for (ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { (*iter)->OnSwitchOut(); } } -void PalettePanel::OnUpdate() -{ - for(ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { +void PalettePanel::OnUpdate() { + for (ToolBarList::iterator iter = tool_bars.begin(); iter != tool_bars.end(); ++iter) { (*iter)->OnUpdate(); } } -void PalettePanel::RefreshOtherPalettes() -{ +void PalettePanel::RefreshOtherPalettes() { refresh_timer.Start(100, true); } -void PalettePanel::OnRefreshTimer(wxTimerEvent&) -{ +void PalettePanel::OnRefreshTimer(wxTimerEvent &) { g_gui.RefreshOtherPalettes(GetParentPalette()); } @@ -181,16 +171,16 @@ void PalettePanel::OnRefreshTimer(wxTimerEvent&) // Size Page BEGIN_EVENT_TABLE(BrushSizePanel, wxPanel) - EVT_TOGGLEBUTTON(PALETTE_BRUSHSHAPE_SQUARE, BrushSizePanel::OnClickSquareBrush) - EVT_TOGGLEBUTTON(PALETTE_BRUSHSHAPE_CIRCLE, BrushSizePanel::OnClickCircleBrush) - - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_BRUSHSIZE_0, BrushSizePanel::OnClickBrushSize0) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_BRUSHSIZE_1, BrushSizePanel::OnClickBrushSize1) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_BRUSHSIZE_2, BrushSizePanel::OnClickBrushSize2) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_BRUSHSIZE_4, BrushSizePanel::OnClickBrushSize4) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_BRUSHSIZE_6, BrushSizePanel::OnClickBrushSize6) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_BRUSHSIZE_8, BrushSizePanel::OnClickBrushSize8) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_BRUSHSIZE_11,BrushSizePanel::OnClickBrushSize11) +EVT_TOGGLEBUTTON(PALETTE_BRUSHSHAPE_SQUARE, BrushSizePanel::OnClickSquareBrush) +EVT_TOGGLEBUTTON(PALETTE_BRUSHSHAPE_CIRCLE, BrushSizePanel::OnClickCircleBrush) + +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_BRUSHSIZE_0, BrushSizePanel::OnClickBrushSize0) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_BRUSHSIZE_1, BrushSizePanel::OnClickBrushSize1) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_BRUSHSIZE_2, BrushSizePanel::OnClickBrushSize2) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_BRUSHSIZE_4, BrushSizePanel::OnClickBrushSize4) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_BRUSHSIZE_6, BrushSizePanel::OnClickBrushSize6) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_BRUSHSIZE_8, BrushSizePanel::OnClickBrushSize8) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_BRUSHSIZE_11, BrushSizePanel::OnClickBrushSize11) END_EVENT_TABLE() BrushSizePanel::BrushSizePanel(wxWindow* parent) : @@ -205,45 +195,36 @@ BrushSizePanel::BrushSizePanel(wxWindow* parent) : brushsize4Button(nullptr), brushsize6Button(nullptr), brushsize8Button(nullptr), - brushsize11Button(nullptr) -{ + brushsize11Button(nullptr) { //// } -void BrushSizePanel::InvalidateContents() -{ - if(loaded) { +void BrushSizePanel::InvalidateContents() { + if (loaded) { DestroyChildren(); SetSizer(nullptr); - brushshapeSquareButton = - brushshapeCircleButton = - brushsize0Button = - brushsize1Button = - brushsize2Button = - brushsize4Button = - brushsize6Button = - brushsize8Button = - brushsize11Button = nullptr; + brushshapeSquareButton = brushshapeCircleButton = brushsize0Button = brushsize1Button = brushsize2Button = brushsize4Button = brushsize6Button = brushsize8Button = brushsize11Button = nullptr; loaded = false; } } -void BrushSizePanel::LoadCurrentContents() -{ +void BrushSizePanel::LoadCurrentContents() { LoadAllContents(); } -void BrushSizePanel::LoadAllContents() -{ - if(loaded) return; +void BrushSizePanel::LoadAllContents() { + if (loaded) { + return; + } - wxSizer* size_sizer = newd wxBoxSizer(wxVERTICAL);; + wxSizer* size_sizer = newd wxBoxSizer(wxVERTICAL); + ; wxSizer* sub_sizer = newd wxBoxSizer(wxHORIZONTAL); RenderSize render_size; - if(large_icons) { + if (large_icons) { // 32x32 render_size = RENDER_SIZE_32x32; } else { @@ -252,44 +233,44 @@ void BrushSizePanel::LoadAllContents() } sub_sizer->Add(brushshapeSquareButton = newd DCButton(this, PALETTE_BRUSHSHAPE_SQUARE, wxDefaultPosition, DC_BTN_TOGGLE, render_size, EDITOR_SPRITE_BRUSH_SD_9x9)); - brushshapeSquareButton->SetToolTip("Square brush"); + brushshapeSquareButton->SetToolTip("Square brush"); sub_sizer->Add(brushshapeCircleButton = newd DCButton(this, PALETTE_BRUSHSHAPE_CIRCLE, wxDefaultPosition, DC_BTN_TOGGLE, render_size, EDITOR_SPRITE_BRUSH_CD_9x9)); - brushshapeCircleButton->SetToolTip("Circle brush"); + brushshapeCircleButton->SetToolTip("Circle brush"); brushshapeSquareButton->SetValue(true); - if(large_icons) { + if (large_icons) { sub_sizer->AddSpacer(36); } else { sub_sizer->AddSpacer(18); } sub_sizer->Add(brushsize0Button = newd DCButton(this, PALETTE_TERRAIN_BRUSHSIZE_0, wxDefaultPosition, DC_BTN_TOGGLE, render_size, EDITOR_SPRITE_BRUSH_CD_1x1)); - brushsize0Button->SetToolTip("Brush size 1"); - brushsize0Button->SetValue(true); + brushsize0Button->SetToolTip("Brush size 1"); + brushsize0Button->SetValue(true); sub_sizer->Add(brushsize1Button = newd DCButton(this, PALETTE_TERRAIN_BRUSHSIZE_1, wxDefaultPosition, DC_BTN_TOGGLE, render_size, EDITOR_SPRITE_BRUSH_SD_3x3)); - brushsize1Button->SetToolTip("Brush size 2"); + brushsize1Button->SetToolTip("Brush size 2"); - if(large_icons) { + if (large_icons) { size_sizer->Add(sub_sizer); sub_sizer = newd wxBoxSizer(wxHORIZONTAL); } sub_sizer->Add(brushsize2Button = newd DCButton(this, PALETTE_TERRAIN_BRUSHSIZE_2, wxDefaultPosition, DC_BTN_TOGGLE, render_size, EDITOR_SPRITE_BRUSH_SD_5x5)); - brushsize2Button->SetToolTip("Brush size 3"); + brushsize2Button->SetToolTip("Brush size 3"); sub_sizer->Add(brushsize4Button = newd DCButton(this, PALETTE_TERRAIN_BRUSHSIZE_4, wxDefaultPosition, DC_BTN_TOGGLE, render_size, EDITOR_SPRITE_BRUSH_SD_7x7)); - brushsize4Button->SetToolTip("Brush size 5"); + brushsize4Button->SetToolTip("Brush size 5"); sub_sizer->Add(brushsize6Button = newd DCButton(this, PALETTE_TERRAIN_BRUSHSIZE_6, wxDefaultPosition, DC_BTN_TOGGLE, render_size, EDITOR_SPRITE_BRUSH_SD_9x9)); - brushsize6Button->SetToolTip("Brush size 7"); + brushsize6Button->SetToolTip("Brush size 7"); sub_sizer->Add(brushsize8Button = newd DCButton(this, PALETTE_TERRAIN_BRUSHSIZE_8, wxDefaultPosition, DC_BTN_TOGGLE, render_size, EDITOR_SPRITE_BRUSH_SD_15x15)); brushsize8Button->SetToolTip("Brush size 9"); sub_sizer->Add(brushsize11Button = newd DCButton(this, PALETTE_TERRAIN_BRUSHSIZE_11, wxDefaultPosition, DC_BTN_TOGGLE, render_size, EDITOR_SPRITE_BRUSH_SD_19x19)); - brushsize11Button->SetToolTip("Brush size 12"); + brushsize11Button->SetToolTip("Brush size 12"); size_sizer->Add(sub_sizer); SetSizerAndFit(size_sizer); @@ -297,13 +278,11 @@ void BrushSizePanel::LoadAllContents() loaded = true; } -wxString BrushSizePanel::GetName() const -{ +wxString BrushSizePanel::GetName() const { return "Brush Size"; } -void BrushSizePanel::SetToolbarIconSize(bool d) -{ +void BrushSizePanel::SetToolbarIconSize(bool d) { InvalidateContents(); large_icons = d; } @@ -312,9 +291,8 @@ void BrushSizePanel::OnSwitchIn() { LoadCurrentContents(); } -void BrushSizePanel::OnUpdateBrushSize(BrushShape shape, int size) -{ - if(shape == BRUSHSHAPE_SQUARE) { +void BrushSizePanel::OnUpdateBrushSize(BrushShape shape, int size) { + if (shape == BRUSHSHAPE_SQUARE) { brushshapeCircleButton->SetValue(false); brushshapeSquareButton->SetValue(true); @@ -338,40 +316,67 @@ void BrushSizePanel::OnUpdateBrushSize(BrushShape shape, int size) brushsize11Button->SetSprite(EDITOR_SPRITE_BRUSH_CD_19x19); } - if(brushsize0Button) brushsize0Button->SetValue(false); - if(brushsize1Button) brushsize1Button->SetValue(false); - if(brushsize2Button) brushsize2Button->SetValue(false); - if(brushsize4Button) brushsize4Button->SetValue(false); - if(brushsize6Button) brushsize6Button->SetValue(false); - if(brushsize8Button) brushsize8Button->SetValue(false); - if(brushsize11Button) brushsize11Button->SetValue(false); + if (brushsize0Button) { + brushsize0Button->SetValue(false); + } + if (brushsize1Button) { + brushsize1Button->SetValue(false); + } + if (brushsize2Button) { + brushsize2Button->SetValue(false); + } + if (brushsize4Button) { + brushsize4Button->SetValue(false); + } + if (brushsize6Button) { + brushsize6Button->SetValue(false); + } + if (brushsize8Button) { + brushsize8Button->SetValue(false); + } + if (brushsize11Button) { + brushsize11Button->SetValue(false); + } - switch(size) { - case 0: brushsize0Button->SetValue(true); break; - case 1: brushsize1Button->SetValue(true); break; - case 2: brushsize2Button->SetValue(true); break; - case 4: brushsize4Button->SetValue(true); break; - case 6: brushsize6Button->SetValue(true); break; - case 8: brushsize8Button->SetValue(true); break; - case 11: brushsize11Button->SetValue(true); break; - default: brushsize0Button->SetValue(true); break; + switch (size) { + case 0: + brushsize0Button->SetValue(true); + break; + case 1: + brushsize1Button->SetValue(true); + break; + case 2: + brushsize2Button->SetValue(true); + break; + case 4: + brushsize4Button->SetValue(true); + break; + case 6: + brushsize6Button->SetValue(true); + break; + case 8: + brushsize8Button->SetValue(true); + break; + case 11: + brushsize11Button->SetValue(true); + break; + default: + brushsize0Button->SetValue(true); + break; } } -void BrushSizePanel::OnClickCircleBrush(wxCommandEvent &event) -{ +void BrushSizePanel::OnClickCircleBrush(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SetBrushShape(BRUSHSHAPE_CIRCLE); } -void BrushSizePanel::OnClickSquareBrush(wxCommandEvent &event) -{ +void BrushSizePanel::OnClickSquareBrush(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SetBrushShape(BRUSHSHAPE_SQUARE); } -void BrushSizePanel::OnClickBrushSize(int which) -{ +void BrushSizePanel::OnClickBrushSize(int which) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SetBrushSize(which); } @@ -380,20 +385,20 @@ void BrushSizePanel::OnClickBrushSize(int which) // Tool Brush Panel BEGIN_EVENT_TABLE(BrushToolPanel, PalettePanel) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_OPTIONAL_BORDER_TOOL, BrushToolPanel::OnClickGravelButton) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_ERASER, BrushToolPanel::OnClickEraserButton) - - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_NORMAL_DOOR,BrushToolPanel::OnClickNormalDoorButton) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_LOCKED_DOOR,BrushToolPanel::OnClickLockedDoorButton) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_MAGIC_DOOR, BrushToolPanel::OnClickMagicDoorButton) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_QUEST_DOOR, BrushToolPanel::OnClickQuestDoorButton) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_HATCH_DOOR, BrushToolPanel::OnClickHatchDoorButton) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_WINDOW_DOOR,BrushToolPanel::OnClickWindowDoorButton) - - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_PZ_TOOL,BrushToolPanel::OnClickPZBrushButton) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_NOPVP_TOOL,BrushToolPanel::OnClickNOPVPBrushButton) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_NOLOGOUT_TOOL,BrushToolPanel::OnClickNoLogoutBrushButton) - EVT_TOGGLEBUTTON(PALETTE_TERRAIN_PVPZONE_TOOL,BrushToolPanel::OnClickPVPZoneBrushButton) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_OPTIONAL_BORDER_TOOL, BrushToolPanel::OnClickGravelButton) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_ERASER, BrushToolPanel::OnClickEraserButton) + +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_NORMAL_DOOR, BrushToolPanel::OnClickNormalDoorButton) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_LOCKED_DOOR, BrushToolPanel::OnClickLockedDoorButton) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_MAGIC_DOOR, BrushToolPanel::OnClickMagicDoorButton) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_QUEST_DOOR, BrushToolPanel::OnClickQuestDoorButton) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_HATCH_DOOR, BrushToolPanel::OnClickHatchDoorButton) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_WINDOW_DOOR, BrushToolPanel::OnClickWindowDoorButton) + +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_PZ_TOOL, BrushToolPanel::OnClickPZBrushButton) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_NOPVP_TOOL, BrushToolPanel::OnClickNOPVPBrushButton) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_NOLOGOUT_TOOL, BrushToolPanel::OnClickNoLogoutBrushButton) +EVT_TOGGLEBUTTON(PALETTE_TERRAIN_PVPZONE_TOOL, BrushToolPanel::OnClickPVPZoneBrushButton) END_EVENT_TABLE() BrushToolPanel::BrushToolPanel(wxWindow* parent) : @@ -411,49 +416,36 @@ BrushToolPanel::BrushToolPanel(wxWindow* parent) : pzBrushButton(nullptr), nopvpBrushButton(nullptr), nologBrushButton(nullptr), - pvpzoneBrushButton(nullptr) -{ + pvpzoneBrushButton(nullptr) { //// } -BrushToolPanel::~BrushToolPanel() -{ +BrushToolPanel::~BrushToolPanel() { //// } -void BrushToolPanel::InvalidateContents() -{ - if(loaded) { +void BrushToolPanel::InvalidateContents() { + if (loaded) { DestroyChildren(); SetSizer(nullptr); - optionalBorderButton = - eraserButton = - normalDoorButton = - lockedDoorButton = - magicDoorButton = - questDoorButton = - hatchDoorButton = - windowDoorButton = - pzBrushButton = - nopvpBrushButton = - nologBrushButton = - pvpzoneBrushButton = nullptr; + optionalBorderButton = eraserButton = normalDoorButton = lockedDoorButton = magicDoorButton = questDoorButton = hatchDoorButton = windowDoorButton = pzBrushButton = nopvpBrushButton = nologBrushButton = pvpzoneBrushButton = nullptr; loaded = false; } } -void BrushToolPanel::LoadCurrentContents() -{ +void BrushToolPanel::LoadCurrentContents() { LoadAllContents(); } -void BrushToolPanel::LoadAllContents() -{ - if(loaded) return; +void BrushToolPanel::LoadAllContents() { + if (loaded) { + return; + } - wxSizer* size_sizer = newd wxBoxSizer(wxVERTICAL);; + wxSizer* size_sizer = newd wxBoxSizer(wxVERTICAL); + ; wxSizer* sub_sizer = newd wxBoxSizer(wxHORIZONTAL); /*RenderSize render_size; @@ -465,32 +457,32 @@ void BrushToolPanel::LoadAllContents() render_size = RENDER_SIZE_16x16; }*/ - if(large_icons) { + if (large_icons) { // Create the tool page with 32x32 icons ASSERT(g_gui.optional_brush); sub_sizer->Add(optionalBorderButton = newd BrushButton(this, g_gui.optional_brush, RENDER_SIZE_32x32, PALETTE_TERRAIN_OPTIONAL_BORDER_TOOL)); - optionalBorderButton->SetToolTip("Optional Border Tool"); + optionalBorderButton->SetToolTip("Optional Border Tool"); ASSERT(g_gui.eraser); sub_sizer->Add(eraserButton = newd BrushButton(this, g_gui.eraser, RENDER_SIZE_32x32, PALETTE_TERRAIN_ERASER)); - eraserButton->SetToolTip("Eraser"); + eraserButton->SetToolTip("Eraser"); ASSERT(g_gui.pz_brush); sub_sizer->Add(pzBrushButton = newd BrushButton(this, g_gui.pz_brush, RENDER_SIZE_32x32, PALETTE_TERRAIN_PZ_TOOL)); - pzBrushButton->SetToolTip("PZ Tool"); + pzBrushButton->SetToolTip("PZ Tool"); ASSERT(g_gui.rook_brush); sub_sizer->Add(nopvpBrushButton = newd BrushButton(this, g_gui.rook_brush, RENDER_SIZE_32x32, PALETTE_TERRAIN_NOPVP_TOOL)); - nopvpBrushButton->SetToolTip("NO PVP Tool"); + nopvpBrushButton->SetToolTip("NO PVP Tool"); ASSERT(g_gui.nolog_brush); sub_sizer->Add(nologBrushButton = newd BrushButton(this, g_gui.nolog_brush, RENDER_SIZE_32x32, PALETTE_TERRAIN_NOLOGOUT_TOOL)); - nologBrushButton->SetToolTip("No Logout Tool"); + nologBrushButton->SetToolTip("No Logout Tool"); ASSERT(g_gui.pvp_brush); sub_sizer->Add(pvpzoneBrushButton = newd BrushButton(this, g_gui.pvp_brush, RENDER_SIZE_32x32, PALETTE_TERRAIN_PVPZONE_TOOL)); - pvpzoneBrushButton->SetToolTip("PVP Zone Tool"); + pvpzoneBrushButton->SetToolTip("PVP Zone Tool"); // New row size_sizer->Add(sub_sizer); @@ -498,85 +490,84 @@ void BrushToolPanel::LoadAllContents() ASSERT(g_gui.normal_door_brush); sub_sizer->Add(normalDoorButton = newd BrushButton(this, g_gui.normal_door_brush, RENDER_SIZE_32x32, PALETTE_TERRAIN_NORMAL_DOOR)); - normalDoorButton->SetToolTip("Normal Door Tool"); + normalDoorButton->SetToolTip("Normal Door Tool"); ASSERT(g_gui.locked_door_brush); sub_sizer->Add(lockedDoorButton = newd BrushButton(this, g_gui.locked_door_brush, RENDER_SIZE_32x32, PALETTE_TERRAIN_LOCKED_DOOR)); - lockedDoorButton->SetToolTip("Locked Door Tool"); + lockedDoorButton->SetToolTip("Locked Door Tool"); ASSERT(g_gui.magic_door_brush); sub_sizer->Add(magicDoorButton = newd BrushButton(this, g_gui.magic_door_brush, RENDER_SIZE_32x32, PALETTE_TERRAIN_MAGIC_DOOR)); - magicDoorButton->SetToolTip("Magic Door Tool"); + magicDoorButton->SetToolTip("Magic Door Tool"); ASSERT(g_gui.quest_door_brush); sub_sizer->Add(questDoorButton = newd BrushButton(this, g_gui.quest_door_brush, RENDER_SIZE_32x32, PALETTE_TERRAIN_QUEST_DOOR)); - questDoorButton->SetToolTip("Quest Door Tool"); + questDoorButton->SetToolTip("Quest Door Tool"); ASSERT(g_gui.hatch_door_brush); sub_sizer->Add(hatchDoorButton = newd BrushButton(this, g_gui.hatch_door_brush, RENDER_SIZE_32x32, PALETTE_TERRAIN_HATCH_DOOR)); - hatchDoorButton->SetToolTip("Hatch Window Tool"); + hatchDoorButton->SetToolTip("Hatch Window Tool"); ASSERT(g_gui.window_door_brush); sub_sizer->Add(windowDoorButton = newd BrushButton(this, g_gui.window_door_brush, RENDER_SIZE_32x32, PALETTE_TERRAIN_WINDOW_DOOR)); - windowDoorButton->SetToolTip("Window Tool"); + windowDoorButton->SetToolTip("Window Tool"); } else { // Create the tool page with 16x16 icons // Create tool window #1 ASSERT(g_gui.optional_brush); sub_sizer->Add(optionalBorderButton = newd BrushButton(this, g_gui.optional_brush, RENDER_SIZE_16x16, PALETTE_TERRAIN_OPTIONAL_BORDER_TOOL)); - optionalBorderButton->SetToolTip("Optional Border Tool"); + optionalBorderButton->SetToolTip("Optional Border Tool"); ASSERT(g_gui.eraser); sub_sizer->Add(eraserButton = newd BrushButton(this, g_gui.eraser, RENDER_SIZE_16x16, PALETTE_TERRAIN_ERASER)); - eraserButton->SetToolTip("Eraser"); + eraserButton->SetToolTip("Eraser"); sub_sizer->AddSpacer(20); ASSERT(g_gui.normal_door_brush); sub_sizer->Add(normalDoorButton = newd BrushButton(this, g_gui.normal_door_brush, RENDER_SIZE_16x16, PALETTE_TERRAIN_NORMAL_DOOR)); - normalDoorButton->SetToolTip("Normal Door Tool"); + normalDoorButton->SetToolTip("Normal Door Tool"); ASSERT(g_gui.locked_door_brush); sub_sizer->Add(lockedDoorButton = newd BrushButton(this, g_gui.locked_door_brush, RENDER_SIZE_16x16, PALETTE_TERRAIN_LOCKED_DOOR)); - lockedDoorButton->SetToolTip("Locked Door Tool"); + lockedDoorButton->SetToolTip("Locked Door Tool"); ASSERT(g_gui.magic_door_brush); sub_sizer->Add(magicDoorButton = newd BrushButton(this, g_gui.magic_door_brush, RENDER_SIZE_16x16, PALETTE_TERRAIN_MAGIC_DOOR)); - magicDoorButton->SetToolTip("Magic Door Tool"); + magicDoorButton->SetToolTip("Magic Door Tool"); ASSERT(g_gui.quest_door_brush); sub_sizer->Add(questDoorButton = newd BrushButton(this, g_gui.quest_door_brush, RENDER_SIZE_16x16, PALETTE_TERRAIN_QUEST_DOOR)); - questDoorButton->SetToolTip("Quest Door Tool"); + questDoorButton->SetToolTip("Quest Door Tool"); ASSERT(g_gui.hatch_door_brush); sub_sizer->Add(hatchDoorButton = newd BrushButton(this, g_gui.hatch_door_brush, RENDER_SIZE_16x16, PALETTE_TERRAIN_HATCH_DOOR)); - hatchDoorButton->SetToolTip("Hatch Window Tool"); + hatchDoorButton->SetToolTip("Hatch Window Tool"); ASSERT(g_gui.window_door_brush); sub_sizer->Add(windowDoorButton = newd BrushButton(this, g_gui.window_door_brush, RENDER_SIZE_16x16, PALETTE_TERRAIN_WINDOW_DOOR)); - windowDoorButton->SetToolTip("Window Tool"); + windowDoorButton->SetToolTip("Window Tool"); // Next row size_sizer->Add(sub_sizer); sub_sizer = newd wxBoxSizer(wxHORIZONTAL); - ASSERT(g_gui.pz_brush); sub_sizer->Add(pzBrushButton = newd BrushButton(this, g_gui.pz_brush, RENDER_SIZE_16x16, PALETTE_TERRAIN_PZ_TOOL)); - pzBrushButton->SetToolTip("PZ Tool"); + pzBrushButton->SetToolTip("PZ Tool"); ASSERT(g_gui.rook_brush); sub_sizer->Add(nopvpBrushButton = newd BrushButton(this, g_gui.rook_brush, RENDER_SIZE_16x16, PALETTE_TERRAIN_NOPVP_TOOL)); - nopvpBrushButton->SetToolTip("NO PVP Tool"); + nopvpBrushButton->SetToolTip("NO PVP Tool"); ASSERT(g_gui.nolog_brush); sub_sizer->Add(nologBrushButton = newd BrushButton(this, g_gui.nolog_brush, RENDER_SIZE_16x16, PALETTE_TERRAIN_NOLOGOUT_TOOL)); - nologBrushButton->SetToolTip("No Logout Tool"); + nologBrushButton->SetToolTip("No Logout Tool"); ASSERT(g_gui.pvp_brush); sub_sizer->Add(pvpzoneBrushButton = newd BrushButton(this, g_gui.pvp_brush, RENDER_SIZE_16x16, PALETTE_TERRAIN_PVPZONE_TOOL)); - pvpzoneBrushButton->SetToolTip("PVP Zone Tool"); + pvpzoneBrushButton->SetToolTip("PVP Zone Tool"); } size_sizer->Add(sub_sizer); @@ -585,20 +576,17 @@ void BrushToolPanel::LoadAllContents() loaded = true; } -wxString BrushToolPanel::GetName() const -{ +wxString BrushToolPanel::GetName() const { return "Tools"; } -void BrushToolPanel::SetToolbarIconSize(bool d) -{ +void BrushToolPanel::SetToolbarIconSize(bool d) { InvalidateContents(); large_icons = d; } -void BrushToolPanel::DeselectAll() -{ - if(loaded) { +void BrushToolPanel::DeselectAll() { + if (loaded) { optionalBorderButton->SetValue(false); eraserButton->SetValue(false); normalDoorButton->SetValue(false); @@ -614,66 +602,76 @@ void BrushToolPanel::DeselectAll() } } -Brush* BrushToolPanel::GetSelectedBrush() const -{ - if(optionalBorderButton->GetValue()) +Brush* BrushToolPanel::GetSelectedBrush() const { + if (optionalBorderButton->GetValue()) { return g_gui.optional_brush; - if(eraserButton->GetValue()) + } + if (eraserButton->GetValue()) { return g_gui.eraser; - if(normalDoorButton->GetValue()) + } + if (normalDoorButton->GetValue()) { return g_gui.normal_door_brush; - if(lockedDoorButton->GetValue()) + } + if (lockedDoorButton->GetValue()) { return g_gui.locked_door_brush; - if(magicDoorButton->GetValue()) + } + if (magicDoorButton->GetValue()) { return g_gui.magic_door_brush; - if(questDoorButton->GetValue()) + } + if (questDoorButton->GetValue()) { return g_gui.quest_door_brush; - if(hatchDoorButton->GetValue()) + } + if (hatchDoorButton->GetValue()) { return g_gui.hatch_door_brush; - if(windowDoorButton->GetValue()) + } + if (windowDoorButton->GetValue()) { return g_gui.window_door_brush; - if(pzBrushButton->GetValue()) + } + if (pzBrushButton->GetValue()) { return g_gui.pz_brush; - if(nopvpBrushButton->GetValue()) + } + if (nopvpBrushButton->GetValue()) { return g_gui.rook_brush; - if(nologBrushButton->GetValue()) + } + if (nologBrushButton->GetValue()) { return g_gui.nolog_brush; - if(pvpzoneBrushButton->GetValue()) + } + if (pvpzoneBrushButton->GetValue()) { return g_gui.pvp_brush; + } return nullptr; } -bool BrushToolPanel::SelectBrush(const Brush* whatbrush) -{ +bool BrushToolPanel::SelectBrush(const Brush* whatbrush) { BrushButton* button = nullptr; - if(whatbrush == g_gui.optional_brush) { + if (whatbrush == g_gui.optional_brush) { button = optionalBorderButton; - } else if(whatbrush == g_gui.eraser) { + } else if (whatbrush == g_gui.eraser) { button = eraserButton; - } else if(whatbrush == g_gui.normal_door_brush) { + } else if (whatbrush == g_gui.normal_door_brush) { button = normalDoorButton; - } else if(whatbrush == g_gui.locked_door_brush) { + } else if (whatbrush == g_gui.locked_door_brush) { button = lockedDoorButton; - } else if(whatbrush == g_gui.magic_door_brush) { + } else if (whatbrush == g_gui.magic_door_brush) { button = magicDoorButton; - } else if(whatbrush == g_gui.quest_door_brush) { + } else if (whatbrush == g_gui.quest_door_brush) { button = questDoorButton; - } else if(whatbrush == g_gui.hatch_door_brush) { + } else if (whatbrush == g_gui.hatch_door_brush) { button = hatchDoorButton; - } else if(whatbrush == g_gui.window_door_brush) { + } else if (whatbrush == g_gui.window_door_brush) { button = windowDoorButton; - } else if(whatbrush == g_gui.pz_brush) { + } else if (whatbrush == g_gui.pz_brush) { button = pzBrushButton; - } else if(whatbrush == g_gui.rook_brush) { + } else if (whatbrush == g_gui.rook_brush) { button = nopvpBrushButton; - } else if(whatbrush == g_gui.nolog_brush) { + } else if (whatbrush == g_gui.nolog_brush) { button = nologBrushButton; - } else if(whatbrush == g_gui.pvp_brush) { + } else if (whatbrush == g_gui.pvp_brush) { button = pvpzoneBrushButton; } DeselectAll(); - if(button) { + if (button) { button->SetValue(true); return true; } @@ -681,79 +679,66 @@ bool BrushToolPanel::SelectBrush(const Brush* whatbrush) return false; } -void BrushToolPanel::OnSwitchIn() -{ +void BrushToolPanel::OnSwitchIn() { LoadCurrentContents(); } -void BrushToolPanel::OnClickGravelButton(wxCommandEvent& event) -{ +void BrushToolPanel::OnClickGravelButton(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(g_gui.optional_brush); } -void BrushToolPanel::OnClickEraserButton(wxCommandEvent& event) -{ +void BrushToolPanel::OnClickEraserButton(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(g_gui.eraser); } -void BrushToolPanel::OnClickNormalDoorButton(wxCommandEvent& event) -{ +void BrushToolPanel::OnClickNormalDoorButton(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(g_gui.normal_door_brush); } -void BrushToolPanel::OnClickLockedDoorButton(wxCommandEvent& event) -{ +void BrushToolPanel::OnClickLockedDoorButton(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(g_gui.locked_door_brush); } -void BrushToolPanel::OnClickMagicDoorButton(wxCommandEvent& event) -{ +void BrushToolPanel::OnClickMagicDoorButton(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(g_gui.magic_door_brush); } -void BrushToolPanel::OnClickQuestDoorButton(wxCommandEvent& event) -{ +void BrushToolPanel::OnClickQuestDoorButton(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(g_gui.quest_door_brush); } -void BrushToolPanel::OnClickHatchDoorButton(wxCommandEvent& event) -{ +void BrushToolPanel::OnClickHatchDoorButton(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(g_gui.hatch_door_brush); } -void BrushToolPanel::OnClickWindowDoorButton(wxCommandEvent& event) -{ +void BrushToolPanel::OnClickWindowDoorButton(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(g_gui.window_door_brush); } -void BrushToolPanel::OnClickPZBrushButton(wxCommandEvent& event) -{ +void BrushToolPanel::OnClickPZBrushButton(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(g_gui.pz_brush); } -void BrushToolPanel::OnClickNOPVPBrushButton(wxCommandEvent& event) -{ +void BrushToolPanel::OnClickNOPVPBrushButton(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(g_gui.rook_brush); } -void BrushToolPanel::OnClickNoLogoutBrushButton(wxCommandEvent& event) -{ +void BrushToolPanel::OnClickNoLogoutBrushButton(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(g_gui.nolog_brush); } -void BrushToolPanel::OnClickPVPZoneBrushButton(wxCommandEvent& event) -{ +void BrushToolPanel::OnClickPVPZoneBrushButton(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(g_gui.pvp_brush); } @@ -762,26 +747,23 @@ void BrushToolPanel::OnClickPVPZoneBrushButton(wxCommandEvent& event) // Brush Button BEGIN_EVENT_TABLE(BrushButton, ItemToggleButton) - EVT_KEY_DOWN(BrushButton::OnKey) +EVT_KEY_DOWN(BrushButton::OnKey) END_EVENT_TABLE() BrushButton::BrushButton(wxWindow* parent, Brush* _brush, RenderSize sz, uint32_t id) : ItemToggleButton(parent, sz, uint16_t(0), id), - brush(_brush) -{ + brush(_brush) { ASSERT(sz != RENDER_SIZE_64x64); ASSERT(brush); SetSprite(brush->getLookID()); SetToolTip(wxstr(brush->getName())); } -BrushButton::~BrushButton() -{ +BrushButton::~BrushButton() { //// } -void BrushButton::OnKey(wxKeyEvent& event) -{ +void BrushButton::OnKey(wxKeyEvent &event) { g_gui.AddPendingCanvasEvent(event); } @@ -790,28 +772,27 @@ void BrushButton::OnKey(wxKeyEvent& event) BEGIN_EVENT_TABLE(BrushThicknessPanel, PalettePanel) #ifdef __WINDOWS__ - // This only works in wxmsw - EVT_COMMAND_SCROLL_CHANGED(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) +// This only works in wxmsw +EVT_COMMAND_SCROLL_CHANGED(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) #else - EVT_COMMAND_SCROLL_TOP(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) - EVT_COMMAND_SCROLL_BOTTOM(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) - EVT_COMMAND_SCROLL_LINEUP(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) - EVT_COMMAND_SCROLL_LINEDOWN(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) - EVT_COMMAND_SCROLL_PAGEUP(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) - EVT_COMMAND_SCROLL_PAGEDOWN(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) - EVT_COMMAND_SCROLL_THUMBRELEASE(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) +EVT_COMMAND_SCROLL_TOP(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) +EVT_COMMAND_SCROLL_BOTTOM(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) +EVT_COMMAND_SCROLL_LINEUP(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) +EVT_COMMAND_SCROLL_LINEDOWN(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) +EVT_COMMAND_SCROLL_PAGEUP(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) +EVT_COMMAND_SCROLL_PAGEDOWN(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) +EVT_COMMAND_SCROLL_THUMBRELEASE(PALETTE_DOODAD_SLIDER, BrushThicknessPanel::OnScroll) #endif - EVT_CHECKBOX(PALETTE_DOODAD_USE_THICKNESS, BrushThicknessPanel::OnClickCustomThickness) +EVT_CHECKBOX(PALETTE_DOODAD_USE_THICKNESS, BrushThicknessPanel::OnClickCustomThickness) END_EVENT_TABLE() BrushThicknessPanel::BrushThicknessPanel(wxWindow* parent) : - PalettePanel(parent, wxID_ANY) -{ + PalettePanel(parent, wxID_ANY) { wxSizer* thickness_sizer = newd wxBoxSizer(wxVERTICAL); wxSizer* thickness_sub_sizer = newd wxBoxSizer(wxHORIZONTAL); - thickness_sub_sizer->Add(20,10); + thickness_sub_sizer->Add(20, 10); use_button = newd wxCheckBox(this, PALETTE_DOODAD_USE_THICKNESS, "Use custom thickness"); thickness_sub_sizer->Add(use_button); thickness_sizer->Add(thickness_sub_sizer, 1, wxEXPAND); @@ -822,39 +803,33 @@ BrushThicknessPanel::BrushThicknessPanel(wxWindow* parent) : SetSizerAndFit(thickness_sizer); } -BrushThicknessPanel::~BrushThicknessPanel() -{ +BrushThicknessPanel::~BrushThicknessPanel() { //// } -wxString BrushThicknessPanel::GetName() const -{ +wxString BrushThicknessPanel::GetName() const { return "Brush Thickness"; } -void BrushThicknessPanel::OnScroll(wxScrollEvent& event) -{ - static const int lookup_table[10] = {1,2,3,5,8,13,23,35,50,80}; +void BrushThicknessPanel::OnScroll(wxScrollEvent &event) { + static const int lookup_table[10] = { 1, 2, 3, 5, 8, 13, 23, 35, 50, 80 }; use_button->SetValue(true); ASSERT(event.GetPosition() >= 1); ASSERT(event.GetPosition() <= 10); - //printf("SELECT[%d] = %d\n", event.GetPosition()-1, lookup_table[event.GetPosition()-1]); + // printf("SELECT[%d] = %d\n", event.GetPosition()-1, lookup_table[event.GetPosition()-1]); g_gui.ActivatePalette(GetParentPalette()); - g_gui.SetBrushThickness(true, lookup_table[event.GetPosition()-1], 100); + g_gui.SetBrushThickness(true, lookup_table[event.GetPosition() - 1], 100); } -void BrushThicknessPanel::OnClickCustomThickness(wxCommandEvent& event) -{ +void BrushThicknessPanel::OnClickCustomThickness(wxCommandEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SetBrushThickness(event.IsChecked()); } -void BrushThicknessPanel::OnSwitchIn() -{ - static const int lookup_table[10] = {1,2,3,5,8,13,23,35,50,80}; +void BrushThicknessPanel::OnSwitchIn() { + static const int lookup_table[10] = { 1, 2, 3, 5, 8, 13, 23, 35, 50, 80 }; g_gui.ActivatePalette(GetParentPalette()); - g_gui.SetBrushThickness(lookup_table[slider->GetValue()-1], 100); + g_gui.SetBrushThickness(lookup_table[slider->GetValue() - 1], 100); } - diff --git a/source/palette_common.h b/source/palette_common.h index 914d5e3d..a0427300 100644 --- a/source/palette_common.h +++ b/source/palette_common.h @@ -42,7 +42,7 @@ class BrushButton : public ItemToggleButton { Brush* brush; - void OnKey(wxKeyEvent& event); + void OnKey(wxKeyEvent &event); DECLARE_EVENT_TABLE() }; @@ -87,9 +87,10 @@ class PalettePanel : public wxPanel { // Called sometimes virtual void OnUpdate(); // When the palette should do a delayed refresh (necessary for multiple palettes) - void OnRefreshTimer(wxTimerEvent&); + void OnRefreshTimer(wxTimerEvent &); void RefreshOtherPalettes(); + protected: typedef std::vector ToolBarList; ToolBarList tool_bars; @@ -102,8 +103,7 @@ class PalettePanel : public wxPanel { class BrushSizePanel : public PalettePanel { public: BrushSizePanel(wxWindow* parent); - ~BrushSizePanel() {} - + ~BrushSizePanel() { } // Interface // Flushes this panel and consequent views will feature reloaded data @@ -122,17 +122,31 @@ class BrushSizePanel : public PalettePanel { void OnSwitchIn(); // wxWidgets event handling - void OnClickSquareBrush(wxCommandEvent& event); - void OnClickCircleBrush(wxCommandEvent& event); + void OnClickSquareBrush(wxCommandEvent &event); + void OnClickCircleBrush(wxCommandEvent &event); void OnClickBrushSize(int which); - void OnClickBrushSize0(wxCommandEvent& event) {OnClickBrushSize(0);} - void OnClickBrushSize1(wxCommandEvent& event) {OnClickBrushSize(1);} - void OnClickBrushSize2(wxCommandEvent& event) {OnClickBrushSize(2);} - void OnClickBrushSize4(wxCommandEvent& event) {OnClickBrushSize(4);} - void OnClickBrushSize6(wxCommandEvent& event) {OnClickBrushSize(6);} - void OnClickBrushSize8(wxCommandEvent& event) {OnClickBrushSize(8);} - void OnClickBrushSize11(wxCommandEvent& event){OnClickBrushSize(11);} + void OnClickBrushSize0(wxCommandEvent &event) { + OnClickBrushSize(0); + } + void OnClickBrushSize1(wxCommandEvent &event) { + OnClickBrushSize(1); + } + void OnClickBrushSize2(wxCommandEvent &event) { + OnClickBrushSize(2); + } + void OnClickBrushSize4(wxCommandEvent &event) { + OnClickBrushSize(4); + } + void OnClickBrushSize6(wxCommandEvent &event) { + OnClickBrushSize(6); + } + void OnClickBrushSize8(wxCommandEvent &event) { + OnClickBrushSize(8); + } + void OnClickBrushSize11(wxCommandEvent &event) { + OnClickBrushSize(11); + } protected: bool loaded; @@ -177,20 +191,21 @@ class BrushToolPanel : public PalettePanel { void OnSwitchIn(); // wxWidgets event handling - void OnClickGravelButton(wxCommandEvent& event); - void OnClickEraserButton(wxCommandEvent& event); + void OnClickGravelButton(wxCommandEvent &event); + void OnClickEraserButton(wxCommandEvent &event); // ---- - void OnClickNormalDoorButton(wxCommandEvent& event); - void OnClickLockedDoorButton(wxCommandEvent& event); - void OnClickMagicDoorButton(wxCommandEvent& event); - void OnClickQuestDoorButton(wxCommandEvent& event); - void OnClickHatchDoorButton(wxCommandEvent& event); - void OnClickWindowDoorButton(wxCommandEvent& event); + void OnClickNormalDoorButton(wxCommandEvent &event); + void OnClickLockedDoorButton(wxCommandEvent &event); + void OnClickMagicDoorButton(wxCommandEvent &event); + void OnClickQuestDoorButton(wxCommandEvent &event); + void OnClickHatchDoorButton(wxCommandEvent &event); + void OnClickWindowDoorButton(wxCommandEvent &event); // ---- - void OnClickPZBrushButton(wxCommandEvent& event); - void OnClickNOPVPBrushButton(wxCommandEvent& event); - void OnClickNoLogoutBrushButton(wxCommandEvent& event); - void OnClickPVPZoneBrushButton(wxCommandEvent& event); + void OnClickPZBrushButton(wxCommandEvent &event); + void OnClickNOPVPBrushButton(wxCommandEvent &event); + void OnClickNoLogoutBrushButton(wxCommandEvent &event); + void OnClickPVPZoneBrushButton(wxCommandEvent &event); + public: void DeselectAll(); @@ -227,8 +242,9 @@ class BrushThicknessPanel : public PalettePanel { void OnSwitchIn(); // wxWidgets event handling - void OnScroll(wxScrollEvent& event); - void OnClickCustomThickness(wxCommandEvent& event); + void OnScroll(wxScrollEvent &event); + void OnClickCustomThickness(wxCommandEvent &event); + public: wxSlider* slider; wxCheckBox* use_button; diff --git a/source/palette_house.cpp b/source/palette_house.cpp index d3c6f20e..7eb5df85 100644 --- a/source/palette_house.cpp +++ b/source/palette_house.cpp @@ -37,27 +37,26 @@ // House palette BEGIN_EVENT_TABLE(HousePalettePanel, PalettePanel) - EVT_TIMER(PALETTE_LAYOUT_FIX_TIMER, HousePalettePanel::OnLayoutFixTimer) +EVT_TIMER(PALETTE_LAYOUT_FIX_TIMER, HousePalettePanel::OnLayoutFixTimer) - EVT_CHOICE(PALETTE_HOUSE_TOWN_CHOICE, HousePalettePanel::OnTownChange) +EVT_CHOICE(PALETTE_HOUSE_TOWN_CHOICE, HousePalettePanel::OnTownChange) - EVT_LISTBOX(PALETTE_HOUSE_LISTBOX, HousePalettePanel::OnListBoxChange) - EVT_LISTBOX_DCLICK(PALETTE_HOUSE_LISTBOX, HousePalettePanel::OnListBoxDoubleClick) +EVT_LISTBOX(PALETTE_HOUSE_LISTBOX, HousePalettePanel::OnListBoxChange) +EVT_LISTBOX_DCLICK(PALETTE_HOUSE_LISTBOX, HousePalettePanel::OnListBoxDoubleClick) - EVT_BUTTON(PALETTE_HOUSE_ADD_HOUSE, HousePalettePanel::OnClickAddHouse) - EVT_BUTTON(PALETTE_HOUSE_EDIT_HOUSE, HousePalettePanel::OnClickEditHouse) - EVT_BUTTON(PALETTE_HOUSE_REMOVE_HOUSE, HousePalettePanel::OnClickRemoveHouse) +EVT_BUTTON(PALETTE_HOUSE_ADD_HOUSE, HousePalettePanel::OnClickAddHouse) +EVT_BUTTON(PALETTE_HOUSE_EDIT_HOUSE, HousePalettePanel::OnClickEditHouse) +EVT_BUTTON(PALETTE_HOUSE_REMOVE_HOUSE, HousePalettePanel::OnClickRemoveHouse) - EVT_TOGGLEBUTTON(PALETTE_HOUSE_BRUSH_BUTTON, HousePalettePanel::OnClickHouseBrushButton) - EVT_TOGGLEBUTTON(PALETTE_HOUSE_SELECT_EXIT_BUTTON, HousePalettePanel::OnClickSelectExitButton) +EVT_TOGGLEBUTTON(PALETTE_HOUSE_BRUSH_BUTTON, HousePalettePanel::OnClickHouseBrushButton) +EVT_TOGGLEBUTTON(PALETTE_HOUSE_SELECT_EXIT_BUTTON, HousePalettePanel::OnClickSelectExitButton) END_EVENT_TABLE() HousePalettePanel::HousePalettePanel(wxWindow* parent, wxWindowID id) : PalettePanel(parent, id), map(nullptr), do_resize_on_display(true), - fix_size_timer(this, PALETTE_LAYOUT_FIX_TIMER) -{ + fix_size_timer(this, PALETTE_LAYOUT_FIX_TIMER) { wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); wxSizer* tmpsizer; @@ -66,10 +65,10 @@ HousePalettePanel::HousePalettePanel(wxWindow* parent, wxWindowID id) : sidesizer->Add(town_choice, 0, wxEXPAND); house_list = newd SortableListBox(this, PALETTE_HOUSE_LISTBOX); - #ifdef __APPLE__ - //Used for detecting a deselect +#ifdef __APPLE__ + // Used for detecting a deselect house_list->Bind(wxEVT_LEFT_UP, &HousePalettePanel::OnListBoxClick, this); - #endif +#endif sidesizer->Add(house_list, 1, wxEXPAND); tmpsizer = newd wxBoxSizer(wxHORIZONTAL); @@ -84,7 +83,7 @@ HousePalettePanel::HousePalettePanel(wxWindow* parent, wxWindowID id) : // Temple position sidesizer = newd wxStaticBoxSizer(newd wxStaticBox(this, wxID_ANY, "Brushes", wxDefaultPosition, wxSize(150, 200)), wxVERTICAL); - //sidesizer->Add(180, 1, wxEXPAND); + // sidesizer->Add(180, 1, wxEXPAND); tmpsizer = newd wxBoxSizer(wxHORIZONTAL); house_brush_button = newd wxToggleButton(this, PALETTE_HOUSE_BRUSH_BUTTON, "House tiles"); @@ -101,74 +100,70 @@ HousePalettePanel::HousePalettePanel(wxWindow* parent, wxWindowID id) : SetSizerAndFit(topsizer); } -HousePalettePanel::~HousePalettePanel() -{ +HousePalettePanel::~HousePalettePanel() { //// } -void HousePalettePanel::SetMap(Map* m) -{ +void HousePalettePanel::SetMap(Map* m) { g_gui.house_brush->setHouse(nullptr); map = m; OnUpdate(); } -void HousePalettePanel::OnSwitchIn() -{ +void HousePalettePanel::OnSwitchIn() { PalettePanel::OnSwitchIn(); // Extremely ugly hack to fix layout issue - if(do_resize_on_display) { + if (do_resize_on_display) { fix_size_timer.Start(100, true); do_resize_on_display = false; } } -void HousePalettePanel::OnLayoutFixTimer(wxTimerEvent& WXUNUSED(event)) -{ +void HousePalettePanel::OnLayoutFixTimer(wxTimerEvent &WXUNUSED(event)) { wxWindow* w = this; - while((w = w->GetParent()) && dynamic_cast(w) == nullptr); + while ((w = w->GetParent()) && dynamic_cast(w) == nullptr) + ; - if(w) { + if (w) { w->SetSize(w->GetSize().GetWidth(), w->GetSize().GetHeight() + 1); w->SetSize(w->GetSize().GetWidth(), w->GetSize().GetHeight() - 1); } } -void HousePalettePanel::SelectFirstBrush() -{ +void HousePalettePanel::SelectFirstBrush() { SelectHouseBrush(); } -Brush* HousePalettePanel::GetSelectedBrush() const -{ - if(select_position_button->GetValue()) { +Brush* HousePalettePanel::GetSelectedBrush() const { + if (select_position_button->GetValue()) { House* house = GetCurrentlySelectedHouse(); - if(house) + if (house) { g_gui.house_exit_brush->setHouse(house); - return (g_gui.house_exit_brush->getHouseID() != 0? g_gui.house_exit_brush : nullptr); - } else if(house_brush_button->GetValue()) { + } + return (g_gui.house_exit_brush->getHouseID() != 0 ? g_gui.house_exit_brush : nullptr); + } else if (house_brush_button->GetValue()) { g_gui.house_brush->setHouse(GetCurrentlySelectedHouse()); - return (g_gui.house_brush->getHouseID() != 0? g_gui.house_brush : nullptr); + return (g_gui.house_brush->getHouseID() != 0 ? g_gui.house_brush : nullptr); } return nullptr; } -bool HousePalettePanel::SelectBrush(const Brush* whatbrush) -{ - if(!whatbrush) +bool HousePalettePanel::SelectBrush(const Brush* whatbrush) { + if (!whatbrush) { return false; + } - if(whatbrush->isHouse() && map) { + if (whatbrush->isHouse() && map) { const HouseBrush* house_brush = static_cast(whatbrush); - for(HouseMap::iterator house_iter = map->houses.begin(); house_iter != map->houses.end(); ++house_iter) { - if(house_iter->second->id == house_brush->getHouseID()) { - for(uint32_t i = 0; i < town_choice->GetCount(); ++i) { + for (HouseMap::iterator house_iter = map->houses.begin(); house_iter != map->houses.end(); ++house_iter) { + if (house_iter->second->id == house_brush->getHouseID()) { + for (uint32_t i = 0; i < town_choice->GetCount(); ++i) { Town* town = reinterpret_cast(town_choice->GetClientData(i)); // If it's "No Town" (nullptr) select it, or if it has the same town ID as the house - if(town == nullptr || town->getID() == house_iter->second->townid) { + if (town == nullptr || town->getID() == house_iter->second->townid) { SelectTown(i); - for(uint32_t j = 0; j < house_list->GetCount(); ++j) { - if(house_iter->second->id == reinterpret_cast(house_list->GetClientData(j))->id) { + for (uint32_t j = 0; j < house_list->GetCount(); ++j) { + if (house_iter->second->id == reinterpret_cast(house_list->GetClientData(j))->id) { SelectHouse(j); return true; } @@ -186,21 +181,18 @@ bool HousePalettePanel::SelectBrush(const Brush* whatbrush) return false; } -int HousePalettePanel::GetSelectedBrushSize() const -{ +int HousePalettePanel::GetSelectedBrushSize() const { return 0; } -PaletteType HousePalettePanel::GetType() const -{ +PaletteType HousePalettePanel::GetType() const { return TILESET_HOUSE; } -void HousePalettePanel::SelectTown(size_t index) -{ +void HousePalettePanel::SelectTown(size_t index) { ASSERT(town_choice->GetCount() >= index); - if(map == nullptr || town_choice->GetCount() == 0) { + if (map == nullptr || town_choice->GetCount() == 0) { // No towns :( add_house_button->Enable(false); } else { @@ -209,14 +201,14 @@ void HousePalettePanel::SelectTown(size_t index) // Clear the old houselist house_list->Clear(); - for(HouseMap::iterator house_iter = map->houses.begin(); house_iter != map->houses.end(); ++house_iter) { - if(what_town) { - if(house_iter->second->townid == what_town->getID()) { + for (HouseMap::iterator house_iter = map->houses.begin(); house_iter != map->houses.end(); ++house_iter) { + if (what_town) { + if (house_iter->second->townid == what_town->getID()) { house_list->Append(wxstr(house_iter->second->getDescription()), house_iter->second); } } else { // "No Town" selected! - if(map->towns.getTown(house_iter->second->townid) == nullptr) { + if (map->towns.getTown(house_iter->second->townid) == nullptr) { // The town doesn't exist house_list->Append(wxstr(house_iter->second->getDescription()), house_iter->second); } @@ -232,11 +224,10 @@ void HousePalettePanel::SelectTown(size_t index) } } -void HousePalettePanel::SelectHouse(size_t index) -{ +void HousePalettePanel::SelectHouse(size_t index) { ASSERT(house_list->GetCount() >= index); - if(house_list->GetCount() > 0) { + if (house_list->GetCount() > 0) { edit_house_button->Enable(true); remove_house_button->Enable(true); select_position_button->Enable(true); @@ -256,18 +247,16 @@ void HousePalettePanel::SelectHouse(size_t index) g_gui.RefreshView(); } -House* HousePalettePanel::GetCurrentlySelectedHouse() const -{ +House* HousePalettePanel::GetCurrentlySelectedHouse() const { int selection = house_list->GetSelection(); - if(house_list->GetCount() > 0 && selection != wxNOT_FOUND) { + if (house_list->GetCount() > 0 && selection != wxNOT_FOUND) { return reinterpret_cast(house_list->GetClientData(selection)); } return nullptr; } -void HousePalettePanel::SelectHouseBrush() -{ - if(house_list->GetCount() > 0) { +void HousePalettePanel::SelectHouseBrush() { + if (house_list->GetCount() > 0) { house_brush_button->SetValue(true); select_position_button->SetValue(false); } else { @@ -276,36 +265,36 @@ void HousePalettePanel::SelectHouseBrush() } } -void HousePalettePanel::SelectExitBrush() -{ - if(house_list->GetCount() > 0) { +void HousePalettePanel::SelectExitBrush() { + if (house_list->GetCount() > 0) { house_brush_button->SetValue(false); select_position_button->SetValue(true); } } -void HousePalettePanel::OnUpdate() -{ +void HousePalettePanel::OnUpdate() { int old_town_selection = town_choice->GetSelection(); town_choice->Clear(); house_list->Clear(); - if(map == nullptr) + if (map == nullptr) { return; + } - if(map->towns.count() != 0) { + if (map->towns.count() != 0) { // Create choice control - for(TownMap::iterator town_iter = map->towns.begin(); town_iter != map->towns.end(); ++town_iter) { + for (TownMap::iterator town_iter = map->towns.begin(); town_iter != map->towns.end(); ++town_iter) { town_choice->Append(wxstr(town_iter->second->getName()), town_iter->second); } town_choice->Append("No Town", (void*)(nullptr)); - if(old_town_selection <= 0) + if (old_town_selection <= 0) { SelectTown(0); - else if((size_t)old_town_selection <= town_choice->GetCount()) + } else if ((size_t)old_town_selection <= town_choice->GetCount()) { SelectTown(old_town_selection); - else - SelectTown(old_town_selection-1); + } else { + SelectTown(old_town_selection - 1); + } house_list->Enable(true); } else { @@ -322,43 +311,38 @@ void HousePalettePanel::OnUpdate() } } -void HousePalettePanel::OnTownChange(wxCommandEvent& event) -{ +void HousePalettePanel::OnTownChange(wxCommandEvent &event) { SelectTown(event.GetSelection()); g_gui.SelectBrush(); } -void HousePalettePanel::OnListBoxChange(wxCommandEvent& event) -{ +void HousePalettePanel::OnListBoxChange(wxCommandEvent &event) { SelectHouse(event.GetSelection()); g_gui.SelectBrush(); } -void HousePalettePanel::OnListBoxDoubleClick(wxCommandEvent& event) -{ +void HousePalettePanel::OnListBoxDoubleClick(wxCommandEvent &event) { House* house = reinterpret_cast(event.GetClientData()); // I find it extremly unlikely that one actually wants the exit at 0,0,0, so just treat it as the null value - if(house && house->getExit() != Position(0,0,0)) { + if (house && house->getExit() != Position(0, 0, 0)) { g_gui.SetScreenCenterPosition(house->getExit()); } } -void HousePalettePanel::OnClickHouseBrushButton(wxCommandEvent& event) -{ +void HousePalettePanel::OnClickHouseBrushButton(wxCommandEvent &event) { SelectHouseBrush(); g_gui.SelectBrush(); } -void HousePalettePanel::OnClickSelectExitButton(wxCommandEvent& event) -{ +void HousePalettePanel::OnClickSelectExitButton(wxCommandEvent &event) { SelectExitBrush(); g_gui.SelectBrush(); } -void HousePalettePanel::OnClickAddHouse(wxCommandEvent& event) -{ - if(map == nullptr) +void HousePalettePanel::OnClickAddHouse(wxCommandEvent &event) { + if (map == nullptr) { return; + } House* new_house = newd House(*map); new_house->id = map->houses.getEmptyID(); @@ -378,18 +362,19 @@ void HousePalettePanel::OnClickAddHouse(wxCommandEvent& event) refresh_timer.Start(300, true); } -void HousePalettePanel::OnClickEditHouse(wxCommandEvent& event) -{ - if(house_list->GetCount() == 0) +void HousePalettePanel::OnClickEditHouse(wxCommandEvent &event) { + if (house_list->GetCount() == 0) { return; - if(map == nullptr) + } + if (map == nullptr) { return; + } int selection = house_list->GetSelection(); House* house = reinterpret_cast(house_list->GetClientData(selection)); - if(house) { + if (house) { wxDialog* d = newd EditHouseDialog(g_gui.root, map, house); int ret = d->ShowModal(); - if(ret == 1) { + if (ret == 1) { // Something changed, change name of house house_list->SetString(selection, wxstr(house->getDescription())); house_list->Sort(); @@ -398,20 +383,19 @@ void HousePalettePanel::OnClickEditHouse(wxCommandEvent& event) } } -void HousePalettePanel::OnClickRemoveHouse(wxCommandEvent& event) -{ +void HousePalettePanel::OnClickRemoveHouse(wxCommandEvent &event) { int selection = house_list->GetSelection(); - if(selection != wxNOT_FOUND) { + if (selection != wxNOT_FOUND) { House* house = reinterpret_cast(house_list->GetClientData(selection)); map->houses.removeHouse(house); house_list->Delete(selection); refresh_timer.Start(300, true); - if(int(house_list->GetCount()) <= selection) { + if (int(house_list->GetCount()) <= selection) { selection -= 1; } - if(selection >= 0 && house_list->GetCount()) { + if (selection >= 0 && house_list->GetCount()) { house_list->SetSelection(selection); } else { select_position_button->Enable(false); @@ -427,10 +411,10 @@ void HousePalettePanel::OnClickRemoveHouse(wxCommandEvent& event) } #ifdef __APPLE__ -//On wxMac it is possible to deselect a wxListBox. (Unlike on the other platforms) -//EVT_LISTBOX is not triggered when the deselection is happening. http://trac.wxwidgets.org/ticket/15603 -//Here we find out if the listbox was deselected using a normal mouse up event so we know when to disable the buttons and brushes. -void HousePalettePanel::OnListBoxClick(wxMouseEvent& event) { +// On wxMac it is possible to deselect a wxListBox. (Unlike on the other platforms) +// EVT_LISTBOX is not triggered when the deselection is happening. http://trac.wxwidgets.org/ticket/15603 +// Here we find out if the listbox was deselected using a normal mouse up event so we know when to disable the buttons and brushes. +void HousePalettePanel::OnListBoxClick(wxMouseEvent &event) { if (house_list->GetSelection() == wxNOT_FOUND) { select_position_button->Enable(false); select_position_button->SetValue(false); @@ -447,15 +431,14 @@ void HousePalettePanel::OnListBoxClick(wxMouseEvent& event) { // House Edit Dialog BEGIN_EVENT_TABLE(EditHouseDialog, wxDialog) - EVT_BUTTON(wxID_OK, EditHouseDialog::OnClickOK) - EVT_BUTTON(wxID_CANCEL, EditHouseDialog::OnClickCancel) +EVT_BUTTON(wxID_OK, EditHouseDialog::OnClickOK) +EVT_BUTTON(wxID_CANCEL, EditHouseDialog::OnClickCancel) END_EVENT_TABLE() EditHouseDialog::EditHouseDialog(wxWindow* parent, Map* map, House* house) : - wxDialog(parent, wxID_ANY, "House", wxDefaultPosition, wxSize(250,160)), + wxDialog(parent, wxID_ANY, "House", wxDefaultPosition, wxSize(250, 160)), map(map), - what_house(house) -{ + what_house(house) { ASSERT(map); ASSERT(house); @@ -471,26 +454,26 @@ EditHouseDialog::EditHouseDialog(wxWindow* parent, Map* map, House* house) : // House options tmpsizer = newd wxStaticBoxSizer(wxHORIZONTAL, this, "Name"); - name_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(230,20), 0, wxTextValidator(wxFILTER_ASCII, &house_name)); + name_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(230, 20), 0, wxTextValidator(wxFILTER_ASCII, &house_name)); tmpsizer->Add(name_field); sizer->Add(tmpsizer, wxSizerFlags().Border(wxALL, 20)); tmpsizer = newd wxStaticBoxSizer(wxHORIZONTAL, this, "Rent / ID"); - rent_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(160,20), 0, wxTextValidator(wxFILTER_NUMERIC, &house_rent)); + rent_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(160, 20), 0, wxTextValidator(wxFILTER_NUMERIC, &house_rent)); tmpsizer->Add(rent_field); - id_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(70,20), 0, wxTextValidator(wxFILTER_NUMERIC, &house_id)); + id_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(70, 20), 0, wxTextValidator(wxFILTER_NUMERIC, &house_id)); id_field->Enable(false); tmpsizer->Add(id_field); sizer->Add(tmpsizer, wxSizerFlags().Border(wxALL, 20)); tmpsizer = newd wxStaticBoxSizer(wxHORIZONTAL, this, "Client ID"); - clientid_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(160,20), 0, wxTextValidator(wxFILTER_NUMERIC, &house_clientid)); + clientid_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(160, 20), 0, wxTextValidator(wxFILTER_NUMERIC, &house_clientid)); tmpsizer->Add(clientid_field); sizer->Add(tmpsizer, wxSizerFlags().Border(wxALL, 20)); tmpsizer = newd wxStaticBoxSizer(wxHORIZONTAL, this, "Max beds"); - beds_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(160,20), 0, wxTextValidator(wxFILTER_NUMERIC, &house_beds)); + beds_field = newd wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(160, 20), 0, wxTextValidator(wxFILTER_NUMERIC, &house_beds)); tmpsizer->Add(beds_field); sizer->Add(tmpsizer, wxSizerFlags().Border(wxALL, 20)); @@ -509,14 +492,12 @@ EditHouseDialog::EditHouseDialog(wxWindow* parent, Map* map, House* house) : SetSizerAndFit(sizer); } -EditHouseDialog::~EditHouseDialog() -{ +EditHouseDialog::~EditHouseDialog() { //// } -void EditHouseDialog::OnClickOK(wxCommandEvent& WXUNUSED(event)) -{ - if(Validate() && TransferDataFromWindow()) { +void EditHouseDialog::OnClickOK(wxCommandEvent &WXUNUSED(event)) { + if (Validate() && TransferDataFromWindow()) { // Verify the newd information long new_house_rent; house_rent.ToLong(&new_house_rent); @@ -527,29 +508,29 @@ void EditHouseDialog::OnClickOK(wxCommandEvent& WXUNUSED(event)) long new_house_clientid; house_clientid.ToLong(&new_house_clientid); - if(new_house_rent < 0) { + if (new_house_rent < 0) { g_gui.PopupDialog(this, "Error", "House rent cannot be less than 0.", wxOK); return; } - if(new_house_beds < 0) { + if (new_house_beds < 0) { g_gui.PopupDialog(this, "Error", "House beds cannot be less than 0.", wxOK); return; } - if(house_name.length() == 0) { + if (house_name.length() == 0) { g_gui.PopupDialog(this, "Error", "House name cannot be nil.", wxOK); return; } - if(g_settings.getInteger(Config::WARN_FOR_DUPLICATE_ID)) { - Houses& houses = map->houses; - for(HouseMap::const_iterator house_iter = houses.begin(); house_iter != houses.end(); ++house_iter) { + if (g_settings.getInteger(Config::WARN_FOR_DUPLICATE_ID)) { + Houses &houses = map->houses; + for (HouseMap::const_iterator house_iter = houses.begin(); house_iter != houses.end(); ++house_iter) { House* house = house_iter->second; ASSERT(house); - if(wxstr(house->name) == house_name && house->id != what_house->id) { + if (wxstr(house->name) == house_name && house->id != what_house->id) { int ret = g_gui.PopupDialog(this, "Warning", "This house name is already in use, are you sure you want to continue?", wxYES | wxNO); - if(ret == wxID_NO) { + if (ret == wxID_NO) { return; } } @@ -567,8 +548,7 @@ void EditHouseDialog::OnClickOK(wxCommandEvent& WXUNUSED(event)) } } -void EditHouseDialog::OnClickCancel(wxCommandEvent& WXUNUSED(event)) -{ +void EditHouseDialog::OnClickCancel(wxCommandEvent &WXUNUSED(event)) { // Just close this window EndModal(0); } diff --git a/source/palette_house.h b/source/palette_house.h index 4fb3417d..6d31fc64 100644 --- a/source/palette_house.h +++ b/source/palette_house.h @@ -43,9 +43,10 @@ class HousePalettePanel : public PalettePanel { // Called when this page is about to be displayed void OnSwitchIn(); - void OnLayoutFixTimer(wxTimerEvent& event); + void OnLayoutFixTimer(wxTimerEvent &event); void SetMap(Map* map); + protected: // Internal use void SaveHouse(); @@ -56,21 +57,22 @@ class HousePalettePanel : public PalettePanel { void SelectHouseBrush(); void SelectExitBrush(); + public: // wxWidgets event handling - void OnTownChange(wxCommandEvent& event); - void OnListBoxChange(wxCommandEvent& event); - void OnListBoxDoubleClick(wxCommandEvent& event); - void OnClickHouseBrushButton(wxCommandEvent& event); - void OnClickSelectExitButton(wxCommandEvent& event); - void OnClickAddHouse(wxCommandEvent& event); - void OnClickEditHouse(wxCommandEvent& event); - void OnClickRemoveHouse(wxCommandEvent& event); - - #ifdef __APPLE__ - //Used for detecting a deselect - void OnListBoxClick(wxMouseEvent& event); - #endif + void OnTownChange(wxCommandEvent &event); + void OnListBoxChange(wxCommandEvent &event); + void OnListBoxDoubleClick(wxCommandEvent &event); + void OnClickHouseBrushButton(wxCommandEvent &event); + void OnClickSelectExitButton(wxCommandEvent &event); + void OnClickAddHouse(wxCommandEvent &event); + void OnClickEditHouse(wxCommandEvent &event); + void OnClickRemoveHouse(wxCommandEvent &event); + +#ifdef __APPLE__ + // Used for detecting a deselect + void OnListBoxClick(wxMouseEvent &event); +#endif protected: Map* map; @@ -89,14 +91,14 @@ class HousePalettePanel : public PalettePanel { DECLARE_EVENT_TABLE() }; -class EditHouseDialog : public wxDialog -{ +class EditHouseDialog : public wxDialog { public: EditHouseDialog(wxWindow* parent, Map* map, House* house); virtual ~EditHouseDialog(); - void OnClickOK(wxCommandEvent&); - void OnClickCancel(wxCommandEvent&); + void OnClickOK(wxCommandEvent &); + void OnClickCancel(wxCommandEvent &); + protected: Map* map; House* what_house; diff --git a/source/palette_monster.cpp b/source/palette_monster.cpp index 0de25b0a..ddcf49c7 100644 --- a/source/palette_monster.cpp +++ b/source/palette_monster.cpp @@ -29,22 +29,21 @@ // Monster palette BEGIN_EVENT_TABLE(MonsterPalettePanel, PalettePanel) - EVT_CHOICE(PALETTE_MONSTER_TILESET_CHOICE, MonsterPalettePanel::OnTilesetChange) +EVT_CHOICE(PALETTE_MONSTER_TILESET_CHOICE, MonsterPalettePanel::OnTilesetChange) - EVT_LISTBOX(PALETTE_MONSTER_LISTBOX, MonsterPalettePanel::OnListBoxChange) +EVT_LISTBOX(PALETTE_MONSTER_LISTBOX, MonsterPalettePanel::OnListBoxChange) - EVT_TOGGLEBUTTON(PALETTE_MONSTER_BRUSH_BUTTON, MonsterPalettePanel::OnClickMonsterBrushButton) - EVT_TOGGLEBUTTON(PALETTE_SPAWN_MONSTER_BRUSH_BUTTON, MonsterPalettePanel::OnClickSpawnMonsterBrushButton) +EVT_TOGGLEBUTTON(PALETTE_MONSTER_BRUSH_BUTTON, MonsterPalettePanel::OnClickMonsterBrushButton) +EVT_TOGGLEBUTTON(PALETTE_SPAWN_MONSTER_BRUSH_BUTTON, MonsterPalettePanel::OnClickSpawnMonsterBrushButton) - EVT_SPINCTRL(PALETTE_MONSTER_SPAWN_TIME, MonsterPalettePanel::OnChangeSpawnMonsterTime) - EVT_SPINCTRL(PALETTE_MONSTER_SPAWN_SIZE, MonsterPalettePanel::OnChangeSpawnMonsterSize) +EVT_SPINCTRL(PALETTE_MONSTER_SPAWN_TIME, MonsterPalettePanel::OnChangeSpawnMonsterTime) +EVT_SPINCTRL(PALETTE_MONSTER_SPAWN_SIZE, MonsterPalettePanel::OnChangeSpawnMonsterSize) END_EVENT_TABLE() MonsterPalettePanel::MonsterPalettePanel(wxWindow* parent, wxWindowID id) : PalettePanel(parent, id), - handling_event(false) -{ - + handling_event(false) { + wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); wxSizer* sidesizer = newd wxStaticBoxSizer(wxVERTICAL, this, "Monsters"); @@ -58,7 +57,7 @@ MonsterPalettePanel::MonsterPalettePanel(wxWindow* parent, wxWindowID id) : // Brush selection sidesizer = newd wxStaticBoxSizer(newd wxStaticBox(this, wxID_ANY, "Brushes", wxDefaultPosition, wxSize(150, 200)), wxVERTICAL); - //sidesizer->Add(180, 1, wxEXPAND); + // sidesizer->Add(180, 1, wxEXPAND); wxFlexGridSizer* grid = newd wxFlexGridSizer(3, 10, 10); grid->AddGrowableCol(1); @@ -82,33 +81,29 @@ MonsterPalettePanel::MonsterPalettePanel(wxWindow* parent, wxWindowID id) : OnUpdate(); } -MonsterPalettePanel::~MonsterPalettePanel() -{ +MonsterPalettePanel::~MonsterPalettePanel() { //// } -PaletteType MonsterPalettePanel::GetType() const -{ +PaletteType MonsterPalettePanel::GetType() const { return TILESET_MONSTER; } -void MonsterPalettePanel::SelectFirstBrush() -{ +void MonsterPalettePanel::SelectFirstBrush() { SelectMonsterBrush(); } -Brush* MonsterPalettePanel::GetSelectedBrush() const -{ - if(monster_brush_button->GetValue()) { - if(monster_list->GetCount() == 0) { +Brush* MonsterPalettePanel::GetSelectedBrush() const { + if (monster_brush_button->GetValue()) { + if (monster_list->GetCount() == 0) { return nullptr; } Brush* brush = reinterpret_cast(monster_list->GetClientData(monster_list->GetSelection())); - if(brush && brush->isMonster()) { + if (brush && brush->isMonster()) { g_gui.SetSpawnMonsterTime(monster_spawntime_spin->GetValue()); return brush; } - } else if(spawn_monster_brush_button->GetValue()) { + } else if (spawn_monster_brush_button->GetValue()) { g_settings.setInteger(Config::CURRENT_SPAWN_MONSTER_RADIUS, spawn_monster_size_spin->GetValue()); g_settings.setInteger(Config::DEFAULT_SPAWN_MONSTER_TIME, monster_spawntime_spin->GetValue()); return g_gui.spawn_brush; @@ -116,32 +111,31 @@ Brush* MonsterPalettePanel::GetSelectedBrush() const return nullptr; } -bool MonsterPalettePanel::SelectBrush(const Brush* whatbrush) -{ - if(!whatbrush) +bool MonsterPalettePanel::SelectBrush(const Brush* whatbrush) { + if (!whatbrush) { return false; + } - if(whatbrush->isMonster()) { + if (whatbrush->isMonster()) { int current_index = tileset_choice->GetSelection(); - if(current_index != wxNOT_FOUND) { + if (current_index != wxNOT_FOUND) { const TilesetCategory* tsc = reinterpret_cast(tileset_choice->GetClientData(current_index)); // Select first house - for(BrushVector::const_iterator iter = tsc->brushlist.begin(); iter != tsc->brushlist.end(); ++iter) { - if(*iter == whatbrush) { + for (BrushVector::const_iterator iter = tsc->brushlist.begin(); iter != tsc->brushlist.end(); ++iter) { + if (*iter == whatbrush) { SelectMonster(whatbrush->getName()); return true; } } } // Not in the current display, search the hidden one's - for(size_t i = 0; i < tileset_choice->GetCount(); ++i) { - if(current_index != (int)i) { + for (size_t i = 0; i < tileset_choice->GetCount(); ++i) { + if (current_index != (int)i) { const TilesetCategory* tsc = reinterpret_cast(tileset_choice->GetClientData(i)); - for(BrushVector::const_iterator iter = tsc->brushlist.begin(); - iter != tsc->brushlist.end(); - ++iter) - { - if(*iter == whatbrush) { + for (BrushVector::const_iterator iter = tsc->brushlist.begin(); + iter != tsc->brushlist.end(); + ++iter) { + if (*iter == whatbrush) { SelectTileset(i); SelectMonster(whatbrush->getName()); return true; @@ -149,28 +143,26 @@ bool MonsterPalettePanel::SelectBrush(const Brush* whatbrush) } } } - } else if(whatbrush->isSpawnMonster()) { + } else if (whatbrush->isSpawnMonster()) { SelectSpawnBrush(); return true; } return false; } -int MonsterPalettePanel::GetSelectedBrushSize() const -{ +int MonsterPalettePanel::GetSelectedBrushSize() const { return spawn_monster_size_spin->GetValue(); } -void MonsterPalettePanel::OnUpdate() -{ +void MonsterPalettePanel::OnUpdate() { tileset_choice->Clear(); g_materials.createOtherTileset(); - for(TilesetContainer::const_iterator iter = g_materials.tilesets.begin(); iter != g_materials.tilesets.end(); ++iter) { + for (TilesetContainer::const_iterator iter = g_materials.tilesets.begin(); iter != g_materials.tilesets.end(); ++iter) { const TilesetCategory* tsc = iter->second->getCategory(TILESET_MONSTER); - if(tsc && tsc->size() > 0) { + if (tsc && tsc->size() > 0) { tileset_choice->Append(wxstr(iter->second->name), const_cast(tsc)); - } else if(iter->second->name == "Others") { + } else if (iter->second->name == "Others") { Tileset* ts = const_cast(iter->second); TilesetCategory* rtsc = ts->getCategory(TILESET_MONSTER); tileset_choice->Append(wxstr(ts->name), rtsc); @@ -179,32 +171,28 @@ void MonsterPalettePanel::OnUpdate() SelectTileset(0); } -void MonsterPalettePanel::OnUpdateBrushSize(BrushShape shape, int size) -{ +void MonsterPalettePanel::OnUpdateBrushSize(BrushShape shape, int size) { return spawn_monster_size_spin->SetValue(size); } -void MonsterPalettePanel::OnSwitchIn() -{ +void MonsterPalettePanel::OnSwitchIn() { g_gui.ActivatePalette(GetParentPalette()); g_gui.SetBrushSize(spawn_monster_size_spin->GetValue()); } -void MonsterPalettePanel::SelectTileset(size_t index) -{ +void MonsterPalettePanel::SelectTileset(size_t index) { ASSERT(tileset_choice->GetCount() >= index); monster_list->Clear(); - if(tileset_choice->GetCount() == 0) { + if (tileset_choice->GetCount() == 0) { // No tilesets :( monster_brush_button->Enable(false); } else { const TilesetCategory* tsc = reinterpret_cast(tileset_choice->GetClientData(index)); // Select first house - for(BrushVector::const_iterator iter = tsc->brushlist.begin(); - iter != tsc->brushlist.end(); - ++iter) - { + for (BrushVector::const_iterator iter = tsc->brushlist.begin(); + iter != tsc->brushlist.end(); + ++iter) { monster_list->Append(wxstr((*iter)->getName()), *iter); } monster_list->Sort(); @@ -214,22 +202,20 @@ void MonsterPalettePanel::SelectTileset(size_t index) } } -void MonsterPalettePanel::SelectMonster(size_t index) -{ +void MonsterPalettePanel::SelectMonster(size_t index) { // Save the old g_settings ASSERT(monster_list->GetCount() >= index); - if(monster_list->GetCount() > 0) { + if (monster_list->GetCount() > 0) { monster_list->SetSelection(index); } SelectMonsterBrush(); } -void MonsterPalettePanel::SelectMonster(std::string name) -{ - if(monster_list->GetCount() > 0) { - if(!monster_list->SetStringSelection(wxstr(name))) { +void MonsterPalettePanel::SelectMonster(std::string name) { + if (monster_list->GetCount() > 0) { + if (!monster_list->SetStringSelection(wxstr(name))) { monster_list->SetSelection(0); } } @@ -237,9 +223,8 @@ void MonsterPalettePanel::SelectMonster(std::string name) SelectMonsterBrush(); } -void MonsterPalettePanel::SelectMonsterBrush() -{ - if(monster_list->GetCount() > 0) { +void MonsterPalettePanel::SelectMonsterBrush() { + if (monster_list->GetCount() > 0) { monster_brush_button->Enable(true); monster_brush_button->SetValue(true); spawn_monster_brush_button->SetValue(false); @@ -249,50 +234,43 @@ void MonsterPalettePanel::SelectMonsterBrush() } } -void MonsterPalettePanel::SelectSpawnBrush() -{ - //g_gui.house_exit_brush->setHouse(house); +void MonsterPalettePanel::SelectSpawnBrush() { + // g_gui.house_exit_brush->setHouse(house); monster_brush_button->SetValue(false); spawn_monster_brush_button->SetValue(true); } -void MonsterPalettePanel::OnTilesetChange(wxCommandEvent& event) -{ +void MonsterPalettePanel::OnTilesetChange(wxCommandEvent &event) { SelectTileset(event.GetSelection()); g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(); } -void MonsterPalettePanel::OnListBoxChange(wxCommandEvent& event) -{ +void MonsterPalettePanel::OnListBoxChange(wxCommandEvent &event) { SelectMonster(event.GetSelection()); g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(); } -void MonsterPalettePanel::OnClickMonsterBrushButton(wxCommandEvent& event) -{ +void MonsterPalettePanel::OnClickMonsterBrushButton(wxCommandEvent &event) { SelectMonsterBrush(); g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(); } -void MonsterPalettePanel::OnClickSpawnMonsterBrushButton(wxCommandEvent& event) -{ +void MonsterPalettePanel::OnClickSpawnMonsterBrushButton(wxCommandEvent &event) { SelectSpawnBrush(); g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(); } -void MonsterPalettePanel::OnChangeSpawnMonsterTime(wxSpinEvent& event) -{ +void MonsterPalettePanel::OnChangeSpawnMonsterTime(wxSpinEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SetSpawnMonsterTime(event.GetPosition()); } -void MonsterPalettePanel::OnChangeSpawnMonsterSize(wxSpinEvent& event) -{ - if(!handling_event) { +void MonsterPalettePanel::OnChangeSpawnMonsterSize(wxSpinEvent &event) { + if (!handling_event) { handling_event = true; g_gui.ActivatePalette(GetParentPalette()); g_gui.SetBrushSize(event.GetPosition()); diff --git a/source/palette_monster.h b/source/palette_monster.h index e680cf3f..54ab0519 100644 --- a/source/palette_monster.h +++ b/source/palette_monster.h @@ -15,7 +15,6 @@ // along with this program. If not, see . ////////////////////////////////////////////////////////////////////// - #ifndef RME_TILESET_MONSTER_H_ #define RME_TILESET_MONSTER_H_ @@ -48,15 +47,17 @@ class MonsterPalettePanel : public PalettePanel { void SelectTileset(size_t index); void SelectMonster(size_t index); void SelectMonster(std::string name); + public: // Event handling - void OnChangeSpawnMonsterTime(wxSpinEvent& event); - void OnChangeSpawnMonsterSize(wxSpinEvent& event); + void OnChangeSpawnMonsterTime(wxSpinEvent &event); + void OnChangeSpawnMonsterSize(wxSpinEvent &event); + + void OnTilesetChange(wxCommandEvent &event); + void OnListBoxChange(wxCommandEvent &event); + void OnClickMonsterBrushButton(wxCommandEvent &event); + void OnClickSpawnMonsterBrushButton(wxCommandEvent &event); - void OnTilesetChange(wxCommandEvent& event); - void OnListBoxChange(wxCommandEvent& event); - void OnClickMonsterBrushButton(wxCommandEvent& event); - void OnClickSpawnMonsterBrushButton(wxCommandEvent& event); protected: void SelectMonsterBrush(); void SelectSpawnBrush(); diff --git a/source/palette_npc.cpp b/source/palette_npc.cpp index b64d64ab..c152194c 100644 --- a/source/palette_npc.cpp +++ b/source/palette_npc.cpp @@ -29,21 +29,20 @@ // Npc palette BEGIN_EVENT_TABLE(NpcPalettePanel, PalettePanel) - EVT_CHOICE(PALETTE_NPC_TILESET_CHOICE, NpcPalettePanel::OnTilesetChange) +EVT_CHOICE(PALETTE_NPC_TILESET_CHOICE, NpcPalettePanel::OnTilesetChange) - EVT_LISTBOX(PALETTE_NPC_LISTBOX, NpcPalettePanel::OnListBoxChange) +EVT_LISTBOX(PALETTE_NPC_LISTBOX, NpcPalettePanel::OnListBoxChange) - EVT_TOGGLEBUTTON(PALETTE_NPC_BRUSH_BUTTON, NpcPalettePanel::OnClickNpcBrushButton) - EVT_TOGGLEBUTTON(PALETTE_SPAWN_NPC_BRUSH_BUTTON, NpcPalettePanel::OnClickSpawnNpcBrushButton) +EVT_TOGGLEBUTTON(PALETTE_NPC_BRUSH_BUTTON, NpcPalettePanel::OnClickNpcBrushButton) +EVT_TOGGLEBUTTON(PALETTE_SPAWN_NPC_BRUSH_BUTTON, NpcPalettePanel::OnClickSpawnNpcBrushButton) - EVT_SPINCTRL(PALETTE_SPAWN_NPC_TIME, NpcPalettePanel::OnChangeSpawnNpcTime) - EVT_SPINCTRL(PALETTE_SPAWN_NPC_SIZE, NpcPalettePanel::OnChangeSpawnNpcSize) +EVT_SPINCTRL(PALETTE_SPAWN_NPC_TIME, NpcPalettePanel::OnChangeSpawnNpcTime) +EVT_SPINCTRL(PALETTE_SPAWN_NPC_SIZE, NpcPalettePanel::OnChangeSpawnNpcSize) END_EVENT_TABLE() NpcPalettePanel::NpcPalettePanel(wxWindow* parent, wxWindowID id) : PalettePanel(parent, id), - handling_event(false) -{ + handling_event(false) { wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); wxSizer* sidesizer = newd wxStaticBoxSizer(wxVERTICAL, this, "Npcs"); @@ -57,7 +56,7 @@ NpcPalettePanel::NpcPalettePanel(wxWindow* parent, wxWindowID id) : // Brush selection sidesizer = newd wxStaticBoxSizer(newd wxStaticBox(this, wxID_ANY, "Brushes", wxDefaultPosition, wxSize(150, 200)), wxVERTICAL); - //sidesizer->Add(180, 1, wxEXPAND); + // sidesizer->Add(180, 1, wxEXPAND); wxFlexGridSizer* grid = newd wxFlexGridSizer(3, 10, 10); grid->AddGrowableCol(1); @@ -81,33 +80,29 @@ NpcPalettePanel::NpcPalettePanel(wxWindow* parent, wxWindowID id) : OnUpdate(); } -NpcPalettePanel::~NpcPalettePanel() -{ +NpcPalettePanel::~NpcPalettePanel() { //// } -PaletteType NpcPalettePanel::GetType() const -{ +PaletteType NpcPalettePanel::GetType() const { return TILESET_NPC; } -void NpcPalettePanel::SelectFirstBrush() -{ +void NpcPalettePanel::SelectFirstBrush() { SelectNpcBrush(); } -Brush* NpcPalettePanel::GetSelectedBrush() const -{ - if(npc_brush_button->GetValue()) { - if(npc_list->GetCount() == 0) { +Brush* NpcPalettePanel::GetSelectedBrush() const { + if (npc_brush_button->GetValue()) { + if (npc_list->GetCount() == 0) { return nullptr; } Brush* brush = reinterpret_cast(npc_list->GetClientData(npc_list->GetSelection())); - if(brush && brush->isNpc()) { + if (brush && brush->isNpc()) { g_gui.SetSpawnNpcTime(npc_spawntime_spin->GetValue()); return brush; } - } else if(spawn_npc_brush_button->GetValue()) { + } else if (spawn_npc_brush_button->GetValue()) { g_settings.setInteger(Config::CURRENT_SPAWN_NPC_RADIUS, spawn_npc_size_spin->GetValue()); g_settings.setInteger(Config::DEFAULT_SPAWN_NPC_TIME, npc_spawntime_spin->GetValue()); return g_gui.spawn_npc_brush; @@ -115,32 +110,31 @@ Brush* NpcPalettePanel::GetSelectedBrush() const return nullptr; } -bool NpcPalettePanel::SelectBrush(const Brush* whatbrush) -{ - if(!whatbrush) +bool NpcPalettePanel::SelectBrush(const Brush* whatbrush) { + if (!whatbrush) { return false; + } - if(whatbrush->isNpc()) { + if (whatbrush->isNpc()) { int current_index = tileset_choice->GetSelection(); - if(current_index != wxNOT_FOUND) { + if (current_index != wxNOT_FOUND) { const TilesetCategory* tsc = reinterpret_cast(tileset_choice->GetClientData(current_index)); // Select first house - for(BrushVector::const_iterator iter = tsc->brushlist.begin(); iter != tsc->brushlist.end(); ++iter) { - if(*iter == whatbrush) { + for (BrushVector::const_iterator iter = tsc->brushlist.begin(); iter != tsc->brushlist.end(); ++iter) { + if (*iter == whatbrush) { SelectNpc(whatbrush->getName()); return true; } } } // Not in the current display, search the hidden one's - for(size_t i = 0; i < tileset_choice->GetCount(); ++i) { - if(current_index != (int)i) { + for (size_t i = 0; i < tileset_choice->GetCount(); ++i) { + if (current_index != (int)i) { const TilesetCategory* tsc = reinterpret_cast(tileset_choice->GetClientData(i)); - for(BrushVector::const_iterator iter = tsc->brushlist.begin(); - iter != tsc->brushlist.end(); - ++iter) - { - if(*iter == whatbrush) { + for (BrushVector::const_iterator iter = tsc->brushlist.begin(); + iter != tsc->brushlist.end(); + ++iter) { + if (*iter == whatbrush) { SelectTileset(i); SelectNpc(whatbrush->getName()); return true; @@ -148,28 +142,26 @@ bool NpcPalettePanel::SelectBrush(const Brush* whatbrush) } } } - } else if(whatbrush->isSpawnNpc()) { + } else if (whatbrush->isSpawnNpc()) { SelectSpawnNpcBrush(); return true; } return false; } -int NpcPalettePanel::GetSelectedBrushSize() const -{ +int NpcPalettePanel::GetSelectedBrushSize() const { return spawn_npc_size_spin->GetValue(); } -void NpcPalettePanel::OnUpdate() -{ +void NpcPalettePanel::OnUpdate() { tileset_choice->Clear(); g_materials.createNpcTileset(); - for(TilesetContainer::const_iterator iter = g_materials.tilesets.begin(); iter != g_materials.tilesets.end(); ++iter) { + for (TilesetContainer::const_iterator iter = g_materials.tilesets.begin(); iter != g_materials.tilesets.end(); ++iter) { const TilesetCategory* tsc = iter->second->getCategory(TILESET_NPC); - if(tsc && tsc->size() > 0) { + if (tsc && tsc->size() > 0) { tileset_choice->Append(wxstr(iter->second->name), const_cast(tsc)); - } else if(iter->second->name == "NPCs") { + } else if (iter->second->name == "NPCs") { Tileset* ts = const_cast(iter->second); TilesetCategory* rtsc = ts->getCategory(TILESET_NPC); tileset_choice->Append(wxstr(ts->name), rtsc); @@ -178,32 +170,28 @@ void NpcPalettePanel::OnUpdate() SelectTileset(0); } -void NpcPalettePanel::OnUpdateBrushSize(BrushShape shape, int size) -{ +void NpcPalettePanel::OnUpdateBrushSize(BrushShape shape, int size) { return spawn_npc_size_spin->SetValue(size); } -void NpcPalettePanel::OnSwitchIn() -{ +void NpcPalettePanel::OnSwitchIn() { g_gui.ActivatePalette(GetParentPalette()); g_gui.SetBrushSize(spawn_npc_size_spin->GetValue()); } -void NpcPalettePanel::SelectTileset(size_t index) -{ +void NpcPalettePanel::SelectTileset(size_t index) { ASSERT(tileset_choice->GetCount() >= index); npc_list->Clear(); - if(tileset_choice->GetCount() == 0) { + if (tileset_choice->GetCount() == 0) { // No tilesets :( npc_brush_button->Enable(false); } else { const TilesetCategory* tsc = reinterpret_cast(tileset_choice->GetClientData(index)); // Select first house - for(BrushVector::const_iterator iter = tsc->brushlist.begin(); - iter != tsc->brushlist.end(); - ++iter) - { + for (BrushVector::const_iterator iter = tsc->brushlist.begin(); + iter != tsc->brushlist.end(); + ++iter) { npc_list->Append(wxstr((*iter)->getName()), *iter); } npc_list->Sort(); @@ -213,22 +201,20 @@ void NpcPalettePanel::SelectTileset(size_t index) } } -void NpcPalettePanel::SelectNpc(size_t index) -{ +void NpcPalettePanel::SelectNpc(size_t index) { // Save the old g_settings ASSERT(npc_list->GetCount() >= index); - if(npc_list->GetCount() > 0) { + if (npc_list->GetCount() > 0) { npc_list->SetSelection(index); } SelectNpcBrush(); } -void NpcPalettePanel::SelectNpc(std::string name) -{ - if(npc_list->GetCount() > 0) { - if(!npc_list->SetStringSelection(wxstr(name))) { +void NpcPalettePanel::SelectNpc(std::string name) { + if (npc_list->GetCount() > 0) { + if (!npc_list->SetStringSelection(wxstr(name))) { npc_list->SetSelection(0); } } @@ -236,9 +222,8 @@ void NpcPalettePanel::SelectNpc(std::string name) SelectNpcBrush(); } -void NpcPalettePanel::SelectNpcBrush() -{ - if(npc_list->GetCount() > 0) { +void NpcPalettePanel::SelectNpcBrush() { + if (npc_list->GetCount() > 0) { npc_brush_button->Enable(true); npc_brush_button->SetValue(true); spawn_npc_brush_button->SetValue(false); @@ -248,50 +233,43 @@ void NpcPalettePanel::SelectNpcBrush() } } -void NpcPalettePanel::SelectSpawnNpcBrush() -{ - //g_gui.house_exit_brush->setHouse(house); +void NpcPalettePanel::SelectSpawnNpcBrush() { + // g_gui.house_exit_brush->setHouse(house); npc_brush_button->SetValue(false); spawn_npc_brush_button->SetValue(true); } -void NpcPalettePanel::OnTilesetChange(wxCommandEvent& event) -{ +void NpcPalettePanel::OnTilesetChange(wxCommandEvent &event) { SelectTileset(event.GetSelection()); g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(); } -void NpcPalettePanel::OnListBoxChange(wxCommandEvent& event) -{ +void NpcPalettePanel::OnListBoxChange(wxCommandEvent &event) { SelectNpc(event.GetSelection()); g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(); } -void NpcPalettePanel::OnClickNpcBrushButton(wxCommandEvent& event) -{ +void NpcPalettePanel::OnClickNpcBrushButton(wxCommandEvent &event) { SelectNpcBrush(); g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(); } -void NpcPalettePanel::OnClickSpawnNpcBrushButton(wxCommandEvent& event) -{ +void NpcPalettePanel::OnClickSpawnNpcBrushButton(wxCommandEvent &event) { SelectSpawnNpcBrush(); g_gui.ActivatePalette(GetParentPalette()); g_gui.SelectBrush(); } -void NpcPalettePanel::OnChangeSpawnNpcTime(wxSpinEvent& event) -{ +void NpcPalettePanel::OnChangeSpawnNpcTime(wxSpinEvent &event) { g_gui.ActivatePalette(GetParentPalette()); g_gui.SetSpawnNpcTime(event.GetPosition()); } -void NpcPalettePanel::OnChangeSpawnNpcSize(wxSpinEvent& event) -{ - if(!handling_event) { +void NpcPalettePanel::OnChangeSpawnNpcSize(wxSpinEvent &event) { + if (!handling_event) { handling_event = true; g_gui.ActivatePalette(GetParentPalette()); g_gui.SetBrushSize(event.GetPosition()); diff --git a/source/palette_npc.h b/source/palette_npc.h index 8209c5af..ee6f690b 100644 --- a/source/palette_npc.h +++ b/source/palette_npc.h @@ -15,7 +15,6 @@ // along with this program. If not, see . ////////////////////////////////////////////////////////////////////// - #ifndef RME_TILESET_NPC_H_ #define RME_TILESET_NPC_H_ @@ -48,15 +47,17 @@ class NpcPalettePanel : public PalettePanel { void SelectTileset(size_t index); void SelectNpc(size_t index); void SelectNpc(std::string name); + public: // Event handling - void OnChangeSpawnNpcTime(wxSpinEvent& event); - void OnChangeSpawnNpcSize(wxSpinEvent& event); + void OnChangeSpawnNpcTime(wxSpinEvent &event); + void OnChangeSpawnNpcSize(wxSpinEvent &event); + + void OnTilesetChange(wxCommandEvent &event); + void OnListBoxChange(wxCommandEvent &event); + void OnClickNpcBrushButton(wxCommandEvent &event); + void OnClickSpawnNpcBrushButton(wxCommandEvent &event); - void OnTilesetChange(wxCommandEvent& event); - void OnListBoxChange(wxCommandEvent& event); - void OnClickNpcBrushButton(wxCommandEvent& event); - void OnClickSpawnNpcBrushButton(wxCommandEvent& event); protected: void SelectNpcBrush(); void SelectSpawnNpcBrush(); diff --git a/source/palette_waypoints.cpp b/source/palette_waypoints.cpp index add1e2e0..59e76073 100644 --- a/source/palette_waypoints.cpp +++ b/source/palette_waypoints.cpp @@ -26,23 +26,20 @@ #include "map.h" BEGIN_EVENT_TABLE(WaypointPalettePanel, PalettePanel) - EVT_BUTTON(PALETTE_WAYPOINT_ADD_WAYPOINT, WaypointPalettePanel::OnClickAddWaypoint) - EVT_BUTTON(PALETTE_WAYPOINT_REMOVE_WAYPOINT, WaypointPalettePanel::OnClickRemoveWaypoint) +EVT_BUTTON(PALETTE_WAYPOINT_ADD_WAYPOINT, WaypointPalettePanel::OnClickAddWaypoint) +EVT_BUTTON(PALETTE_WAYPOINT_REMOVE_WAYPOINT, WaypointPalettePanel::OnClickRemoveWaypoint) - EVT_LIST_BEGIN_LABEL_EDIT(PALETTE_WAYPOINT_LISTBOX, WaypointPalettePanel::OnBeginEditWaypointLabel) - EVT_LIST_END_LABEL_EDIT(PALETTE_WAYPOINT_LISTBOX, WaypointPalettePanel::OnEditWaypointLabel) - EVT_LIST_ITEM_SELECTED(PALETTE_WAYPOINT_LISTBOX, WaypointPalettePanel::OnClickWaypoint) +EVT_LIST_BEGIN_LABEL_EDIT(PALETTE_WAYPOINT_LISTBOX, WaypointPalettePanel::OnBeginEditWaypointLabel) +EVT_LIST_END_LABEL_EDIT(PALETTE_WAYPOINT_LISTBOX, WaypointPalettePanel::OnEditWaypointLabel) +EVT_LIST_ITEM_SELECTED(PALETTE_WAYPOINT_LISTBOX, WaypointPalettePanel::OnClickWaypoint) END_EVENT_TABLE() WaypointPalettePanel::WaypointPalettePanel(wxWindow* parent, wxWindowID id) : PalettePanel(parent, id), - map(nullptr) -{ + map(nullptr) { wxSizer* sidesizer = newd wxStaticBoxSizer(wxVERTICAL, this, "Waypoints"); - waypoint_list = newd wxListCtrl(this, PALETTE_WAYPOINT_LISTBOX, - wxDefaultPosition, wxDefaultSize, - wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_EDIT_LABELS | wxLC_NO_HEADER); + waypoint_list = newd wxListCtrl(this, PALETTE_WAYPOINT_LISTBOX, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_EDIT_LABELS | wxLC_NO_HEADER); waypoint_list->InsertColumn(0, "UNNAMED", wxLIST_FORMAT_LEFT, 200); sidesizer->Add(waypoint_list, 1, wxEXPAND); @@ -54,78 +51,65 @@ WaypointPalettePanel::WaypointPalettePanel(wxWindow* parent, wxWindowID id) : SetSizerAndFit(sidesizer); } -WaypointPalettePanel::~WaypointPalettePanel() -{ +WaypointPalettePanel::~WaypointPalettePanel() { //// } - -void WaypointPalettePanel::OnSwitchIn() -{ +void WaypointPalettePanel::OnSwitchIn() { PalettePanel::OnSwitchIn(); } -void WaypointPalettePanel::OnSwitchOut() -{ +void WaypointPalettePanel::OnSwitchOut() { PalettePanel::OnSwitchOut(); } -void WaypointPalettePanel::SetMap(Map* m) -{ +void WaypointPalettePanel::SetMap(Map* m) { map = m; this->Enable(m && m->getVersion().otbm >= MAP_OTBM_3); } -void WaypointPalettePanel::SelectFirstBrush() -{ - //SelectWaypointBrush(); +void WaypointPalettePanel::SelectFirstBrush() { + // SelectWaypointBrush(); } -Brush* WaypointPalettePanel::GetSelectedBrush() const -{ - long item = waypoint_list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); +Brush* WaypointPalettePanel::GetSelectedBrush() const { + long item = waypoint_list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); g_gui.waypoint_brush->setWaypoint( - item == -1? - nullptr : - map->waypoints.getWaypoint(nstr(waypoint_list->GetItemText(item))) + item == -1 ? nullptr : map->waypoints.getWaypoint(nstr(waypoint_list->GetItemText(item))) ); return g_gui.waypoint_brush; } -bool WaypointPalettePanel::SelectBrush(const Brush* whatbrush) -{ +bool WaypointPalettePanel::SelectBrush(const Brush* whatbrush) { ASSERT(whatbrush == g_gui.waypoint_brush); return false; } -int WaypointPalettePanel::GetSelectedBrushSize() const -{ +int WaypointPalettePanel::GetSelectedBrushSize() const { return 0; } -PaletteType WaypointPalettePanel::GetType() const -{ +PaletteType WaypointPalettePanel::GetType() const { return TILESET_WAYPOINT; } -wxString WaypointPalettePanel::GetName() const -{ +wxString WaypointPalettePanel::GetName() const { return "Waypoint Palette"; } -void WaypointPalettePanel::OnUpdate() -{ - if(wxTextCtrl* tc = waypoint_list->GetEditControl()) { +void WaypointPalettePanel::OnUpdate() { + if (wxTextCtrl* tc = waypoint_list->GetEditControl()) { Waypoint* wp = map->waypoints.getWaypoint(nstr(tc->GetValue())); - if(wp && !wp->pos.isValid()) { - if(map->getTile(wp->pos)) + if (wp && !wp->pos.isValid()) { + if (map->getTile(wp->pos)) { map->getTileL(wp->pos)->decreaseWaypointCount(); + } map->waypoints.removeWaypoint(wp->name); } } waypoint_list->DeleteAllItems(); - if(!map){ + if (!map) { waypoint_list->Enable(false); add_waypoint_button->Enable(false); remove_waypoint_button->Enable(false); @@ -134,54 +118,53 @@ void WaypointPalettePanel::OnUpdate() add_waypoint_button->Enable(true); remove_waypoint_button->Enable(true); - Waypoints& waypoints = map->waypoints; + Waypoints &waypoints = map->waypoints; - for(WaypointMap::const_iterator iter = waypoints.begin(); iter != waypoints.end(); ++iter) { + for (WaypointMap::const_iterator iter = waypoints.begin(); iter != waypoints.end(); ++iter) { waypoint_list->InsertItem(0, wxstr(iter->second->name)); } } } -void WaypointPalettePanel::OnClickWaypoint(wxListEvent& event) -{ - if(!map) +void WaypointPalettePanel::OnClickWaypoint(wxListEvent &event) { + if (!map) { return; + } std::string wpname = nstr(event.GetText()); Waypoint* wp = map->waypoints.getWaypoint(wpname); - if(wp) { + if (wp) { g_gui.SetScreenCenterPosition(wp->pos); g_gui.waypoint_brush->setWaypoint(wp); } } -void WaypointPalettePanel::OnBeginEditWaypointLabel(wxListEvent& event) -{ +void WaypointPalettePanel::OnBeginEditWaypointLabel(wxListEvent &event) { // We need to disable all hotkeys, so we can type properly g_gui.DisableHotkeys(); } -void WaypointPalettePanel::OnEditWaypointLabel(wxListEvent& event) -{ +void WaypointPalettePanel::OnEditWaypointLabel(wxListEvent &event) { std::string wpname = nstr(event.GetLabel()); std::string oldwpname = nstr(waypoint_list->GetItemText(event.GetIndex())); Waypoint* wp = map->waypoints.getWaypoint(oldwpname); - if(event.IsEditCancelled()) + if (event.IsEditCancelled()) { return; + } - if(wpname == "") { + if (wpname == "") { map->waypoints.removeWaypoint(oldwpname); g_gui.RefreshPalettes(); - } else if(wp) { - if(wpname == oldwpname) { + } else if (wp) { + if (wpname == oldwpname) { ; // do nothing } else { - if(map->waypoints.getWaypoint(wpname)) { + if (map->waypoints.getWaypoint(wpname)) { // Already exists a waypoint with this name! g_gui.SetStatusText("There already is a waypoint with this name."); event.Veto(); - if(oldwpname == "") { + if (oldwpname == "") { map->waypoints.removeWaypoint(oldwpname); g_gui.RefreshPalettes(); } @@ -190,9 +173,10 @@ void WaypointPalettePanel::OnEditWaypointLabel(wxListEvent& event) nwp->name = wpname; Waypoint* rwp = map->waypoints.getWaypoint(oldwpname); - if(rwp) { - if(map->getTile(rwp->pos)) + if (rwp) { + if (map->getTile(rwp->pos)) { map->getTileL(rwp->pos)->decreaseWaypointCount(); + } map->waypoints.removeWaypoint(rwp->name); } @@ -205,32 +189,33 @@ void WaypointPalettePanel::OnEditWaypointLabel(wxListEvent& event) } } - if(event.IsAllowed()) + if (event.IsAllowed()) { g_gui.EnableHotkeys(); + } } -void WaypointPalettePanel::OnClickAddWaypoint(wxCommandEvent& event) -{ - if(map) { +void WaypointPalettePanel::OnClickAddWaypoint(wxCommandEvent &event) { + if (map) { map->waypoints.addWaypoint(newd Waypoint()); long i = waypoint_list->InsertItem(0, ""); waypoint_list->EditLabel(i); - //g_gui.RefreshPalettes(); + // g_gui.RefreshPalettes(); } } -void WaypointPalettePanel::OnClickRemoveWaypoint(wxCommandEvent& event) -{ - if(!map) +void WaypointPalettePanel::OnClickRemoveWaypoint(wxCommandEvent &event) { + if (!map) { return; + } - long item = waypoint_list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - if(item != -1) { + long item = waypoint_list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); + if (item != -1) { Waypoint* wp = map->waypoints.getWaypoint(nstr(waypoint_list->GetItemText(item))); - if(wp) { - if(map->getTile(wp->pos)) + if (wp) { + if (map->getTile(wp->pos)) { map->getTileL(wp->pos)->decreaseWaypointCount(); + } map->waypoints.removeWaypoint(wp->name); } waypoint_list->DeleteItem(item); diff --git a/source/palette_waypoints.h b/source/palette_waypoints.h index eb08ef25..b4c6897c 100644 --- a/source/palette_waypoints.h +++ b/source/palette_waypoints.h @@ -46,15 +46,17 @@ class WaypointPalettePanel : public PalettePanel { void OnSwitchIn(); // Called when this page is hidden void OnSwitchOut(); + public: // wxWidgets event handling - void OnClickWaypoint(wxListEvent& event); - void OnBeginEditWaypointLabel(wxListEvent& event); - void OnEditWaypointLabel(wxListEvent& event); - void OnClickAddWaypoint(wxCommandEvent& event); - void OnClickRemoveWaypoint(wxCommandEvent& event); + void OnClickWaypoint(wxListEvent &event); + void OnBeginEditWaypointLabel(wxListEvent &event); + void OnEditWaypointLabel(wxListEvent &event); + void OnClickAddWaypoint(wxCommandEvent &event); + void OnClickRemoveWaypoint(wxCommandEvent &event); void SetMap(Map* map); + protected: Map* map; wxListCtrl* waypoint_list; diff --git a/source/palette_window.cpp b/source/palette_window.cpp index f746717f..2a84cf0b 100644 --- a/source/palette_window.cpp +++ b/source/palette_window.cpp @@ -36,14 +36,14 @@ // Palette window BEGIN_EVENT_TABLE(PaletteWindow, wxPanel) - EVT_CHOICEBOOK_PAGE_CHANGING(PALETTE_CHOICEBOOK, PaletteWindow::OnSwitchingPage) - EVT_CHOICEBOOK_PAGE_CHANGED(PALETTE_CHOICEBOOK, PaletteWindow::OnPageChanged) - EVT_CLOSE(PaletteWindow::OnClose) +EVT_CHOICEBOOK_PAGE_CHANGING(PALETTE_CHOICEBOOK, PaletteWindow::OnSwitchingPage) +EVT_CHOICEBOOK_PAGE_CHANGED(PALETTE_CHOICEBOOK, PaletteWindow::OnPageChanged) +EVT_CLOSE(PaletteWindow::OnClose) - EVT_KEY_DOWN(PaletteWindow::OnKey) +EVT_KEY_DOWN(PaletteWindow::OnKey) END_EVENT_TABLE() -PaletteWindow::PaletteWindow(wxWindow* parent, const TilesetContainer& tilesets) : +PaletteWindow::PaletteWindow(wxWindow* parent, const TilesetContainer &tilesets) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(230, 250)), choicebook(nullptr), terrain_palette(nullptr), @@ -53,8 +53,7 @@ PaletteWindow::PaletteWindow(wxWindow* parent, const TilesetContainer& tilesets) npc_palette(nullptr), house_palette(nullptr), waypoint_palette(nullptr), - raw_palette(nullptr) -{ + raw_palette(nullptr) { SetMinSize(wxSize(225, 250)); // Create choicebook @@ -96,13 +95,11 @@ PaletteWindow::PaletteWindow(wxWindow* parent, const TilesetContainer& tilesets) Fit(); } -PaletteWindow::~PaletteWindow() -{ +PaletteWindow::~PaletteWindow() { //// } -PalettePanel* PaletteWindow::CreateTerrainPalette(wxWindow *parent, const TilesetContainer& tilesets) -{ +PalettePanel* PaletteWindow::CreateTerrainPalette(wxWindow* parent, const TilesetContainer &tilesets) { BrushPalettePanel* panel = newd BrushPalettePanel(parent, tilesets, TILESET_TERRAIN); panel->SetListType(wxstr(g_settings.getString(Config::PALETTE_TERRAIN_STYLE))); @@ -117,8 +114,7 @@ PalettePanel* PaletteWindow::CreateTerrainPalette(wxWindow *parent, const Tilese return panel; } -PalettePanel* PaletteWindow::CreateDoodadPalette(wxWindow *parent, const TilesetContainer& tilesets) -{ +PalettePanel* PaletteWindow::CreateDoodadPalette(wxWindow* parent, const TilesetContainer &tilesets) { BrushPalettePanel* panel = newd BrushPalettePanel(parent, tilesets, TILESET_DOODAD); panel->SetListType(wxstr(g_settings.getString(Config::PALETTE_DOODAD_STYLE))); @@ -131,8 +127,7 @@ PalettePanel* PaletteWindow::CreateDoodadPalette(wxWindow *parent, const Tileset return panel; } -PalettePanel* PaletteWindow::CreateItemPalette(wxWindow *parent, const TilesetContainer& tilesets) -{ +PalettePanel* PaletteWindow::CreateItemPalette(wxWindow* parent, const TilesetContainer &tilesets) { BrushPalettePanel* panel = newd BrushPalettePanel(parent, tilesets, TILESET_ITEM); panel->SetListType(wxstr(g_settings.getString(Config::PALETTE_ITEM_STYLE))); @@ -142,8 +137,7 @@ PalettePanel* PaletteWindow::CreateItemPalette(wxWindow *parent, const TilesetCo return panel; } -PalettePanel* PaletteWindow::CreateHousePalette(wxWindow *parent, const TilesetContainer& tilesets) -{ +PalettePanel* PaletteWindow::CreateHousePalette(wxWindow* parent, const TilesetContainer &tilesets) { HousePalettePanel* panel = newd HousePalettePanel(parent); BrushSizePanel* size_panel = newd BrushSizePanel(panel); @@ -152,26 +146,22 @@ PalettePanel* PaletteWindow::CreateHousePalette(wxWindow *parent, const TilesetC return panel; } -PalettePanel* PaletteWindow::CreateWaypointPalette(wxWindow *parent, const TilesetContainer& tilesets) -{ +PalettePanel* PaletteWindow::CreateWaypointPalette(wxWindow* parent, const TilesetContainer &tilesets) { WaypointPalettePanel* panel = newd WaypointPalettePanel(parent); return panel; } -PalettePanel* PaletteWindow::CreateMonsterPalette(wxWindow *parent, const TilesetContainer& tilesets) -{ +PalettePanel* PaletteWindow::CreateMonsterPalette(wxWindow* parent, const TilesetContainer &tilesets) { MonsterPalettePanel* panel = newd MonsterPalettePanel(parent); return panel; } -PalettePanel* PaletteWindow::CreateNpcPalette(wxWindow *parent, const TilesetContainer& tilesets) -{ +PalettePanel* PaletteWindow::CreateNpcPalette(wxWindow* parent, const TilesetContainer &tilesets) { NpcPalettePanel* panel = newd NpcPalettePanel(parent); return panel; } -PalettePanel* PaletteWindow::CreateRAWPalette(wxWindow *parent, const TilesetContainer& tilesets) -{ +PalettePanel* PaletteWindow::CreateRAWPalette(wxWindow* parent, const TilesetContainer &tilesets) { BrushPalettePanel* panel = newd BrushPalettePanel(parent, tilesets, TILESET_RAW); panel->SetListType(wxstr(g_settings.getString(Config::PALETTE_RAW_STYLE))); @@ -182,37 +172,37 @@ PalettePanel* PaletteWindow::CreateRAWPalette(wxWindow *parent, const TilesetCon return panel; } -void PaletteWindow::ReloadSettings(Map* map) -{ - if(terrain_palette) { +void PaletteWindow::ReloadSettings(Map* map) { + if (terrain_palette) { terrain_palette->SetListType(wxstr(g_settings.getString(Config::PALETTE_TERRAIN_STYLE))); terrain_palette->SetToolbarIconSize(g_settings.getBoolean(Config::USE_LARGE_TERRAIN_TOOLBAR)); } - if(doodad_palette) { + if (doodad_palette) { doodad_palette->SetListType(wxstr(g_settings.getString(Config::PALETTE_DOODAD_STYLE))); doodad_palette->SetToolbarIconSize(g_settings.getBoolean(Config::USE_LARGE_DOODAD_SIZEBAR)); } - if(house_palette) { + if (house_palette) { house_palette->SetMap(map); house_palette->SetToolbarIconSize(g_settings.getBoolean(Config::USE_LARGE_HOUSE_SIZEBAR)); } - if(waypoint_palette) { + if (waypoint_palette) { waypoint_palette->SetMap(map); } - if(item_palette) { + if (item_palette) { item_palette->SetListType(wxstr(g_settings.getString(Config::PALETTE_ITEM_STYLE))); item_palette->SetToolbarIconSize(g_settings.getBoolean(Config::USE_LARGE_ITEM_SIZEBAR)); } - if(raw_palette) { + if (raw_palette) { raw_palette->SetListType(wxstr(g_settings.getString(Config::PALETTE_RAW_STYLE))); raw_palette->SetToolbarIconSize(g_settings.getBoolean(Config::USE_LARGE_RAW_SIZEBAR)); } InvalidateContents(); } -void PaletteWindow::LoadCurrentContents() -{ - if(!choicebook) return; +void PaletteWindow::LoadCurrentContents() { + if (!choicebook) { + return; + } PalettePanel* panel = dynamic_cast(choicebook->GetCurrentPage()); panel->LoadCurrentContents(); Fit(); @@ -220,114 +210,119 @@ void PaletteWindow::LoadCurrentContents() Update(); } -void PaletteWindow::InvalidateContents() -{ - if(!choicebook) return; - for(size_t iz = 0; iz < choicebook->GetPageCount(); ++iz) { +void PaletteWindow::InvalidateContents() { + if (!choicebook) { + return; + } + for (size_t iz = 0; iz < choicebook->GetPageCount(); ++iz) { PalettePanel* panel = dynamic_cast(choicebook->GetPage(iz)); panel->InvalidateContents(); } LoadCurrentContents(); - if(monster_palette) { + if (monster_palette) { monster_palette->OnUpdate(); } - if(npc_palette) { + if (npc_palette) { npc_palette->OnUpdate(); } - if(house_palette) { + if (house_palette) { house_palette->OnUpdate(); } - if(waypoint_palette) { + if (waypoint_palette) { waypoint_palette->OnUpdate(); } } -void PaletteWindow::SelectPage(PaletteType id) -{ - if(!choicebook) return; - if(id == GetSelectedPage()) { +void PaletteWindow::SelectPage(PaletteType id) { + if (!choicebook) { + return; + } + if (id == GetSelectedPage()) { return; } - for(size_t iz = 0; iz < choicebook->GetPageCount(); ++iz) { + for (size_t iz = 0; iz < choicebook->GetPageCount(); ++iz) { PalettePanel* panel = dynamic_cast(choicebook->GetPage(iz)); - if(panel->GetType() == id) { + if (panel->GetType() == id) { choicebook->SetSelection(iz); - //LoadCurrentContents(); + // LoadCurrentContents(); break; } } } -Brush* PaletteWindow::GetSelectedBrush() const -{ - if(!choicebook) return nullptr; +Brush* PaletteWindow::GetSelectedBrush() const { + if (!choicebook) { + return nullptr; + } PalettePanel* panel = dynamic_cast(choicebook->GetCurrentPage()); return panel->GetSelectedBrush(); } -int PaletteWindow::GetSelectedBrushSize() const -{ - if(!choicebook) return 0; +int PaletteWindow::GetSelectedBrushSize() const { + if (!choicebook) { + return 0; + } PalettePanel* panel = dynamic_cast(choicebook->GetCurrentPage()); return panel->GetSelectedBrushSize(); } -PaletteType PaletteWindow::GetSelectedPage() const -{ - if(!choicebook) return TILESET_UNKNOWN; +PaletteType PaletteWindow::GetSelectedPage() const { + if (!choicebook) { + return TILESET_UNKNOWN; + } PalettePanel* panel = dynamic_cast(choicebook->GetCurrentPage()); ASSERT(panel); return panel->GetType(); } -bool PaletteWindow::OnSelectBrush(const Brush* whatbrush, PaletteType primary) -{ - if(!choicebook || !whatbrush) +bool PaletteWindow::OnSelectBrush(const Brush* whatbrush, PaletteType primary) { + if (!choicebook || !whatbrush) { return false; + } - if(whatbrush->isHouse() && house_palette) { + if (whatbrush->isHouse() && house_palette) { house_palette->SelectBrush(whatbrush); SelectPage(TILESET_HOUSE); return true; } - switch(primary) { + switch (primary) { case TILESET_TERRAIN: { // This is already searched first break; } case TILESET_DOODAD: { // Ok, search doodad before terrain - if(doodad_palette && doodad_palette->SelectBrush(whatbrush)) { + if (doodad_palette && doodad_palette->SelectBrush(whatbrush)) { SelectPage(TILESET_DOODAD); return true; } break; } case TILESET_ITEM: { - if(item_palette && item_palette->SelectBrush(whatbrush)) { + if (item_palette && item_palette->SelectBrush(whatbrush)) { SelectPage(TILESET_ITEM); return true; } break; } case TILESET_MONSTER: { - if(monster_palette && monster_palette->SelectBrush(whatbrush)) { + if (monster_palette && monster_palette->SelectBrush(whatbrush)) { SelectPage(TILESET_MONSTER); return true; } break; } case TILESET_NPC: { - if(npc_palette && npc_palette->SelectBrush(whatbrush)) { + if (npc_palette && npc_palette->SelectBrush(whatbrush)) { SelectPage(TILESET_NPC); return true; } break; } case TILESET_RAW: { - if(raw_palette && raw_palette->SelectBrush(whatbrush)) { + if (raw_palette && raw_palette->SelectBrush(whatbrush)) { SelectPage(TILESET_RAW); return true; } @@ -338,46 +333,46 @@ bool PaletteWindow::OnSelectBrush(const Brush* whatbrush, PaletteType primary) } // Test if it's a terrain brush - if(terrain_palette && terrain_palette->SelectBrush(whatbrush)) { + if (terrain_palette && terrain_palette->SelectBrush(whatbrush)) { SelectPage(TILESET_TERRAIN); return true; } // Test if it's a doodad brush - if(primary != TILESET_DOODAD) { - if(doodad_palette && doodad_palette->SelectBrush(whatbrush)) { + if (primary != TILESET_DOODAD) { + if (doodad_palette && doodad_palette->SelectBrush(whatbrush)) { SelectPage(TILESET_DOODAD); return true; } } // Test if it's an item brush - if(primary != TILESET_ITEM) { - if(item_palette && item_palette->SelectBrush(whatbrush)) { + if (primary != TILESET_ITEM) { + if (item_palette && item_palette->SelectBrush(whatbrush)) { SelectPage(TILESET_ITEM); return true; } } // Test if it's a monster brush - if(primary != TILESET_MONSTER) { - if(monster_palette && monster_palette->SelectBrush(whatbrush)) { + if (primary != TILESET_MONSTER) { + if (monster_palette && monster_palette->SelectBrush(whatbrush)) { SelectPage(TILESET_MONSTER); return true; } } // Test if it's a npc brush - if(primary != TILESET_NPC) { - if(npc_palette && npc_palette->SelectBrush(whatbrush)) { + if (primary != TILESET_NPC) { + if (npc_palette && npc_palette->SelectBrush(whatbrush)) { SelectPage(TILESET_NPC); return true; } } // Test if it's a raw brush - if(primary != TILESET_RAW) { - if(raw_palette && raw_palette->SelectBrush(whatbrush)) { + if (primary != TILESET_RAW) { + if (raw_palette && raw_palette->SelectBrush(whatbrush)) { SelectPage(TILESET_RAW); return true; } @@ -386,65 +381,65 @@ bool PaletteWindow::OnSelectBrush(const Brush* whatbrush, PaletteType primary) return false; } -void PaletteWindow::OnSwitchingPage(wxChoicebookEvent& event) -{ +void PaletteWindow::OnSwitchingPage(wxChoicebookEvent &event) { event.Skip(); - if(!choicebook) return; + if (!choicebook) { + return; + } wxWindow* old_page = choicebook->GetPage(choicebook->GetSelection()); PalettePanel* old_panel = dynamic_cast(old_page); - if(old_panel) { + if (old_panel) { old_panel->OnSwitchOut(); } wxWindow* page = choicebook->GetPage(event.GetSelection()); PalettePanel* panel = dynamic_cast(page); - if(panel) { + if (panel) { panel->OnSwitchIn(); } } -void PaletteWindow::OnPageChanged(wxChoicebookEvent& event) -{ - if(!choicebook) return; +void PaletteWindow::OnPageChanged(wxChoicebookEvent &event) { + if (!choicebook) { + return; + } g_gui.SelectBrush(); } -void PaletteWindow::OnUpdateBrushSize(BrushShape shape, int size) -{ - if(!choicebook) return; +void PaletteWindow::OnUpdateBrushSize(BrushShape shape, int size) { + if (!choicebook) { + return; + } PalettePanel* page = dynamic_cast(choicebook->GetCurrentPage()); ASSERT(page); page->OnUpdateBrushSize(shape, size); } -void PaletteWindow::OnUpdate(Map* map) -{ - if(monster_palette) { +void PaletteWindow::OnUpdate(Map* map) { + if (monster_palette) { monster_palette->OnUpdate(); } - if(npc_palette) { + if (npc_palette) { npc_palette->OnUpdate(); } - if(house_palette) { + if (house_palette) { house_palette->SetMap(map); } - if(waypoint_palette) { + if (waypoint_palette) { waypoint_palette->SetMap(map); waypoint_palette->OnUpdate(); } } -void PaletteWindow::OnKey(wxKeyEvent& event) -{ - if(g_gui.GetCurrentTab() != nullptr) { +void PaletteWindow::OnKey(wxKeyEvent &event) { + if (g_gui.GetCurrentTab() != nullptr) { g_gui.GetCurrentMapTab()->GetEventHandler()->AddPendingEvent(event); } } -void PaletteWindow::OnClose(wxCloseEvent& event) -{ - if(!event.CanVeto()) { +void PaletteWindow::OnClose(wxCloseEvent &event) { + if (!event.CanVeto()) { // We can't do anything! This sucks! // (application is closed, we have to destroy ourselves) Destroy(); diff --git a/source/palette_window.h b/source/palette_window.h index 5a233e04..8401b042 100644 --- a/source/palette_window.h +++ b/source/palette_window.h @@ -26,10 +26,9 @@ class NpcPalettePanel; class HousePalettePanel; class WaypointPalettePanel; -class PaletteWindow : public wxPanel -{ +class PaletteWindow : public wxPanel { public: - PaletteWindow(wxWindow* parent, const TilesetContainer& tilesets); + PaletteWindow(wxWindow* parent, const TilesetContainer &tilesets); ~PaletteWindow(); // Interface @@ -58,21 +57,21 @@ class PaletteWindow : public wxPanel virtual void OnUpdate(Map* map); // wxWidgets Event Handlers - void OnSwitchingPage(wxChoicebookEvent& event); - void OnPageChanged(wxChoicebookEvent& event); + void OnSwitchingPage(wxChoicebookEvent &event); + void OnPageChanged(wxChoicebookEvent &event); // Forward key events to the parent window (The Map Window) - void OnKey(wxKeyEvent& event); - void OnClose(wxCloseEvent&); + void OnKey(wxKeyEvent &event); + void OnClose(wxCloseEvent &); protected: - static PalettePanel* CreateTerrainPalette(wxWindow* parent, const TilesetContainer& tilesets); - static PalettePanel* CreateDoodadPalette(wxWindow* parent, const TilesetContainer& tilesets); - static PalettePanel* CreateItemPalette(wxWindow* parent, const TilesetContainer& tilesets); - static PalettePanel* CreateMonsterPalette(wxWindow* parent, const TilesetContainer& tilesets); - static PalettePanel* CreateNpcPalette(wxWindow* parent, const TilesetContainer& tilesets); - static PalettePanel* CreateHousePalette(wxWindow* parent, const TilesetContainer& tilesets); - static PalettePanel* CreateWaypointPalette(wxWindow* parent, const TilesetContainer& tilesets); - static PalettePanel* CreateRAWPalette(wxWindow* parent, const TilesetContainer& tilesets); + static PalettePanel* CreateTerrainPalette(wxWindow* parent, const TilesetContainer &tilesets); + static PalettePanel* CreateDoodadPalette(wxWindow* parent, const TilesetContainer &tilesets); + static PalettePanel* CreateItemPalette(wxWindow* parent, const TilesetContainer &tilesets); + static PalettePanel* CreateMonsterPalette(wxWindow* parent, const TilesetContainer &tilesets); + static PalettePanel* CreateNpcPalette(wxWindow* parent, const TilesetContainer &tilesets); + static PalettePanel* CreateHousePalette(wxWindow* parent, const TilesetContainer &tilesets); + static PalettePanel* CreateWaypointPalette(wxWindow* parent, const TilesetContainer &tilesets); + static PalettePanel* CreateRAWPalette(wxWindow* parent, const TilesetContainer &tilesets); wxChoicebook* choicebook; diff --git a/source/pngfiles.cpp b/source/pngfiles.cpp index 81c17503..940d7a54 100644 --- a/source/pngfiles.cpp +++ b/source/pngfiles.cpp @@ -19,4555 +19,4598 @@ /* circular_1.png - 453 bytes */ unsigned char circular_1_png[453] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x21, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd5, - 0xbd, 0x4a, 0x43, 0x31, 0x18, 0xc6, 0xf1, 0xbf, - 0x1f, 0x58, 0xc1, 0xea, 0x72, 0x50, 0x5a, 0x15, - 0x4a, 0x11, 0x75, 0x12, 0x0e, 0xae, 0xe2, 0x70, - 0x50, 0x7a, 0x01, 0x22, 0x48, 0x71, 0x13, 0x39, - 0xf7, 0x20, 0x0a, 0x42, 0x9d, 0xf4, 0x0e, 0x12, - 0x27, 0x41, 0x10, 0xf1, 0x12, 0xea, 0xa2, 0x74, - 0x76, 0x12, 0x71, 0xd2, 0xa1, 0x68, 0xa7, 0x43, - 0xa5, 0x14, 0x6d, 0xd5, 0x26, 0x0e, 0x4a, 0x75, - 0xb4, 0x11, 0x4e, 0xa8, 0x24, 0x90, 0x21, 0xcb, - 0xfb, 0xfe, 0x78, 0xf2, 0xd5, 0x23, 0x84, 0xd0, - 0x58, 0x1c, 0xfd, 0x00, 0x61, 0x18, 0x5a, 0x69, - 0x2e, 0xa5, 0xfc, 0x04, 0x00, 0x44, 0x51, 0x14, - 0x6b, 0x73, 0xcf, 0xf3, 0x00, 0xbe, 0x01, 0x5a, - 0xdb, 0xd9, 0x09, 0x07, 0x70, 0x80, 0x36, 0x40, - 0x29, 0x65, 0x17, 0x60, 0x3d, 0x01, 0x07, 0xe8, - 0x3a, 0x40, 0xf5, 0xa5, 0xc9, 0xd9, 0x75, 0x99, - 0x7a, 0xa3, 0x45, 0xde, 0xcf, 0x90, 0x1e, 0x1e, - 0x8c, 0x0f, 0xf0, 0xd4, 0x78, 0x65, 0xbf, 0x74, - 0xcf, 0xc1, 0xca, 0x02, 0x4a, 0x6b, 0xc2, 0xe3, - 0x4b, 0x76, 0x83, 0x29, 0xc6, 0x47, 0x3a, 0x47, - 0xf4, 0xfe, 0x04, 0xfc, 0x76, 0x1e, 0x5d, 0xdd, - 0x21, 0xd6, 0x03, 0xaa, 0xcf, 0x15, 0x6e, 0x1e, - 0x1f, 0x38, 0xd9, 0x5c, 0xa6, 0x70, 0x7e, 0xdb, - 0x51, 0x8d, 0x3f, 0x25, 0x50, 0x6f, 0xb6, 0xd0, - 0x40, 0xa5, 0xf6, 0xce, 0x9b, 0xea, 0xfb, 0x2a, - 0x60, 0x76, 0x8e, 0x8c, 0x12, 0xd8, 0x98, 0xcf, - 0xb2, 0x76, 0x58, 0x64, 0x66, 0x6c, 0x92, 0xb9, - 0x89, 0x34, 0xab, 0xa2, 0xc8, 0xce, 0xd2, 0x74, - 0x7c, 0x09, 0x8c, 0x0e, 0x0d, 0xb0, 0xbd, 0x98, - 0x61, 0xeb, 0xf4, 0x02, 0x80, 0x42, 0x90, 0x25, - 0x95, 0x4c, 0x18, 0x25, 0x60, 0x7c, 0x0b, 0x52, - 0xc9, 0x04, 0x7b, 0xb9, 0xd9, 0xf6, 0xda, 0xf4, - 0x1a, 0x77, 0xef, 0x3b, 0xf0, 0xff, 0x00, 0xee, - 0x3b, 0x76, 0x00, 0x07, 0xb0, 0x0e, 0xf0, 0x7d, - 0xdf, 0x1e, 0x40, 0x4a, 0x69, 0xa5, 0x39, 0xc0, - 0x07, 0xe5, 0xb8, 0x18, 0x91, 0xbb, 0x1d, 0x22, - 0xdd, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, - 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x21, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd5, + 0xbd, 0x4a, 0x43, 0x31, 0x18, 0xc6, 0xf1, 0xbf, + 0x1f, 0x58, 0xc1, 0xea, 0x72, 0x50, 0x5a, 0x15, + 0x4a, 0x11, 0x75, 0x12, 0x0e, 0xae, 0xe2, 0x70, + 0x50, 0x7a, 0x01, 0x22, 0x48, 0x71, 0x13, 0x39, + 0xf7, 0x20, 0x0a, 0x42, 0x9d, 0xf4, 0x0e, 0x12, + 0x27, 0x41, 0x10, 0xf1, 0x12, 0xea, 0xa2, 0x74, + 0x76, 0x12, 0x71, 0xd2, 0xa1, 0x68, 0xa7, 0x43, + 0xa5, 0x14, 0x6d, 0xd5, 0x26, 0x0e, 0x4a, 0x75, + 0xb4, 0x11, 0x4e, 0xa8, 0x24, 0x90, 0x21, 0xcb, + 0xfb, 0xfe, 0x78, 0xf2, 0xd5, 0x23, 0x84, 0xd0, + 0x58, 0x1c, 0xfd, 0x00, 0x61, 0x18, 0x5a, 0x69, + 0x2e, 0xa5, 0xfc, 0x04, 0x00, 0x44, 0x51, 0x14, + 0x6b, 0x73, 0xcf, 0xf3, 0x00, 0xbe, 0x01, 0x5a, + 0xdb, 0xd9, 0x09, 0x07, 0x70, 0x80, 0x36, 0x40, + 0x29, 0x65, 0x17, 0x60, 0x3d, 0x01, 0x07, 0xe8, + 0x3a, 0x40, 0xf5, 0xa5, 0xc9, 0xd9, 0x75, 0x99, + 0x7a, 0xa3, 0x45, 0xde, 0xcf, 0x90, 0x1e, 0x1e, + 0x8c, 0x0f, 0xf0, 0xd4, 0x78, 0x65, 0xbf, 0x74, + 0xcf, 0xc1, 0xca, 0x02, 0x4a, 0x6b, 0xc2, 0xe3, + 0x4b, 0x76, 0x83, 0x29, 0xc6, 0x47, 0x3a, 0x47, + 0xf4, 0xfe, 0x04, 0xfc, 0x76, 0x1e, 0x5d, 0xdd, + 0x21, 0xd6, 0x03, 0xaa, 0xcf, 0x15, 0x6e, 0x1e, + 0x1f, 0x38, 0xd9, 0x5c, 0xa6, 0x70, 0x7e, 0xdb, + 0x51, 0x8d, 0x3f, 0x25, 0x50, 0x6f, 0xb6, 0xd0, + 0x40, 0xa5, 0xf6, 0xce, 0x9b, 0xea, 0xfb, 0x2a, + 0x60, 0x76, 0x8e, 0x8c, 0x12, 0xd8, 0x98, 0xcf, + 0xb2, 0x76, 0x58, 0x64, 0x66, 0x6c, 0x92, 0xb9, + 0x89, 0x34, 0xab, 0xa2, 0xc8, 0xce, 0xd2, 0x74, + 0x7c, 0x09, 0x8c, 0x0e, 0x0d, 0xb0, 0xbd, 0x98, + 0x61, 0xeb, 0xf4, 0x02, 0x80, 0x42, 0x90, 0x25, + 0x95, 0x4c, 0x18, 0x25, 0x60, 0x7c, 0x0b, 0x52, + 0xc9, 0x04, 0x7b, 0xb9, 0xd9, 0xf6, 0xda, 0xf4, + 0x1a, 0x77, 0xef, 0x3b, 0xf0, 0xff, 0x00, 0xee, + 0x3b, 0x76, 0x00, 0x07, 0xb0, 0x0e, 0xf0, 0x7d, + 0xdf, 0x1e, 0x40, 0x4a, 0x69, 0xa5, 0x39, 0xc0, + 0x07, 0xe5, 0xb8, 0x18, 0x91, 0xbb, 0x1d, 0x22, + 0xdd, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, + 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* circular_1_small.png - 253 bytes */ unsigned char circular_1_small_png[253] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, - 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, - 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, - 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, - 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, - 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0x59, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x9c, - 0x39, 0x73, 0xe6, 0x7f, 0x06, 0x0a, 0x00, 0x0b, - 0x03, 0x03, 0x03, 0x43, 0x70, 0x70, 0x30, 0x59, - 0x9a, 0xd7, 0xae, 0x5d, 0x0b, 0x31, 0xe0, 0xdf, - 0xbf, 0x7f, 0x94, 0xb9, 0x80, 0x62, 0x03, 0xfe, - 0xfe, 0xfd, 0x3b, 0xc0, 0x2e, 0xa0, 0x99, 0x01, - 0x9a, 0xdd, 0x7b, 0x18, 0x18, 0x18, 0x18, 0x18, - 0xae, 0x97, 0xba, 0x90, 0xef, 0x02, 0x11, 0x5e, - 0x16, 0xbc, 0xf2, 0x78, 0x0d, 0xb8, 0x5c, 0xe8, - 0xc0, 0x40, 0xc8, 0x82, 0x41, 0x12, 0x88, 0xc3, - 0x20, 0x1d, 0x9c, 0x3c, 0x79, 0x92, 0x6c, 0x03, - 0x00, 0xa3, 0x52, 0x39, 0xac, 0x3e, 0x62, 0xc6, - 0xf9, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, - 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, + 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, + 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, + 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, + 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0x59, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x9c, + 0x39, 0x73, 0xe6, 0x7f, 0x06, 0x0a, 0x00, 0x0b, + 0x03, 0x03, 0x03, 0x43, 0x70, 0x70, 0x30, 0x59, + 0x9a, 0xd7, 0xae, 0x5d, 0x0b, 0x31, 0xe0, 0xdf, + 0xbf, 0x7f, 0x94, 0xb9, 0x80, 0x62, 0x03, 0xfe, + 0xfe, 0xfd, 0x3b, 0xc0, 0x2e, 0xa0, 0x99, 0x01, + 0x9a, 0xdd, 0x7b, 0x18, 0x18, 0x18, 0x18, 0x18, + 0xae, 0x97, 0xba, 0x90, 0xef, 0x02, 0x11, 0x5e, + 0x16, 0xbc, 0xf2, 0x78, 0x0d, 0xb8, 0x5c, 0xe8, + 0xc0, 0x40, 0xc8, 0x82, 0x41, 0x12, 0x88, 0xc3, + 0x20, 0x1d, 0x9c, 0x3c, 0x79, 0x92, 0x6c, 0x03, + 0x00, 0xa3, 0x52, 0x39, 0xac, 0x3e, 0x62, 0xc6, + 0xf9, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, + 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* circular_2.png - 643 bytes */ unsigned char circular_2_png[643] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xdf, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd5, - 0x4d, 0x48, 0x14, 0x61, 0x1c, 0xc7, 0xf1, 0xef, - 0x3e, 0xab, 0xd3, 0x98, 0x6f, 0xb0, 0x03, 0x8a, - 0x11, 0xdb, 0x82, 0xc6, 0x86, 0x24, 0x2c, 0x28, - 0x24, 0xbb, 0xe9, 0xf6, 0x72, 0x0f, 0x36, 0x17, - 0x3d, 0x08, 0xd1, 0x69, 0x51, 0xe8, 0xd4, 0x25, - 0xec, 0xe2, 0xa1, 0x20, 0x82, 0xee, 0xb2, 0x73, - 0x0c, 0x15, 0xa4, 0x7c, 0xa9, 0x53, 0x41, 0x05, - 0x5b, 0x86, 0x7b, 0xa9, 0x08, 0x45, 0x57, 0x7a, - 0x27, 0xf7, 0xa0, 0xb1, 0x94, 0xb9, 0x2e, 0x6b, - 0xbb, 0x3d, 0x4f, 0x07, 0xc9, 0xbc, 0xe5, 0x2c, - 0xac, 0x53, 0x30, 0x0f, 0xcc, 0xe1, 0xe1, 0x19, - 0xfe, 0xff, 0x0f, 0xbf, 0x99, 0xe7, 0x79, 0x5c, - 0xf1, 0x78, 0x5c, 0x61, 0xe3, 0xa8, 0x00, 0x88, - 0xc5, 0x62, 0xb6, 0x34, 0x37, 0x4d, 0x73, 0x1b, - 0x00, 0x90, 0xc9, 0x64, 0xf6, 0xb5, 0xb9, 0x61, - 0x18, 0x00, 0x7f, 0x00, 0x4a, 0xd9, 0xf3, 0x25, - 0x1c, 0x80, 0x03, 0xd8, 0x01, 0x48, 0x29, 0xed, - 0x05, 0xd8, 0x9e, 0xc0, 0x7f, 0x07, 0x78, 0xf2, - 0x6e, 0x95, 0xc9, 0xf9, 0x15, 0x50, 0x70, 0xbe, - 0xed, 0x30, 0x67, 0x5b, 0x1a, 0xf7, 0x07, 0xb0, - 0x96, 0xcd, 0xd3, 0x3b, 0x9a, 0x44, 0x08, 0x8d, - 0xc1, 0xb0, 0x1f, 0x80, 0xeb, 0x8f, 0x52, 0x0c, - 0x3f, 0x5c, 0xe4, 0xee, 0x85, 0x4e, 0x1a, 0x6b, - 0xf4, 0xf2, 0x02, 0xfa, 0x46, 0x93, 0x44, 0x3b, - 0x9a, 0xb9, 0x76, 0xee, 0x04, 0x1b, 0xf9, 0x1c, - 0x00, 0x97, 0x4e, 0xb7, 0x31, 0x34, 0x9d, 0x24, - 0x7a, 0x7b, 0x8e, 0xa7, 0x83, 0xa7, 0xca, 0x07, - 0x48, 0x7c, 0xf8, 0x82, 0xcb, 0xad, 0x71, 0x33, - 0x12, 0x64, 0xee, 0xfd, 0x4b, 0xa4, 0xca, 0xb2, - 0x55, 0x54, 0xb8, 0x45, 0x3d, 0xb7, 0xa2, 0x21, - 0xee, 0xbf, 0x5e, 0xe1, 0xf1, 0xdb, 0x55, 0xce, - 0x34, 0x37, 0xec, 0x19, 0x20, 0x76, 0x03, 0xfe, - 0xf6, 0xcc, 0x2c, 0xa4, 0x89, 0x9d, 0xf4, 0xf3, - 0x3d, 0xbf, 0x89, 0x5e, 0x99, 0xe3, 0x68, 0xc3, - 0x01, 0xbc, 0x1e, 0x8d, 0x1f, 0x85, 0x75, 0xbe, - 0xe5, 0x36, 0x19, 0xe8, 0xf6, 0x33, 0xb9, 0x90, - 0xde, 0x53, 0xad, 0x92, 0x12, 0xd8, 0xfd, 0x86, - 0x70, 0x81, 0x56, 0x21, 0x70, 0x0b, 0x89, 0x10, - 0xe0, 0x16, 0x62, 0x7b, 0x5d, 0x59, 0xfb, 0xa1, - 0x2d, 0x25, 0x10, 0x69, 0x6d, 0xc2, 0x7c, 0x96, - 0xa2, 0x4e, 0xaf, 0xa6, 0x28, 0x6b, 0x79, 0xb3, - 0x96, 0x27, 0xfd, 0xb5, 0x40, 0xb5, 0x66, 0x50, - 0xa7, 0x57, 0x11, 0x4f, 0xa4, 0xe8, 0x39, 0x7e, - 0xa8, 0x7c, 0x09, 0x84, 0x8e, 0x18, 0x48, 0xb5, - 0xcc, 0x95, 0xa9, 0xe7, 0xdc, 0x88, 0x04, 0xd9, - 0xd8, 0xca, 0x21, 0xa5, 0xa2, 0x56, 0x3f, 0xc8, - 0xe5, 0x3b, 0xb3, 0x14, 0x65, 0x81, 0x6e, 0x9f, - 0x61, 0x29, 0x01, 0xcb, 0xbb, 0x60, 0xac, 0xb7, - 0x9d, 0xfe, 0x89, 0x17, 0x4c, 0xbd, 0xfa, 0xcc, - 0x40, 0xf8, 0x18, 0x28, 0x18, 0x49, 0xa4, 0xf8, - 0x29, 0x0b, 0x8c, 0xf7, 0xb5, 0x5b, 0x3e, 0x4f, - 0x2c, 0x03, 0x8c, 0xaa, 0x4a, 0x1e, 0x5c, 0xec, - 0x64, 0xf6, 0x53, 0x86, 0x7b, 0x4b, 0x1f, 0x51, - 0x0a, 0xae, 0x86, 0x7d, 0x74, 0xf9, 0x0c, 0x4b, - 0x75, 0x4a, 0x06, 0xfc, 0x1e, 0x21, 0xaf, 0x87, - 0x90, 0xd7, 0xb3, 0x33, 0x2f, 0xf5, 0x28, 0xff, - 0x77, 0xee, 0x02, 0xe7, 0x3a, 0x76, 0x00, 0x0e, - 0xc0, 0x76, 0x40, 0x20, 0x10, 0xb0, 0x0f, 0x60, - 0x9a, 0xa6, 0x2d, 0xcd, 0x01, 0x7e, 0x01, 0x34, - 0xeb, 0x4d, 0x78, 0x50, 0xd7, 0xec, 0x52, 0x00, - 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, - 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xdf, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd5, + 0x4d, 0x48, 0x14, 0x61, 0x1c, 0xc7, 0xf1, 0xef, + 0x3e, 0xab, 0xd3, 0x98, 0x6f, 0xb0, 0x03, 0x8a, + 0x11, 0xdb, 0x82, 0xc6, 0x86, 0x24, 0x2c, 0x28, + 0x24, 0xbb, 0xe9, 0xf6, 0x72, 0x0f, 0x36, 0x17, + 0x3d, 0x08, 0xd1, 0x69, 0x51, 0xe8, 0xd4, 0x25, + 0xec, 0xe2, 0xa1, 0x20, 0x82, 0xee, 0xb2, 0x73, + 0x0c, 0x15, 0xa4, 0x7c, 0xa9, 0x53, 0x41, 0x05, + 0x5b, 0x86, 0x7b, 0xa9, 0x08, 0x45, 0x57, 0x7a, + 0x27, 0xf7, 0xa0, 0xb1, 0x94, 0xb9, 0x2e, 0x6b, + 0xbb, 0x3d, 0x4f, 0x07, 0xc9, 0xbc, 0xe5, 0x2c, + 0xac, 0x53, 0x30, 0x0f, 0xcc, 0xe1, 0xe1, 0x19, + 0xfe, 0xff, 0x0f, 0xbf, 0x99, 0xe7, 0x79, 0x5c, + 0xf1, 0x78, 0x5c, 0x61, 0xe3, 0xa8, 0x00, 0x88, + 0xc5, 0x62, 0xb6, 0x34, 0x37, 0x4d, 0x73, 0x1b, + 0x00, 0x90, 0xc9, 0x64, 0xf6, 0xb5, 0xb9, 0x61, + 0x18, 0x00, 0x7f, 0x00, 0x4a, 0xd9, 0xf3, 0x25, + 0x1c, 0x80, 0x03, 0xd8, 0x01, 0x48, 0x29, 0xed, + 0x05, 0xd8, 0x9e, 0xc0, 0x7f, 0x07, 0x78, 0xf2, + 0x6e, 0x95, 0xc9, 0xf9, 0x15, 0x50, 0x70, 0xbe, + 0xed, 0x30, 0x67, 0x5b, 0x1a, 0xf7, 0x07, 0xb0, + 0x96, 0xcd, 0xd3, 0x3b, 0x9a, 0x44, 0x08, 0x8d, + 0xc1, 0xb0, 0x1f, 0x80, 0xeb, 0x8f, 0x52, 0x0c, + 0x3f, 0x5c, 0xe4, 0xee, 0x85, 0x4e, 0x1a, 0x6b, + 0xf4, 0xf2, 0x02, 0xfa, 0x46, 0x93, 0x44, 0x3b, + 0x9a, 0xb9, 0x76, 0xee, 0x04, 0x1b, 0xf9, 0x1c, + 0x00, 0x97, 0x4e, 0xb7, 0x31, 0x34, 0x9d, 0x24, + 0x7a, 0x7b, 0x8e, 0xa7, 0x83, 0xa7, 0xca, 0x07, + 0x48, 0x7c, 0xf8, 0x82, 0xcb, 0xad, 0x71, 0x33, + 0x12, 0x64, 0xee, 0xfd, 0x4b, 0xa4, 0xca, 0xb2, + 0x55, 0x54, 0xb8, 0x45, 0x3d, 0xb7, 0xa2, 0x21, + 0xee, 0xbf, 0x5e, 0xe1, 0xf1, 0xdb, 0x55, 0xce, + 0x34, 0x37, 0xec, 0x19, 0x20, 0x76, 0x03, 0xfe, + 0xf6, 0xcc, 0x2c, 0xa4, 0x89, 0x9d, 0xf4, 0xf3, + 0x3d, 0xbf, 0x89, 0x5e, 0x99, 0xe3, 0x68, 0xc3, + 0x01, 0xbc, 0x1e, 0x8d, 0x1f, 0x85, 0x75, 0xbe, + 0xe5, 0x36, 0x19, 0xe8, 0xf6, 0x33, 0xb9, 0x90, + 0xde, 0x53, 0xad, 0x92, 0x12, 0xd8, 0xfd, 0x86, + 0x70, 0x81, 0x56, 0x21, 0x70, 0x0b, 0x89, 0x10, + 0xe0, 0x16, 0x62, 0x7b, 0x5d, 0x59, 0xfb, 0xa1, + 0x2d, 0x25, 0x10, 0x69, 0x6d, 0xc2, 0x7c, 0x96, + 0xa2, 0x4e, 0xaf, 0xa6, 0x28, 0x6b, 0x79, 0xb3, + 0x96, 0x27, 0xfd, 0xb5, 0x40, 0xb5, 0x66, 0x50, + 0xa7, 0x57, 0x11, 0x4f, 0xa4, 0xe8, 0x39, 0x7e, + 0xa8, 0x7c, 0x09, 0x84, 0x8e, 0x18, 0x48, 0xb5, + 0xcc, 0x95, 0xa9, 0xe7, 0xdc, 0x88, 0x04, 0xd9, + 0xd8, 0xca, 0x21, 0xa5, 0xa2, 0x56, 0x3f, 0xc8, + 0xe5, 0x3b, 0xb3, 0x14, 0x65, 0x81, 0x6e, 0x9f, + 0x61, 0x29, 0x01, 0xcb, 0xbb, 0x60, 0xac, 0xb7, + 0x9d, 0xfe, 0x89, 0x17, 0x4c, 0xbd, 0xfa, 0xcc, + 0x40, 0xf8, 0x18, 0x28, 0x18, 0x49, 0xa4, 0xf8, + 0x29, 0x0b, 0x8c, 0xf7, 0xb5, 0x5b, 0x3e, 0x4f, + 0x2c, 0x03, 0x8c, 0xaa, 0x4a, 0x1e, 0x5c, 0xec, + 0x64, 0xf6, 0x53, 0x86, 0x7b, 0x4b, 0x1f, 0x51, + 0x0a, 0xae, 0x86, 0x7d, 0x74, 0xf9, 0x0c, 0x4b, + 0x75, 0x4a, 0x06, 0xfc, 0x1e, 0x21, 0xaf, 0x87, + 0x90, 0xd7, 0xb3, 0x33, 0x2f, 0xf5, 0x28, 0xff, + 0x77, 0xee, 0x02, 0xe7, 0x3a, 0x76, 0x00, 0x0e, + 0xc0, 0x76, 0x40, 0x20, 0x10, 0xb0, 0x0f, 0x60, + 0x9a, 0xa6, 0x2d, 0xcd, 0x01, 0x7e, 0x01, 0x34, + 0xeb, 0x4d, 0x78, 0x50, 0xd7, 0xec, 0x52, 0x00, + 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, + 0x42, 0x60, 0x82 +}; /* End Of File */ /* circular_2_small.png - 318 bytes */ unsigned char circular_2_small_png[318] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, - 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, - 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, - 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, - 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, - 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0x9a, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x9c, - 0x39, 0x73, 0xe6, 0x7f, 0x06, 0x0a, 0x00, 0x0b, - 0x03, 0x03, 0x03, 0x43, 0x70, 0x70, 0x30, 0x59, - 0x9a, 0xd7, 0xae, 0x5d, 0x0b, 0x31, 0xe0, 0xdf, - 0xbf, 0x7f, 0x94, 0xb9, 0x80, 0x62, 0x03, 0xfe, - 0xfe, 0xfd, 0x3b, 0xc0, 0x2e, 0xc0, 0x66, 0xc0, - 0xdc, 0x53, 0x0f, 0x18, 0xda, 0xf6, 0xde, 0x64, - 0x60, 0x60, 0x60, 0x60, 0xa8, 0x76, 0xd6, 0x60, - 0x48, 0x32, 0x93, 0xc7, 0x6a, 0x00, 0x13, 0xcc, - 0x00, 0x74, 0xdc, 0xbc, 0xfb, 0x06, 0x03, 0x03, - 0x03, 0x03, 0x83, 0x38, 0x1f, 0x2b, 0x43, 0xfb, - 0xbe, 0x1b, 0x58, 0xd5, 0x10, 0xf4, 0x82, 0x9c, - 0x30, 0x1b, 0x83, 0x18, 0x2f, 0x0b, 0xc3, 0xc7, - 0xef, 0x7f, 0x70, 0xaa, 0xc1, 0xe9, 0x82, 0x1a, - 0x67, 0x35, 0x86, 0x37, 0x5f, 0xfe, 0x30, 0x3c, - 0x78, 0xfb, 0x8b, 0x61, 0x6e, 0x98, 0x2e, 0xe9, - 0x2e, 0x88, 0x31, 0x90, 0x62, 0x88, 0x31, 0x90, - 0x82, 0xf3, 0x71, 0xb9, 0x60, 0x38, 0xa7, 0x03, - 0x92, 0x0c, 0x38, 0x79, 0xf2, 0x24, 0xd9, 0x06, - 0x00, 0x00, 0x9f, 0x8d, 0x81, 0x26, 0x01, 0x88, - 0xd0, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, - 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, + 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, + 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, + 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, + 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0x9a, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x9c, + 0x39, 0x73, 0xe6, 0x7f, 0x06, 0x0a, 0x00, 0x0b, + 0x03, 0x03, 0x03, 0x43, 0x70, 0x70, 0x30, 0x59, + 0x9a, 0xd7, 0xae, 0x5d, 0x0b, 0x31, 0xe0, 0xdf, + 0xbf, 0x7f, 0x94, 0xb9, 0x80, 0x62, 0x03, 0xfe, + 0xfe, 0xfd, 0x3b, 0xc0, 0x2e, 0xc0, 0x66, 0xc0, + 0xdc, 0x53, 0x0f, 0x18, 0xda, 0xf6, 0xde, 0x64, + 0x60, 0x60, 0x60, 0x60, 0xa8, 0x76, 0xd6, 0x60, + 0x48, 0x32, 0x93, 0xc7, 0x6a, 0x00, 0x13, 0xcc, + 0x00, 0x74, 0xdc, 0xbc, 0xfb, 0x06, 0x03, 0x03, + 0x03, 0x03, 0x83, 0x38, 0x1f, 0x2b, 0x43, 0xfb, + 0xbe, 0x1b, 0x58, 0xd5, 0x10, 0xf4, 0x82, 0x9c, + 0x30, 0x1b, 0x83, 0x18, 0x2f, 0x0b, 0xc3, 0xc7, + 0xef, 0x7f, 0x70, 0xaa, 0xc1, 0xe9, 0x82, 0x1a, + 0x67, 0x35, 0x86, 0x37, 0x5f, 0xfe, 0x30, 0x3c, + 0x78, 0xfb, 0x8b, 0x61, 0x6e, 0x98, 0x2e, 0xe9, + 0x2e, 0x88, 0x31, 0x90, 0x62, 0x88, 0x31, 0x90, + 0x82, 0xf3, 0x71, 0xb9, 0x60, 0x38, 0xa7, 0x03, + 0x92, 0x0c, 0x38, 0x79, 0xf2, 0x24, 0xd9, 0x06, + 0x00, 0x00, 0x9f, 0x8d, 0x81, 0x26, 0x01, 0x88, + 0xd0, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* circular_3.png - 796 bytes */ unsigned char circular_3_png[796] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x78, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd5, - 0x5d, 0x48, 0x93, 0x51, 0x18, 0xc0, 0xf1, 0xbf, - 0xef, 0xde, 0x7d, 0xba, 0xd4, 0xb5, 0x91, 0x1f, - 0x59, 0x4c, 0xc9, 0x34, 0x32, 0x36, 0x72, 0xa6, - 0x56, 0x08, 0x12, 0x15, 0x2e, 0xc2, 0xc0, 0xa0, - 0x82, 0xba, 0x29, 0x15, 0x24, 0xa2, 0x42, 0xe8, - 0xa2, 0x88, 0x84, 0x22, 0x08, 0x8a, 0xa8, 0x8b, - 0xd2, 0x85, 0x57, 0x51, 0x04, 0x75, 0x61, 0x18, - 0x82, 0x1a, 0x96, 0xe8, 0x45, 0x2c, 0xbd, 0xc8, - 0x86, 0xcc, 0xa8, 0x44, 0xc8, 0xe9, 0x6c, 0x46, - 0xf9, 0xed, 0x3e, 0xde, 0xb7, 0x0b, 0xc9, 0x82, - 0x2e, 0x7a, 0x27, 0xd6, 0xba, 0xd8, 0x81, 0x73, - 0x73, 0x38, 0x9c, 0xe7, 0xc7, 0xf3, 0x3c, 0xe7, - 0x9c, 0x84, 0xc6, 0xc6, 0x46, 0x99, 0x18, 0x0e, - 0x11, 0xa0, 0xa6, 0xa6, 0x26, 0x26, 0xc1, 0x5d, - 0x2e, 0xd7, 0x22, 0x00, 0x60, 0x62, 0x62, 0xe2, - 0x9f, 0x06, 0x37, 0x9b, 0xcd, 0x00, 0x3f, 0x01, - 0xb2, 0x1c, 0x9b, 0x4a, 0xc4, 0x01, 0x71, 0xc0, - 0x12, 0x40, 0x92, 0xa4, 0xd8, 0x02, 0x62, 0x9e, - 0x81, 0x68, 0x00, 0xe7, 0x5b, 0x3d, 0x34, 0x7b, - 0x7c, 0x4c, 0x2d, 0x84, 0x01, 0x48, 0xd6, 0xa9, - 0x39, 0x68, 0xcb, 0xa0, 0x7e, 0xcf, 0xe6, 0xa8, - 0x01, 0xc2, 0xaf, 0x80, 0x3f, 0xcd, 0x4f, 0x5f, - 0x67, 0xd9, 0x74, 0xad, 0x9d, 0xd1, 0xd9, 0x30, - 0x1d, 0x67, 0x9d, 0x44, 0x1a, 0xaa, 0x89, 0x34, - 0x54, 0xd3, 0x7e, 0xa6, 0x1c, 0xdf, 0x4c, 0x18, - 0xdb, 0x8d, 0x0e, 0x46, 0x27, 0xe7, 0x14, 0x9d, - 0xb5, 0xac, 0x0c, 0xec, 0x76, 0xf5, 0x70, 0x61, - 0x9f, 0x9d, 0xe3, 0x3b, 0xf2, 0xe8, 0x18, 0xf8, - 0xc0, 0x03, 0x77, 0x1f, 0x1a, 0x95, 0x40, 0x59, - 0x6e, 0x16, 0x2d, 0x27, 0x9d, 0xdc, 0xea, 0x7c, - 0x83, 0xb3, 0xa9, 0x87, 0xbe, 0xd3, 0xbb, 0x14, - 0x67, 0x40, 0x31, 0xe0, 0x62, 0xdb, 0x00, 0x25, - 0xd9, 0x6b, 0x38, 0x55, 0xb6, 0x85, 0xfa, 0x67, - 0x2f, 0x98, 0x9e, 0x9f, 0x61, 0x95, 0x4e, 0x40, - 0xaf, 0x11, 0xe8, 0x1b, 0x7e, 0xcf, 0xf0, 0x17, - 0x3f, 0x55, 0x3b, 0x8b, 0xe9, 0xf4, 0x8e, 0x70, - 0xbd, 0xcb, 0x4b, 0x5d, 0x69, 0xae, 0x22, 0x80, - 0xe2, 0x12, 0x3c, 0xf5, 0xf8, 0xb8, 0x5c, 0xe1, - 0xa0, 0xa5, 0x7f, 0x90, 0xd9, 0xe0, 0x0c, 0xa9, - 0x49, 0x22, 0x19, 0x29, 0x1a, 0x32, 0x53, 0x34, - 0x64, 0x9a, 0xd4, 0x88, 0xc2, 0x3c, 0x83, 0xfe, - 0x11, 0xae, 0x54, 0x38, 0x78, 0xd2, 0xef, 0x5b, - 0xf9, 0x12, 0x4c, 0x2e, 0x44, 0x28, 0xca, 0x4a, - 0xe3, 0xfe, 0x2b, 0x37, 0x26, 0x83, 0x88, 0xc5, - 0xb8, 0x38, 0x93, 0xf4, 0x2a, 0xd4, 0xaa, 0x04, - 0x82, 0x61, 0x99, 0xcf, 0x93, 0xe3, 0x94, 0xe7, - 0x17, 0x31, 0x36, 0x15, 0x54, 0xdc, 0xd4, 0x51, - 0xdf, 0x02, 0x8b, 0x51, 0x87, 0x5e, 0x13, 0x22, - 0x59, 0xaf, 0xc2, 0x62, 0x14, 0x31, 0x1b, 0x45, - 0x74, 0xa2, 0xc0, 0x5c, 0x48, 0x22, 0x14, 0xd1, - 0x2c, 0xed, 0x5b, 0x71, 0x80, 0xc9, 0x20, 0xd2, - 0x3b, 0xec, 0xa7, 0x24, 0x7b, 0x3d, 0x03, 0xa3, - 0x1f, 0xd1, 0x6b, 0x04, 0x8c, 0xda, 0x45, 0x84, - 0xc9, 0x20, 0x12, 0x98, 0x0e, 0xa3, 0x15, 0xd3, - 0xf0, 0xfa, 0x03, 0xac, 0x33, 0x69, 0x15, 0x03, - 0x14, 0xf7, 0x40, 0x65, 0x7e, 0x3a, 0x97, 0x5a, - 0x7a, 0x29, 0xcb, 0xcb, 0x21, 0x3d, 0xd9, 0x84, - 0x2c, 0x83, 0x0c, 0x48, 0x12, 0x44, 0x24, 0x19, - 0x9d, 0x3a, 0x85, 0xd4, 0xa4, 0x34, 0xea, 0x1e, - 0xbb, 0x39, 0x62, 0xcb, 0x50, 0xdc, 0x03, 0x8a, - 0x01, 0xe7, 0x4a, 0x37, 0xe0, 0x1e, 0x1a, 0xe7, - 0xee, 0xcb, 0xb7, 0xec, 0xb7, 0x15, 0x90, 0xbf, - 0x76, 0x23, 0x42, 0x42, 0x22, 0x73, 0x21, 0x3d, - 0x61, 0x29, 0x13, 0x4b, 0x62, 0x0e, 0xf7, 0xba, - 0x3d, 0x78, 0xc7, 0x02, 0x9c, 0x28, 0xb0, 0xfe, - 0x9d, 0x77, 0xa0, 0xf9, 0x68, 0x21, 0x95, 0x0f, - 0x5f, 0xf3, 0xdc, 0xeb, 0xe3, 0xea, 0x01, 0x07, - 0xdb, 0xac, 0x5b, 0x01, 0x78, 0xe7, 0x0f, 0x70, - 0xac, 0xa9, 0x8d, 0xc1, 0xb1, 0x00, 0x8f, 0x0e, - 0x3b, 0xa2, 0x7a, 0x55, 0xa3, 0x02, 0x58, 0x0c, - 0x6a, 0xba, 0xaa, 0xb6, 0x73, 0xc7, 0x3d, 0x84, - 0xf3, 0x76, 0x2b, 0x23, 0xdf, 0x82, 0x00, 0x58, - 0x57, 0x6b, 0x39, 0x64, 0x4b, 0xe7, 0xe6, 0xde, - 0x62, 0xc5, 0x67, 0x2d, 0x0b, 0xf0, 0x63, 0xd4, - 0x16, 0x5a, 0xa9, 0x2d, 0xb4, 0xfe, 0xb6, 0xbe, - 0x9c, 0x0f, 0x2d, 0xfe, 0x1d, 0xc7, 0x01, 0x71, - 0xc0, 0xff, 0x03, 0xb0, 0xdb, 0xed, 0xb1, 0x03, - 0xb8, 0x5c, 0xae, 0x98, 0x04, 0x07, 0xf8, 0x0e, - 0xf1, 0x73, 0xd4, 0xf6, 0xa4, 0xae, 0x73, 0x35, - 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, - 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x78, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd5, + 0x5d, 0x48, 0x93, 0x51, 0x18, 0xc0, 0xf1, 0xbf, + 0xef, 0xde, 0x7d, 0xba, 0xd4, 0xb5, 0x91, 0x1f, + 0x59, 0x4c, 0xc9, 0x34, 0x32, 0x36, 0x72, 0xa6, + 0x56, 0x08, 0x12, 0x15, 0x2e, 0xc2, 0xc0, 0xa0, + 0x82, 0xba, 0x29, 0x15, 0x24, 0xa2, 0x42, 0xe8, + 0xa2, 0x88, 0x84, 0x22, 0x08, 0x8a, 0xa8, 0x8b, + 0xd2, 0x85, 0x57, 0x51, 0x04, 0x75, 0x61, 0x18, + 0x82, 0x1a, 0x96, 0xe8, 0x45, 0x2c, 0xbd, 0xc8, + 0x86, 0xcc, 0xa8, 0x44, 0xc8, 0xe9, 0x6c, 0x46, + 0xf9, 0xed, 0x3e, 0xde, 0xb7, 0x0b, 0xc9, 0x82, + 0x2e, 0x7a, 0x27, 0xd6, 0xba, 0xd8, 0x81, 0x73, + 0x73, 0x38, 0x9c, 0xe7, 0xc7, 0xf3, 0x3c, 0xe7, + 0x9c, 0x84, 0xc6, 0xc6, 0x46, 0x99, 0x18, 0x0e, + 0x11, 0xa0, 0xa6, 0xa6, 0x26, 0x26, 0xc1, 0x5d, + 0x2e, 0xd7, 0x22, 0x00, 0x60, 0x62, 0x62, 0xe2, + 0x9f, 0x06, 0x37, 0x9b, 0xcd, 0x00, 0x3f, 0x01, + 0xb2, 0x1c, 0x9b, 0x4a, 0xc4, 0x01, 0x71, 0xc0, + 0x12, 0x40, 0x92, 0xa4, 0xd8, 0x02, 0x62, 0x9e, + 0x81, 0x68, 0x00, 0xe7, 0x5b, 0x3d, 0x34, 0x7b, + 0x7c, 0x4c, 0x2d, 0x84, 0x01, 0x48, 0xd6, 0xa9, + 0x39, 0x68, 0xcb, 0xa0, 0x7e, 0xcf, 0xe6, 0xa8, + 0x01, 0xc2, 0xaf, 0x80, 0x3f, 0xcd, 0x4f, 0x5f, + 0x67, 0xd9, 0x74, 0xad, 0x9d, 0xd1, 0xd9, 0x30, + 0x1d, 0x67, 0x9d, 0x44, 0x1a, 0xaa, 0x89, 0x34, + 0x54, 0xd3, 0x7e, 0xa6, 0x1c, 0xdf, 0x4c, 0x18, + 0xdb, 0x8d, 0x0e, 0x46, 0x27, 0xe7, 0x14, 0x9d, + 0xb5, 0xac, 0x0c, 0xec, 0x76, 0xf5, 0x70, 0x61, + 0x9f, 0x9d, 0xe3, 0x3b, 0xf2, 0xe8, 0x18, 0xf8, + 0xc0, 0x03, 0x77, 0x1f, 0x1a, 0x95, 0x40, 0x59, + 0x6e, 0x16, 0x2d, 0x27, 0x9d, 0xdc, 0xea, 0x7c, + 0x83, 0xb3, 0xa9, 0x87, 0xbe, 0xd3, 0xbb, 0x14, + 0x67, 0x40, 0x31, 0xe0, 0x62, 0xdb, 0x00, 0x25, + 0xd9, 0x6b, 0x38, 0x55, 0xb6, 0x85, 0xfa, 0x67, + 0x2f, 0x98, 0x9e, 0x9f, 0x61, 0x95, 0x4e, 0x40, + 0xaf, 0x11, 0xe8, 0x1b, 0x7e, 0xcf, 0xf0, 0x17, + 0x3f, 0x55, 0x3b, 0x8b, 0xe9, 0xf4, 0x8e, 0x70, + 0xbd, 0xcb, 0x4b, 0x5d, 0x69, 0xae, 0x22, 0x80, + 0xe2, 0x12, 0x3c, 0xf5, 0xf8, 0xb8, 0x5c, 0xe1, + 0xa0, 0xa5, 0x7f, 0x90, 0xd9, 0xe0, 0x0c, 0xa9, + 0x49, 0x22, 0x19, 0x29, 0x1a, 0x32, 0x53, 0x34, + 0x64, 0x9a, 0xd4, 0x88, 0xc2, 0x3c, 0x83, 0xfe, + 0x11, 0xae, 0x54, 0x38, 0x78, 0xd2, 0xef, 0x5b, + 0xf9, 0x12, 0x4c, 0x2e, 0x44, 0x28, 0xca, 0x4a, + 0xe3, 0xfe, 0x2b, 0x37, 0x26, 0x83, 0x88, 0xc5, + 0xb8, 0x38, 0x93, 0xf4, 0x2a, 0xd4, 0xaa, 0x04, + 0x82, 0x61, 0x99, 0xcf, 0x93, 0xe3, 0x94, 0xe7, + 0x17, 0x31, 0x36, 0x15, 0x54, 0xdc, 0xd4, 0x51, + 0xdf, 0x02, 0x8b, 0x51, 0x87, 0x5e, 0x13, 0x22, + 0x59, 0xaf, 0xc2, 0x62, 0x14, 0x31, 0x1b, 0x45, + 0x74, 0xa2, 0xc0, 0x5c, 0x48, 0x22, 0x14, 0xd1, + 0x2c, 0xed, 0x5b, 0x71, 0x80, 0xc9, 0x20, 0xd2, + 0x3b, 0xec, 0xa7, 0x24, 0x7b, 0x3d, 0x03, 0xa3, + 0x1f, 0xd1, 0x6b, 0x04, 0x8c, 0xda, 0x45, 0x84, + 0xc9, 0x20, 0x12, 0x98, 0x0e, 0xa3, 0x15, 0xd3, + 0xf0, 0xfa, 0x03, 0xac, 0x33, 0x69, 0x15, 0x03, + 0x14, 0xf7, 0x40, 0x65, 0x7e, 0x3a, 0x97, 0x5a, + 0x7a, 0x29, 0xcb, 0xcb, 0x21, 0x3d, 0xd9, 0x84, + 0x2c, 0x83, 0x0c, 0x48, 0x12, 0x44, 0x24, 0x19, + 0x9d, 0x3a, 0x85, 0xd4, 0xa4, 0x34, 0xea, 0x1e, + 0xbb, 0x39, 0x62, 0xcb, 0x50, 0xdc, 0x03, 0x8a, + 0x01, 0xe7, 0x4a, 0x37, 0xe0, 0x1e, 0x1a, 0xe7, + 0xee, 0xcb, 0xb7, 0xec, 0xb7, 0x15, 0x90, 0xbf, + 0x76, 0x23, 0x42, 0x42, 0x22, 0x73, 0x21, 0x3d, + 0x61, 0x29, 0x13, 0x4b, 0x62, 0x0e, 0xf7, 0xba, + 0x3d, 0x78, 0xc7, 0x02, 0x9c, 0x28, 0xb0, 0xfe, + 0x9d, 0x77, 0xa0, 0xf9, 0x68, 0x21, 0x95, 0x0f, + 0x5f, 0xf3, 0xdc, 0xeb, 0xe3, 0xea, 0x01, 0x07, + 0xdb, 0xac, 0x5b, 0x01, 0x78, 0xe7, 0x0f, 0x70, + 0xac, 0xa9, 0x8d, 0xc1, 0xb1, 0x00, 0x8f, 0x0e, + 0x3b, 0xa2, 0x7a, 0x55, 0xa3, 0x02, 0x58, 0x0c, + 0x6a, 0xba, 0xaa, 0xb6, 0x73, 0xc7, 0x3d, 0x84, + 0xf3, 0x76, 0x2b, 0x23, 0xdf, 0x82, 0x00, 0x58, + 0x57, 0x6b, 0x39, 0x64, 0x4b, 0xe7, 0xe6, 0xde, + 0x62, 0xc5, 0x67, 0x2d, 0x0b, 0xf0, 0x63, 0xd4, + 0x16, 0x5a, 0xa9, 0x2d, 0xb4, 0xfe, 0xb6, 0xbe, + 0x9c, 0x0f, 0x2d, 0xfe, 0x1d, 0xc7, 0x01, 0x71, + 0xc0, 0xff, 0x03, 0xb0, 0xdb, 0xed, 0xb1, 0x03, + 0xb8, 0x5c, 0xae, 0x98, 0x04, 0x07, 0xf8, 0x0e, + 0xf1, 0x73, 0xd4, 0xf6, 0xa4, 0xae, 0x73, 0x35, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, + 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* circular_3_small.png - 398 bytes */ unsigned char circular_3_small_png[398] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, - 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, - 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, - 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, - 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, - 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0xea, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x9c, - 0x39, 0x73, 0xe6, 0x7f, 0x06, 0x0a, 0x00, 0x0b, - 0x03, 0x03, 0x03, 0x43, 0x70, 0x70, 0x30, 0x59, - 0x9a, 0xd7, 0xae, 0x5d, 0x0b, 0x31, 0xe0, 0xdf, - 0xbf, 0x7f, 0x94, 0xb9, 0x80, 0x62, 0x03, 0xfe, - 0xfe, 0xfd, 0x4b, 0x7d, 0x17, 0x78, 0xce, 0x3e, - 0xc2, 0x70, 0xf5, 0xc5, 0x27, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x6d, 0x09, 0x3e, 0x86, 0xed, 0xa9, - 0x36, 0x58, 0x0d, 0x60, 0x82, 0x19, 0x80, 0x8c, - 0x3d, 0x67, 0x1f, 0x61, 0xb8, 0xf2, 0xe2, 0x13, - 0x03, 0x03, 0x23, 0x03, 0x83, 0x08, 0x2f, 0x0b, - 0xc3, 0x8d, 0xd7, 0x9f, 0x19, 0x82, 0x16, 0x1e, - 0xc3, 0x50, 0x87, 0xd3, 0x05, 0x57, 0x5f, 0x7c, - 0x62, 0x60, 0x63, 0x66, 0x64, 0xd0, 0x92, 0xe2, - 0x64, 0x50, 0x10, 0x66, 0x63, 0xf8, 0xf6, 0xeb, - 0x1f, 0xc3, 0xc1, 0x5b, 0x1f, 0xb1, 0xba, 0x14, - 0xab, 0x0b, 0x18, 0x18, 0x18, 0x18, 0x24, 0xf8, - 0x59, 0x19, 0x34, 0x25, 0x38, 0x18, 0x8c, 0xe4, - 0xb8, 0x18, 0x54, 0xc5, 0x38, 0x18, 0x58, 0x99, - 0x19, 0x89, 0x77, 0x81, 0xb6, 0x38, 0x2f, 0xc3, - 0x9d, 0x77, 0x5f, 0x19, 0x7e, 0xff, 0xfb, 0xcf, - 0xf0, 0xfb, 0xef, 0x7f, 0x86, 0x75, 0xe7, 0xdf, - 0x33, 0x04, 0xe8, 0x89, 0x12, 0xef, 0x82, 0xb5, - 0x31, 0xc6, 0x0c, 0xc6, 0xd2, 0x7c, 0x0c, 0x5b, - 0x2f, 0x7d, 0x64, 0x98, 0xb0, 0xe7, 0x25, 0x83, - 0x97, 0x96, 0x30, 0x43, 0xad, 0x9d, 0x26, 0xf1, - 0x2e, 0x60, 0x60, 0x60, 0x60, 0x98, 0x13, 0xa8, - 0x87, 0xc2, 0xc7, 0x95, 0x56, 0x68, 0x97, 0x0e, - 0xe8, 0x6b, 0xc0, 0xc9, 0x93, 0x27, 0xc9, 0x36, - 0x00, 0x00, 0xc4, 0x5a, 0xa3, 0xff, 0x1b, 0x8e, - 0xb3, 0x95, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, - 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, + 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, + 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, + 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, + 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0xea, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x9c, + 0x39, 0x73, 0xe6, 0x7f, 0x06, 0x0a, 0x00, 0x0b, + 0x03, 0x03, 0x03, 0x43, 0x70, 0x70, 0x30, 0x59, + 0x9a, 0xd7, 0xae, 0x5d, 0x0b, 0x31, 0xe0, 0xdf, + 0xbf, 0x7f, 0x94, 0xb9, 0x80, 0x62, 0x03, 0xfe, + 0xfe, 0xfd, 0x4b, 0x7d, 0x17, 0x78, 0xce, 0x3e, + 0xc2, 0x70, 0xf5, 0xc5, 0x27, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x6d, 0x09, 0x3e, 0x86, 0xed, 0xa9, + 0x36, 0x58, 0x0d, 0x60, 0x82, 0x19, 0x80, 0x8c, + 0x3d, 0x67, 0x1f, 0x61, 0xb8, 0xf2, 0xe2, 0x13, + 0x03, 0x03, 0x23, 0x03, 0x83, 0x08, 0x2f, 0x0b, + 0xc3, 0x8d, 0xd7, 0x9f, 0x19, 0x82, 0x16, 0x1e, + 0xc3, 0x50, 0x87, 0xd3, 0x05, 0x57, 0x5f, 0x7c, + 0x62, 0x60, 0x63, 0x66, 0x64, 0xd0, 0x92, 0xe2, + 0x64, 0x50, 0x10, 0x66, 0x63, 0xf8, 0xf6, 0xeb, + 0x1f, 0xc3, 0xc1, 0x5b, 0x1f, 0xb1, 0xba, 0x14, + 0xab, 0x0b, 0x18, 0x18, 0x18, 0x18, 0x24, 0xf8, + 0x59, 0x19, 0x34, 0x25, 0x38, 0x18, 0x8c, 0xe4, + 0xb8, 0x18, 0x54, 0xc5, 0x38, 0x18, 0x58, 0x99, + 0x19, 0x89, 0x77, 0x81, 0xb6, 0x38, 0x2f, 0xc3, + 0x9d, 0x77, 0x5f, 0x19, 0x7e, 0xff, 0xfb, 0xcf, + 0xf0, 0xfb, 0xef, 0x7f, 0x86, 0x75, 0xe7, 0xdf, + 0x33, 0x04, 0xe8, 0x89, 0x12, 0xef, 0x82, 0xb5, + 0x31, 0xc6, 0x0c, 0xc6, 0xd2, 0x7c, 0x0c, 0x5b, + 0x2f, 0x7d, 0x64, 0x98, 0xb0, 0xe7, 0x25, 0x83, + 0x97, 0x96, 0x30, 0x43, 0xad, 0x9d, 0x26, 0xf1, + 0x2e, 0x60, 0x60, 0x60, 0x60, 0x98, 0x13, 0xa8, + 0x87, 0xc2, 0xc7, 0x95, 0x56, 0x68, 0x97, 0x0e, + 0xe8, 0x6b, 0xc0, 0xc9, 0x93, 0x27, 0xc9, 0x36, + 0x00, 0x00, 0xc4, 0x5a, 0xa3, 0xff, 0x1b, 0x8e, + 0xb3, 0x95, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* circular_4.png - 1076 bytes */ unsigned char circular_4_png[1076] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x03, 0x90, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd6, - 0x5f, 0x6c, 0x53, 0x55, 0x1c, 0xc0, 0xf1, 0xef, - 0xb9, 0xf7, 0xdc, 0xdb, 0x7b, 0xdb, 0xde, 0xb6, - 0x5b, 0xd7, 0x75, 0x5b, 0x14, 0x5b, 0x9c, 0x0a, - 0xb6, 0xb0, 0x59, 0xd9, 0x42, 0xc8, 0x74, 0x7b, - 0x99, 0x31, 0xd8, 0x18, 0x22, 0x51, 0x8c, 0x7f, - 0x70, 0xd1, 0x30, 0x23, 0x2f, 0x3c, 0x18, 0x9f, - 0xd1, 0xa8, 0x2f, 0x26, 0x26, 0x24, 0x9a, 0x68, - 0x9b, 0x2c, 0x2c, 0x3c, 0x28, 0x1a, 0x13, 0x66, - 0x14, 0xd4, 0x04, 0x09, 0xc3, 0x00, 0xc2, 0x80, - 0xb1, 0x18, 0x06, 0xf8, 0x87, 0x09, 0x73, 0x10, - 0x6c, 0x87, 0x2b, 0x6c, 0x74, 0xdd, 0xd6, 0x5e, - 0x1f, 0xba, 0xa0, 0xc6, 0x68, 0x3b, 0x46, 0x9c, - 0x0f, 0x3b, 0xc9, 0x79, 0xb9, 0x37, 0xe7, 0xfc, - 0x3e, 0xf7, 0x77, 0x7e, 0x39, 0xf7, 0x27, 0x12, - 0x89, 0x84, 0xcd, 0x02, 0x0e, 0x09, 0xd0, 0xd9, - 0xd9, 0xb9, 0x20, 0xc1, 0x93, 0xc9, 0x64, 0x11, - 0x00, 0x30, 0x3a, 0x3a, 0xfa, 0x9f, 0x06, 0xf7, - 0xfb, 0xfd, 0x00, 0x7f, 0x00, 0x6c, 0x7b, 0x61, - 0x4e, 0x62, 0x11, 0xb0, 0x08, 0xb8, 0x01, 0x28, - 0x14, 0x0a, 0x65, 0x2f, 0x1a, 0xc9, 0x64, 0xf9, - 0xb0, 0xff, 0x02, 0xfd, 0x23, 0x63, 0x08, 0x20, - 0x76, 0x9b, 0x8f, 0x27, 0xef, 0x5b, 0x42, 0x9d, - 0xc7, 0xbc, 0x79, 0x40, 0x39, 0x19, 0x18, 0xc9, - 0x64, 0x79, 0xe6, 0x83, 0x23, 0xfc, 0x98, 0x9a, - 0xe0, 0xb1, 0x58, 0x88, 0xf6, 0xe8, 0x1d, 0x08, - 0xe0, 0xf8, 0x85, 0x34, 0xcd, 0xdb, 0xbe, 0x26, - 0x52, 0x6b, 0xb1, 0xfd, 0x89, 0x26, 0x6a, 0xe7, - 0x00, 0x29, 0x1b, 0xb0, 0xfb, 0xf4, 0x25, 0xb6, - 0xf4, 0x0c, 0xb0, 0x35, 0x1e, 0xe3, 0xa5, 0xd6, - 0x08, 0x79, 0xbb, 0xc0, 0xc5, 0xb1, 0x71, 0x54, - 0x45, 0xf0, 0x42, 0xcb, 0x32, 0xba, 0x36, 0xb6, - 0x92, 0x38, 0x30, 0x48, 0xdb, 0x7b, 0xbd, 0xbc, - 0xb3, 0xae, 0x81, 0xf6, 0xbb, 0x6b, 0x6e, 0x1d, - 0x60, 0x24, 0x93, 0x65, 0x4b, 0xcf, 0x00, 0xdd, - 0x1d, 0xad, 0xac, 0xb9, 0x33, 0xc8, 0x5b, 0x5f, - 0x1d, 0xe6, 0x87, 0x5f, 0x53, 0x98, 0xba, 0x82, - 0xa6, 0x0a, 0x1c, 0x52, 0x65, 0x59, 0x4d, 0x80, - 0xa7, 0x9a, 0xa3, 0x84, 0xab, 0x2c, 0x9e, 0xdf, - 0xd1, 0xcb, 0xbe, 0x17, 0xbd, 0xd4, 0x58, 0x46, - 0x49, 0x80, 0xf2, 0x67, 0xc0, 0x3f, 0xcd, 0x8e, - 0x9d, 0x7d, 0x6c, 0x8d, 0xc7, 0x58, 0xbd, 0xb4, - 0x9a, 0x37, 0xf6, 0x7c, 0xc3, 0x2f, 0x63, 0xa3, - 0x04, 0x2c, 0x49, 0xc0, 0x2d, 0xa9, 0xb6, 0x24, - 0x95, 0x2e, 0x85, 0xcb, 0x57, 0xd3, 0xec, 0x38, - 0xfc, 0x2d, 0x0f, 0x47, 0x6e, 0xe7, 0xb5, 0x78, - 0x8c, 0xcd, 0xbb, 0x4e, 0xfc, 0xeb, 0x9e, 0x65, - 0x03, 0x46, 0x32, 0x59, 0xce, 0xa6, 0x26, 0xd8, - 0xdc, 0x16, 0xa5, 0xfb, 0xd0, 0x49, 0x72, 0xd3, - 0x93, 0x54, 0x38, 0x55, 0xfc, 0x2e, 0x49, 0xc0, - 0x92, 0x04, 0x3d, 0x1a, 0x41, 0x8f, 0xa4, 0xda, - 0xd2, 0xd0, 0xe4, 0x0c, 0x9f, 0x0e, 0x9c, 0xa4, - 0xf3, 0xc1, 0x08, 0xc7, 0x87, 0x33, 0x5c, 0xbe, - 0x96, 0x9d, 0x3f, 0xe0, 0xe3, 0x81, 0x61, 0xd6, - 0xc7, 0x42, 0xd8, 0x76, 0x81, 0x9f, 0x52, 0x69, - 0xbc, 0xa6, 0x5a, 0x04, 0xb8, 0x8b, 0x80, 0x6a, - 0x4b, 0x12, 0xb4, 0x8a, 0x88, 0x80, 0x5b, 0x92, - 0xc9, 0xfe, 0x86, 0xc0, 0x66, 0xc3, 0xaa, 0x30, - 0x7b, 0xce, 0x5c, 0x2a, 0x09, 0x28, 0x59, 0x03, - 0x03, 0x17, 0x33, 0x3c, 0xb4, 0x32, 0x4c, 0x26, - 0x9b, 0xc3, 0xd4, 0x05, 0x6e, 0x43, 0xc1, 0x63, - 0xaa, 0xf8, 0x4c, 0x15, 0x9f, 0x53, 0xc5, 0xe5, - 0x50, 0xd0, 0x55, 0x41, 0xbe, 0x00, 0xd7, 0xa7, - 0x0a, 0xe8, 0x93, 0x79, 0xc6, 0x73, 0x93, 0x34, - 0x87, 0xaa, 0x38, 0xf4, 0xfd, 0x70, 0xc9, 0xe2, - 0x2e, 0x09, 0x10, 0x62, 0xf6, 0x3d, 0x36, 0x86, - 0x54, 0x30, 0x35, 0x05, 0x97, 0xae, 0x60, 0x19, - 0x0a, 0x3e, 0xa7, 0x8a, 0xd7, 0x54, 0x31, 0xa4, - 0xc2, 0x4c, 0xc1, 0xe6, 0xda, 0x64, 0x1e, 0x00, - 0x5d, 0xaa, 0xb3, 0x6b, 0xed, 0x92, 0x80, 0x92, - 0x47, 0xd0, 0x58, 0xe7, 0xa5, 0xef, 0x7c, 0x1a, - 0xcb, 0xa1, 0xe3, 0xd0, 0x54, 0x74, 0x29, 0x70, - 0x48, 0x05, 0x53, 0x57, 0x70, 0x3b, 0x54, 0x2a, - 0x9c, 0x92, 0xa0, 0x47, 0xe2, 0x77, 0x49, 0x2c, - 0x43, 0xc5, 0x32, 0x34, 0x9c, 0xba, 0xce, 0xb1, - 0xf3, 0x69, 0x1a, 0x6a, 0x3c, 0xf3, 0xaf, 0x81, - 0xf5, 0x91, 0x5a, 0x76, 0x9d, 0xf8, 0x19, 0x5d, - 0x4a, 0xee, 0x09, 0x56, 0x21, 0x66, 0xb3, 0xa2, - 0x08, 0x81, 0xaa, 0x80, 0xa6, 0x0a, 0xdc, 0x0e, - 0x15, 0x87, 0x26, 0x90, 0x8a, 0x20, 0xe8, 0x09, - 0x90, 0x2f, 0xc0, 0xce, 0xbe, 0x21, 0xda, 0xeb, - 0x83, 0xf3, 0x07, 0x04, 0x5c, 0x3a, 0x0d, 0x75, - 0x16, 0x89, 0x03, 0xa7, 0x58, 0xbb, 0x22, 0x82, - 0xdb, 0x61, 0x32, 0x53, 0xb0, 0x99, 0xce, 0xdb, - 0xe4, 0xa6, 0x6d, 0x26, 0x72, 0x79, 0x52, 0xe3, - 0x33, 0x5c, 0xcd, 0xe6, 0x11, 0xc2, 0x24, 0xe4, - 0x0f, 0xd1, 0x75, 0x70, 0x90, 0xb6, 0x7a, 0x1f, - 0x15, 0x86, 0x36, 0xff, 0x22, 0x04, 0x78, 0xf7, - 0xd1, 0x28, 0x6b, 0xbb, 0x8f, 0x72, 0x57, 0xd0, - 0x43, 0xc7, 0x9a, 0x16, 0xf6, 0x9d, 0xf9, 0x8e, - 0xf1, 0xdc, 0x15, 0x1c, 0xb2, 0x58, 0x20, 0xd7, - 0xa7, 0xc0, 0x32, 0x2a, 0x59, 0x1a, 0xa8, 0x67, - 0xef, 0xe9, 0x61, 0x5e, 0xdf, 0xdd, 0xcf, 0x67, - 0xcf, 0x36, 0x95, 0x75, 0xbd, 0x97, 0x05, 0xa8, - 0x72, 0xea, 0xbc, 0xfd, 0xc8, 0x72, 0x9e, 0xdb, - 0xbe, 0x9f, 0x57, 0xe3, 0xf7, 0xb3, 0xe9, 0x81, - 0x15, 0x20, 0x6c, 0x72, 0xd3, 0x39, 0x14, 0x01, - 0xa6, 0x6e, 0x60, 0xdb, 0x82, 0xf7, 0x7b, 0x4f, - 0xf1, 0xe6, 0x17, 0xfd, 0x6c, 0x8b, 0x2f, 0xc7, - 0x37, 0xfb, 0xf5, 0xb7, 0x04, 0x00, 0xd0, 0xb2, - 0xa4, 0x92, 0xcf, 0x37, 0x36, 0xf1, 0xca, 0x97, - 0x83, 0xbc, 0xfc, 0xc9, 0x51, 0x36, 0x34, 0x85, - 0x59, 0x1d, 0x0e, 0x20, 0x04, 0x1c, 0x39, 0x97, - 0xe6, 0xa3, 0x63, 0x43, 0xb4, 0xd6, 0x7b, 0xe9, - 0x79, 0x7a, 0xd5, 0x8d, 0xd4, 0x97, 0x33, 0xe6, - 0xf4, 0x3b, 0xae, 0x34, 0x24, 0x5d, 0xeb, 0x56, - 0x72, 0x25, 0x3b, 0xc5, 0xde, 0x73, 0x69, 0x0e, - 0x9e, 0x1d, 0x42, 0x41, 0x10, 0x0d, 0xba, 0xd9, - 0xbf, 0xa9, 0x99, 0x0a, 0x43, 0x2b, 0x7b, 0xaf, - 0xbf, 0x01, 0xe6, 0xd2, 0x90, 0x54, 0x18, 0x1a, - 0x8f, 0xdf, 0x5b, 0x0b, 0xd4, 0xfe, 0xe5, 0xf9, - 0xcd, 0x34, 0x35, 0xff, 0x9f, 0x8e, 0x68, 0x11, - 0xb0, 0x08, 0x68, 0x6c, 0x6c, 0x5c, 0x38, 0x40, - 0x32, 0x99, 0x5c, 0x90, 0xe0, 0x00, 0xbf, 0x03, - 0xc1, 0xe2, 0x2d, 0xf2, 0x2b, 0xa1, 0x39, 0xc3, - 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, - 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x03, 0x90, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd6, + 0x5f, 0x6c, 0x53, 0x55, 0x1c, 0xc0, 0xf1, 0xef, + 0xb9, 0xf7, 0xdc, 0xdb, 0x7b, 0xdb, 0xde, 0xb6, + 0x5b, 0xd7, 0x75, 0x5b, 0x14, 0x5b, 0x9c, 0x0a, + 0xb6, 0xb0, 0x59, 0xd9, 0x42, 0xc8, 0x74, 0x7b, + 0x99, 0x31, 0xd8, 0x18, 0x22, 0x51, 0x8c, 0x7f, + 0x70, 0xd1, 0x30, 0x23, 0x2f, 0x3c, 0x18, 0x9f, + 0xd1, 0xa8, 0x2f, 0x26, 0x26, 0x24, 0x9a, 0x68, + 0x9b, 0x2c, 0x2c, 0x3c, 0x28, 0x1a, 0x13, 0x66, + 0x14, 0xd4, 0x04, 0x09, 0xc3, 0x00, 0xc2, 0x80, + 0xb1, 0x18, 0x06, 0xf8, 0x87, 0x09, 0x73, 0x10, + 0x6c, 0x87, 0x2b, 0x6c, 0x74, 0xdd, 0xd6, 0x5e, + 0x1f, 0xba, 0xa0, 0xc6, 0x68, 0x3b, 0x46, 0x9c, + 0x0f, 0x3b, 0xc9, 0x79, 0xb9, 0x37, 0xe7, 0xfc, + 0x3e, 0xf7, 0x77, 0x7e, 0x39, 0xf7, 0x27, 0x12, + 0x89, 0x84, 0xcd, 0x02, 0x0e, 0x09, 0xd0, 0xd9, + 0xd9, 0xb9, 0x20, 0xc1, 0x93, 0xc9, 0x64, 0x11, + 0x00, 0x30, 0x3a, 0x3a, 0xfa, 0x9f, 0x06, 0xf7, + 0xfb, 0xfd, 0x00, 0x7f, 0x00, 0x6c, 0x7b, 0x61, + 0x4e, 0x62, 0x11, 0xb0, 0x08, 0xb8, 0x01, 0x28, + 0x14, 0x0a, 0x65, 0x2f, 0x1a, 0xc9, 0x64, 0xf9, + 0xb0, 0xff, 0x02, 0xfd, 0x23, 0x63, 0x08, 0x20, + 0x76, 0x9b, 0x8f, 0x27, 0xef, 0x5b, 0x42, 0x9d, + 0xc7, 0xbc, 0x79, 0x40, 0x39, 0x19, 0x18, 0xc9, + 0x64, 0x79, 0xe6, 0x83, 0x23, 0xfc, 0x98, 0x9a, + 0xe0, 0xb1, 0x58, 0x88, 0xf6, 0xe8, 0x1d, 0x08, + 0xe0, 0xf8, 0x85, 0x34, 0xcd, 0xdb, 0xbe, 0x26, + 0x52, 0x6b, 0xb1, 0xfd, 0x89, 0x26, 0x6a, 0xe7, + 0x00, 0x29, 0x1b, 0xb0, 0xfb, 0xf4, 0x25, 0xb6, + 0xf4, 0x0c, 0xb0, 0x35, 0x1e, 0xe3, 0xa5, 0xd6, + 0x08, 0x79, 0xbb, 0xc0, 0xc5, 0xb1, 0x71, 0x54, + 0x45, 0xf0, 0x42, 0xcb, 0x32, 0xba, 0x36, 0xb6, + 0x92, 0x38, 0x30, 0x48, 0xdb, 0x7b, 0xbd, 0xbc, + 0xb3, 0xae, 0x81, 0xf6, 0xbb, 0x6b, 0x6e, 0x1d, + 0x60, 0x24, 0x93, 0x65, 0x4b, 0xcf, 0x00, 0xdd, + 0x1d, 0xad, 0xac, 0xb9, 0x33, 0xc8, 0x5b, 0x5f, + 0x1d, 0xe6, 0x87, 0x5f, 0x53, 0x98, 0xba, 0x82, + 0xa6, 0x0a, 0x1c, 0x52, 0x65, 0x59, 0x4d, 0x80, + 0xa7, 0x9a, 0xa3, 0x84, 0xab, 0x2c, 0x9e, 0xdf, + 0xd1, 0xcb, 0xbe, 0x17, 0xbd, 0xd4, 0x58, 0x46, + 0x49, 0x80, 0xf2, 0x67, 0xc0, 0x3f, 0xcd, 0x8e, + 0x9d, 0x7d, 0x6c, 0x8d, 0xc7, 0x58, 0xbd, 0xb4, + 0x9a, 0x37, 0xf6, 0x7c, 0xc3, 0x2f, 0x63, 0xa3, + 0x04, 0x2c, 0x49, 0xc0, 0x2d, 0xa9, 0xb6, 0x24, + 0x95, 0x2e, 0x85, 0xcb, 0x57, 0xd3, 0xec, 0x38, + 0xfc, 0x2d, 0x0f, 0x47, 0x6e, 0xe7, 0xb5, 0x78, + 0x8c, 0xcd, 0xbb, 0x4e, 0xfc, 0xeb, 0x9e, 0x65, + 0x03, 0x46, 0x32, 0x59, 0xce, 0xa6, 0x26, 0xd8, + 0xdc, 0x16, 0xa5, 0xfb, 0xd0, 0x49, 0x72, 0xd3, + 0x93, 0x54, 0x38, 0x55, 0xfc, 0x2e, 0x49, 0xc0, + 0x92, 0x04, 0x3d, 0x1a, 0x41, 0x8f, 0xa4, 0xda, + 0xd2, 0xd0, 0xe4, 0x0c, 0x9f, 0x0e, 0x9c, 0xa4, + 0xf3, 0xc1, 0x08, 0xc7, 0x87, 0x33, 0x5c, 0xbe, + 0x96, 0x9d, 0x3f, 0xe0, 0xe3, 0x81, 0x61, 0xd6, + 0xc7, 0x42, 0xd8, 0x76, 0x81, 0x9f, 0x52, 0x69, + 0xbc, 0xa6, 0x5a, 0x04, 0xb8, 0x8b, 0x80, 0x6a, + 0x4b, 0x12, 0xb4, 0x8a, 0x88, 0x80, 0x5b, 0x92, + 0xc9, 0xfe, 0x86, 0xc0, 0x66, 0xc3, 0xaa, 0x30, + 0x7b, 0xce, 0x5c, 0x2a, 0x09, 0x28, 0x59, 0x03, + 0x03, 0x17, 0x33, 0x3c, 0xb4, 0x32, 0x4c, 0x26, + 0x9b, 0xc3, 0xd4, 0x05, 0x6e, 0x43, 0xc1, 0x63, + 0xaa, 0xf8, 0x4c, 0x15, 0x9f, 0x53, 0xc5, 0xe5, + 0x50, 0xd0, 0x55, 0x41, 0xbe, 0x00, 0xd7, 0xa7, + 0x0a, 0xe8, 0x93, 0x79, 0xc6, 0x73, 0x93, 0x34, + 0x87, 0xaa, 0x38, 0xf4, 0xfd, 0x70, 0xc9, 0xe2, + 0x2e, 0x09, 0x10, 0x62, 0xf6, 0x3d, 0x36, 0x86, + 0x54, 0x30, 0x35, 0x05, 0x97, 0xae, 0x60, 0x19, + 0x0a, 0x3e, 0xa7, 0x8a, 0xd7, 0x54, 0x31, 0xa4, + 0xc2, 0x4c, 0xc1, 0xe6, 0xda, 0x64, 0x1e, 0x00, + 0x5d, 0xaa, 0xb3, 0x6b, 0xed, 0x92, 0x80, 0x92, + 0x47, 0xd0, 0x58, 0xe7, 0xa5, 0xef, 0x7c, 0x1a, + 0xcb, 0xa1, 0xe3, 0xd0, 0x54, 0x74, 0x29, 0x70, + 0x48, 0x05, 0x53, 0x57, 0x70, 0x3b, 0x54, 0x2a, + 0x9c, 0x92, 0xa0, 0x47, 0xe2, 0x77, 0x49, 0x2c, + 0x43, 0xc5, 0x32, 0x34, 0x9c, 0xba, 0xce, 0xb1, + 0xf3, 0x69, 0x1a, 0x6a, 0x3c, 0xf3, 0xaf, 0x81, + 0xf5, 0x91, 0x5a, 0x76, 0x9d, 0xf8, 0x19, 0x5d, + 0x4a, 0xee, 0x09, 0x56, 0x21, 0x66, 0xb3, 0xa2, + 0x08, 0x81, 0xaa, 0x80, 0xa6, 0x0a, 0xdc, 0x0e, + 0x15, 0x87, 0x26, 0x90, 0x8a, 0x20, 0xe8, 0x09, + 0x90, 0x2f, 0xc0, 0xce, 0xbe, 0x21, 0xda, 0xeb, + 0x83, 0xf3, 0x07, 0x04, 0x5c, 0x3a, 0x0d, 0x75, + 0x16, 0x89, 0x03, 0xa7, 0x58, 0xbb, 0x22, 0x82, + 0xdb, 0x61, 0x32, 0x53, 0xb0, 0x99, 0xce, 0xdb, + 0xe4, 0xa6, 0x6d, 0x26, 0x72, 0x79, 0x52, 0xe3, + 0x33, 0x5c, 0xcd, 0xe6, 0x11, 0xc2, 0x24, 0xe4, + 0x0f, 0xd1, 0x75, 0x70, 0x90, 0xb6, 0x7a, 0x1f, + 0x15, 0x86, 0x36, 0xff, 0x22, 0x04, 0x78, 0xf7, + 0xd1, 0x28, 0x6b, 0xbb, 0x8f, 0x72, 0x57, 0xd0, + 0x43, 0xc7, 0x9a, 0x16, 0xf6, 0x9d, 0xf9, 0x8e, + 0xf1, 0xdc, 0x15, 0x1c, 0xb2, 0x58, 0x20, 0xd7, + 0xa7, 0xc0, 0x32, 0x2a, 0x59, 0x1a, 0xa8, 0x67, + 0xef, 0xe9, 0x61, 0x5e, 0xdf, 0xdd, 0xcf, 0x67, + 0xcf, 0x36, 0x95, 0x75, 0xbd, 0x97, 0x05, 0xa8, + 0x72, 0xea, 0xbc, 0xfd, 0xc8, 0x72, 0x9e, 0xdb, + 0xbe, 0x9f, 0x57, 0xe3, 0xf7, 0xb3, 0xe9, 0x81, + 0x15, 0x20, 0x6c, 0x72, 0xd3, 0x39, 0x14, 0x01, + 0xa6, 0x6e, 0x60, 0xdb, 0x82, 0xf7, 0x7b, 0x4f, + 0xf1, 0xe6, 0x17, 0xfd, 0x6c, 0x8b, 0x2f, 0xc7, + 0x37, 0xfb, 0xf5, 0xb7, 0x04, 0x00, 0xd0, 0xb2, + 0xa4, 0x92, 0xcf, 0x37, 0x36, 0xf1, 0xca, 0x97, + 0x83, 0xbc, 0xfc, 0xc9, 0x51, 0x36, 0x34, 0x85, + 0x59, 0x1d, 0x0e, 0x20, 0x04, 0x1c, 0x39, 0x97, + 0xe6, 0xa3, 0x63, 0x43, 0xb4, 0xd6, 0x7b, 0xe9, + 0x79, 0x7a, 0xd5, 0x8d, 0xd4, 0x97, 0x33, 0xe6, + 0xf4, 0x3b, 0xae, 0x34, 0x24, 0x5d, 0xeb, 0x56, + 0x72, 0x25, 0x3b, 0xc5, 0xde, 0x73, 0x69, 0x0e, + 0x9e, 0x1d, 0x42, 0x41, 0x10, 0x0d, 0xba, 0xd9, + 0xbf, 0xa9, 0x99, 0x0a, 0x43, 0x2b, 0x7b, 0xaf, + 0xbf, 0x01, 0xe6, 0xd2, 0x90, 0x54, 0x18, 0x1a, + 0x8f, 0xdf, 0x5b, 0x0b, 0xd4, 0xfe, 0xe5, 0xf9, + 0xcd, 0x34, 0x35, 0xff, 0x9f, 0x8e, 0x68, 0x11, + 0xb0, 0x08, 0x68, 0x6c, 0x6c, 0x5c, 0x38, 0x40, + 0x32, 0x99, 0x5c, 0x90, 0xe0, 0x00, 0xbf, 0x03, + 0xc1, 0xe2, 0x2d, 0xf2, 0x2b, 0xa1, 0x39, 0xc3, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, + 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* circular_4_small.png - 501 bytes */ unsigned char circular_4_small_png[501] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, - 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, - 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, - 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, - 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, - 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x01, 0x51, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xad, 0x92, - 0xbf, 0x4b, 0x02, 0x71, 0x18, 0xc6, 0x3f, 0xe7, - 0x9d, 0x67, 0xfe, 0x4a, 0xbb, 0xcb, 0x30, 0x03, - 0x2d, 0x29, 0x90, 0x6c, 0x69, 0x8c, 0x72, 0x69, - 0x88, 0x08, 0x6a, 0x91, 0xfe, 0x0a, 0xc7, 0x86, - 0x96, 0xa0, 0x70, 0x6d, 0x6b, 0x09, 0x87, 0xfe, - 0x84, 0x2b, 0xa8, 0x86, 0xda, 0x6a, 0x74, 0xd1, - 0x25, 0x85, 0xc6, 0xa2, 0x32, 0x0c, 0xa2, 0xc2, - 0x8c, 0x2b, 0xbd, 0x6b, 0x08, 0x07, 0xbd, 0x0b, - 0x49, 0x7b, 0xe1, 0x5d, 0xbe, 0x3c, 0xef, 0x87, - 0xe7, 0x7d, 0xde, 0xaf, 0x90, 0xcb, 0xe5, 0x4c, - 0xfa, 0x28, 0x09, 0x20, 0x9d, 0x4e, 0xf7, 0x34, - 0xac, 0x69, 0xda, 0x0f, 0xc0, 0x30, 0x8c, 0xfe, - 0x1c, 0xf4, 0x0d, 0x68, 0x36, 0x9b, 0x6d, 0x8f, - 0xc7, 0xa5, 0x07, 0xb6, 0xcf, 0x4a, 0x54, 0x6b, - 0x3a, 0x00, 0x23, 0x3e, 0x17, 0xd9, 0xe5, 0x24, - 0xab, 0xc9, 0x48, 0x77, 0x07, 0x27, 0xe5, 0x0a, - 0x19, 0xad, 0x48, 0x2b, 0x59, 0x8f, 0xec, 0xe0, - 0x4d, 0xff, 0x24, 0xa3, 0x15, 0x10, 0x04, 0x93, - 0x95, 0xc4, 0x68, 0x1b, 0xc0, 0xd1, 0x02, 0xb4, - 0x7a, 0xe7, 0xbc, 0x8c, 0x09, 0xb8, 0x24, 0x81, - 0x89, 0x61, 0x17, 0xc9, 0x88, 0x9b, 0xb9, 0xb8, - 0x0f, 0xd5, 0x27, 0xb1, 0x7b, 0x71, 0xdd, 0xa6, - 0xb5, 0x75, 0x50, 0xad, 0xe9, 0x88, 0x0e, 0x81, - 0x98, 0xea, 0x22, 0xa6, 0xc8, 0x84, 0x03, 0x4e, - 0x02, 0x6e, 0x11, 0xc5, 0x2b, 0x72, 0x58, 0x7c, - 0xb1, 0xe4, 0x65, 0x1b, 0xa2, 0xea, 0x13, 0x19, - 0x0b, 0x3a, 0x89, 0xa9, 0x32, 0x51, 0x45, 0x26, - 0xe4, 0x97, 0x90, 0x25, 0x01, 0x3b, 0xad, 0x65, - 0x85, 0x90, 0x57, 0x46, 0xff, 0x32, 0x19, 0xf2, - 0x48, 0x84, 0x07, 0x9d, 0x8c, 0xab, 0x32, 0x89, - 0xf0, 0x00, 0x85, 0x9b, 0x3a, 0xf3, 0xf1, 0x80, - 0x65, 0x05, 0x0b, 0x60, 0x6b, 0x71, 0x8a, 0xba, - 0x6e, 0x50, 0xb8, 0x7d, 0xe7, 0xb9, 0xde, 0xe0, - 0xf1, 0xb5, 0x41, 0xf6, 0xb4, 0xc2, 0xd5, 0xfd, - 0x07, 0x1b, 0x0b, 0xf1, 0xee, 0x80, 0xa5, 0x49, - 0x95, 0xbd, 0xb5, 0x69, 0xdc, 0x92, 0xc4, 0xfe, - 0xe5, 0x13, 0x9b, 0x47, 0x77, 0x88, 0x38, 0x38, - 0x58, 0x9f, 0x21, 0xa1, 0xf8, 0xed, 0x43, 0xec, - 0xfc, 0x07, 0xa9, 0x68, 0x90, 0x54, 0x74, 0xd6, - 0x72, 0xf3, 0x4e, 0xdd, 0xaf, 0x21, 0xfe, 0xa5, - 0xfe, 0x07, 0x90, 0xcf, 0xe7, 0x7b, 0x06, 0x7c, - 0x03, 0xf7, 0x02, 0xb6, 0xa0, 0x82, 0x7f, 0x5b, - 0xf5, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, - 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, + 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, + 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, + 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, + 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x01, 0x51, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xad, 0x92, + 0xbf, 0x4b, 0x02, 0x71, 0x18, 0xc6, 0x3f, 0xe7, + 0x9d, 0x67, 0xfe, 0x4a, 0xbb, 0xcb, 0x30, 0x03, + 0x2d, 0x29, 0x90, 0x6c, 0x69, 0x8c, 0x72, 0x69, + 0x88, 0x08, 0x6a, 0x91, 0xfe, 0x0a, 0xc7, 0x86, + 0x96, 0xa0, 0x70, 0x6d, 0x6b, 0x09, 0x87, 0xfe, + 0x84, 0x2b, 0xa8, 0x86, 0xda, 0x6a, 0x74, 0xd1, + 0x25, 0x85, 0xc6, 0xa2, 0x32, 0x0c, 0xa2, 0xc2, + 0x8c, 0x2b, 0xbd, 0x6b, 0x08, 0x07, 0xbd, 0x0b, + 0x49, 0x7b, 0xe1, 0x5d, 0xbe, 0x3c, 0xef, 0x87, + 0xe7, 0x7d, 0xde, 0xaf, 0x90, 0xcb, 0xe5, 0x4c, + 0xfa, 0x28, 0x09, 0x20, 0x9d, 0x4e, 0xf7, 0x34, + 0xac, 0x69, 0xda, 0x0f, 0xc0, 0x30, 0x8c, 0xfe, + 0x1c, 0xf4, 0x0d, 0x68, 0x36, 0x9b, 0x6d, 0x8f, + 0xc7, 0xa5, 0x07, 0xb6, 0xcf, 0x4a, 0x54, 0x6b, + 0x3a, 0x00, 0x23, 0x3e, 0x17, 0xd9, 0xe5, 0x24, + 0xab, 0xc9, 0x48, 0x77, 0x07, 0x27, 0xe5, 0x0a, + 0x19, 0xad, 0x48, 0x2b, 0x59, 0x8f, 0xec, 0xe0, + 0x4d, 0xff, 0x24, 0xa3, 0x15, 0x10, 0x04, 0x93, + 0x95, 0xc4, 0x68, 0x1b, 0xc0, 0xd1, 0x02, 0xb4, + 0x7a, 0xe7, 0xbc, 0x8c, 0x09, 0xb8, 0x24, 0x81, + 0x89, 0x61, 0x17, 0xc9, 0x88, 0x9b, 0xb9, 0xb8, + 0x0f, 0xd5, 0x27, 0xb1, 0x7b, 0x71, 0xdd, 0xa6, + 0xb5, 0x75, 0x50, 0xad, 0xe9, 0x88, 0x0e, 0x81, + 0x98, 0xea, 0x22, 0xa6, 0xc8, 0x84, 0x03, 0x4e, + 0x02, 0x6e, 0x11, 0xc5, 0x2b, 0x72, 0x58, 0x7c, + 0xb1, 0xe4, 0x65, 0x1b, 0xa2, 0xea, 0x13, 0x19, + 0x0b, 0x3a, 0x89, 0xa9, 0x32, 0x51, 0x45, 0x26, + 0xe4, 0x97, 0x90, 0x25, 0x01, 0x3b, 0xad, 0x65, + 0x85, 0x90, 0x57, 0x46, 0xff, 0x32, 0x19, 0xf2, + 0x48, 0x84, 0x07, 0x9d, 0x8c, 0xab, 0x32, 0x89, + 0xf0, 0x00, 0x85, 0x9b, 0x3a, 0xf3, 0xf1, 0x80, + 0x65, 0x05, 0x0b, 0x60, 0x6b, 0x71, 0x8a, 0xba, + 0x6e, 0x50, 0xb8, 0x7d, 0xe7, 0xb9, 0xde, 0xe0, + 0xf1, 0xb5, 0x41, 0xf6, 0xb4, 0xc2, 0xd5, 0xfd, + 0x07, 0x1b, 0x0b, 0xf1, 0xee, 0x80, 0xa5, 0x49, + 0x95, 0xbd, 0xb5, 0x69, 0xdc, 0x92, 0xc4, 0xfe, + 0xe5, 0x13, 0x9b, 0x47, 0x77, 0x88, 0x38, 0x38, + 0x58, 0x9f, 0x21, 0xa1, 0xf8, 0xed, 0x43, 0xec, + 0xfc, 0x07, 0xa9, 0x68, 0x90, 0x54, 0x74, 0xd6, + 0x72, 0xf3, 0x4e, 0xdd, 0xaf, 0x21, 0xfe, 0xa5, + 0xfe, 0x07, 0x90, 0xcf, 0xe7, 0x7b, 0x06, 0x7c, + 0x03, 0xf7, 0x02, 0xb6, 0xa0, 0x82, 0x7f, 0x5b, + 0xf5, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, + 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* circular_5.png - 1230 bytes */ unsigned char circular_5_png[1230] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x04, 0x2a, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd6, - 0x5d, 0x6c, 0x14, 0x55, 0x14, 0xc0, 0xf1, 0xff, - 0xbd, 0x77, 0x66, 0x77, 0x66, 0x67, 0x77, 0xe9, - 0xec, 0x74, 0x11, 0x96, 0x52, 0x5b, 0x4b, 0x03, - 0x05, 0x5c, 0xda, 0xa2, 0x21, 0xb4, 0xc8, 0x47, - 0x24, 0xb1, 0x8a, 0x1a, 0x45, 0x21, 0x41, 0x34, - 0x31, 0x25, 0x21, 0x1a, 0x8c, 0x0f, 0x98, 0x88, - 0x11, 0x63, 0x8d, 0xc1, 0x84, 0x07, 0xbf, 0x88, - 0x89, 0xa4, 0x0b, 0xd1, 0x10, 0x63, 0x88, 0x22, - 0x24, 0x16, 0x82, 0xc4, 0x48, 0x54, 0x02, 0x28, - 0xa4, 0x04, 0xe8, 0x87, 0x41, 0x40, 0x41, 0x4a, - 0xa9, 0x22, 0x4b, 0x29, 0x48, 0xb7, 0xd8, 0xdd, - 0x1d, 0x1f, 0xa6, 0x55, 0x62, 0x64, 0x5b, 0x6a, - 0xb4, 0x21, 0xe1, 0x26, 0xf7, 0x69, 0x66, 0xee, - 0xf9, 0xcd, 0x39, 0x67, 0xe6, 0x5e, 0x51, 0x5f, - 0x5f, 0xef, 0x32, 0x8c, 0x43, 0x03, 0x58, 0xba, - 0x74, 0xe9, 0xb0, 0x04, 0x4f, 0x24, 0x12, 0x1e, - 0x00, 0x20, 0x99, 0x4c, 0xfe, 0xaf, 0xc1, 0x1d, - 0xc7, 0x01, 0xf8, 0x0b, 0xe0, 0xba, 0xc3, 0x53, - 0x89, 0x9b, 0x80, 0x1b, 0x0f, 0xb0, 0xee, 0x9b, - 0x1f, 0x79, 0x7f, 0xff, 0x09, 0xda, 0x2e, 0x74, - 0x93, 0xce, 0x7a, 0xcf, 0xe8, 0x52, 0x30, 0xd6, - 0xb6, 0xa8, 0x9d, 0x56, 0xc4, 0x92, 0x69, 0xb7, - 0x0d, 0x0d, 0x90, 0xcd, 0x66, 0x73, 0xde, 0xd8, - 0xd0, 0x7a, 0x86, 0x15, 0xdb, 0x9a, 0x89, 0x58, - 0x06, 0xcf, 0xde, 0x1d, 0x67, 0xf6, 0xf8, 0xd1, - 0xc4, 0xc7, 0x78, 0x9d, 0xdc, 0x7a, 0xe6, 0x3c, - 0xbb, 0x8e, 0x75, 0xf0, 0xd6, 0x17, 0x2d, 0xbc, - 0xbd, 0xeb, 0x28, 0xab, 0xe7, 0xdd, 0xce, 0xbd, - 0x13, 0x46, 0x5f, 0x1f, 0x20, 0x57, 0x06, 0x1a, - 0x5a, 0xcf, 0xb0, 0x6c, 0xf3, 0x41, 0xde, 0x5c, - 0x38, 0x9d, 0xc7, 0xa7, 0x95, 0xb2, 0xe7, 0x87, - 0x0e, 0xde, 0xfd, 0xaa, 0x99, 0xe3, 0x67, 0x3b, - 0xf1, 0x69, 0x92, 0xc9, 0xb1, 0x08, 0xf3, 0xe2, - 0xc5, 0x1c, 0x7e, 0xf9, 0x11, 0x3e, 0xdc, 0x77, - 0x94, 0xa7, 0x37, 0xee, 0x65, 0xed, 0x82, 0x4a, - 0x6a, 0xc6, 0x8f, 0xfa, 0xf7, 0x80, 0xad, 0xad, - 0x1d, 0x2c, 0xdb, 0x72, 0x90, 0xc6, 0x95, 0xf3, - 0xe9, 0xe9, 0x4d, 0x73, 0xcf, 0x9a, 0x06, 0xce, - 0x5f, 0xee, 0x26, 0xe0, 0x93, 0x18, 0xba, 0xc4, - 0xaf, 0x09, 0x1a, 0x7f, 0xea, 0xe6, 0x60, 0x5b, - 0x3b, 0x05, 0x76, 0x88, 0xd7, 0x1e, 0x9a, 0xc9, - 0x8c, 0x71, 0xf3, 0xa9, 0x58, 0xb5, 0x85, 0xc4, - 0x82, 0x4a, 0xe6, 0x96, 0xde, 0x92, 0x13, 0x20, - 0xaf, 0x06, 0xfc, 0xd3, 0x7c, 0x61, 0x7b, 0x0b, - 0x6f, 0x2c, 0x98, 0xce, 0x85, 0xee, 0x2b, 0xd4, - 0x6e, 0xd8, 0xc9, 0xa5, 0x9e, 0x14, 0x79, 0x01, - 0x0d, 0x3b, 0xa0, 0x61, 0x07, 0x14, 0x11, 0x4b, - 0x23, 0x62, 0x69, 0x38, 0x96, 0x46, 0x4f, 0x6f, - 0x8a, 0x57, 0xb7, 0x7d, 0x8d, 0x92, 0x2e, 0x6b, - 0x1f, 0xab, 0xe2, 0xa5, 0x1d, 0x2d, 0xd7, 0x5c, - 0x77, 0x50, 0x80, 0xf5, 0xfb, 0x4e, 0x10, 0xb1, - 0x0c, 0x9e, 0x99, 0x33, 0x89, 0xe7, 0x37, 0xef, - 0xc1, 0x25, 0x43, 0xd8, 0x54, 0xe4, 0x99, 0x8a, - 0xbc, 0x80, 0xfa, 0x1b, 0x42, 0xe1, 0x58, 0x1a, - 0x4a, 0xa6, 0xf9, 0xb8, 0xf1, 0x30, 0x4f, 0x56, - 0x4d, 0xc4, 0xf4, 0xf9, 0xf9, 0xa4, 0xa9, 0x6d, - 0xe8, 0x80, 0x0f, 0x0e, 0x9c, 0xa2, 0xee, 0xfe, - 0x4a, 0x76, 0x1e, 0x39, 0x4d, 0x57, 0x4f, 0x8a, - 0x90, 0x21, 0x09, 0x1b, 0x8a, 0xb0, 0xa9, 0x18, - 0x61, 0x2a, 0x6c, 0x4b, 0xf5, 0xbd, 0xbd, 0xc2, - 0x09, 0x6a, 0xde, 0xb4, 0x14, 0xa9, 0xde, 0x6e, - 0x4e, 0x26, 0x93, 0xac, 0x7e, 0xf8, 0x0e, 0x3e, - 0x3a, 0x9c, 0x1b, 0x90, 0xb3, 0x07, 0xda, 0x2e, - 0xa4, 0xa8, 0x28, 0xcc, 0xe7, 0xf5, 0xcf, 0x0f, - 0x60, 0xf9, 0x24, 0x41, 0xbf, 0x22, 0x64, 0x28, - 0xc2, 0x86, 0x24, 0x64, 0x28, 0x82, 0x7e, 0xf9, - 0x67, 0x2f, 0xe8, 0x4a, 0x20, 0x05, 0xb8, 0x40, - 0x3a, 0xe3, 0xd2, 0xd2, 0x7e, 0x9a, 0xca, 0xc2, - 0x5b, 0xf9, 0xfe, 0xd7, 0xcb, 0x39, 0x1b, 0x3c, - 0x27, 0x20, 0x9d, 0x75, 0x99, 0x52, 0xe0, 0x70, - 0xe4, 0xe7, 0x24, 0x01, 0x9f, 0x17, 0xac, 0x1f, - 0x12, 0x36, 0x14, 0x21, 0x43, 0x62, 0xf9, 0x15, - 0xa6, 0x2e, 0xf0, 0x69, 0x12, 0x25, 0xc1, 0x75, - 0xa1, 0x37, 0xe3, 0xd2, 0xd9, 0xdd, 0x49, 0x91, - 0x33, 0x85, 0xae, 0x54, 0x7a, 0xe8, 0x80, 0xfe, - 0xe1, 0x53, 0x02, 0xbf, 0x2e, 0x31, 0x75, 0xe1, - 0x21, 0xfc, 0x92, 0xa0, 0x21, 0x09, 0x9b, 0x8a, - 0x90, 0x5f, 0xf5, 0x65, 0x41, 0xa0, 0xa4, 0xc0, - 0x75, 0xe1, 0xf7, 0x8c, 0x4b, 0xd6, 0x95, 0x08, - 0x21, 0x06, 0x5c, 0x3b, 0x27, 0x40, 0x57, 0x82, - 0xe6, 0xf6, 0x24, 0xf1, 0xb1, 0xf9, 0x9c, 0x3c, - 0x77, 0x0e, 0x43, 0xf7, 0x02, 0x5d, 0x9d, 0x89, - 0x50, 0x5f, 0x39, 0x02, 0x3e, 0x89, 0x26, 0x05, - 0x59, 0xd7, 0xe5, 0x4a, 0xda, 0x65, 0x84, 0x19, - 0xa5, 0xbd, 0xb3, 0x8b, 0xfc, 0xa0, 0x9e, 0x13, - 0x90, 0xb3, 0x09, 0x8b, 0x6c, 0x93, 0xa6, 0xf6, - 0x24, 0x8b, 0xee, 0x9c, 0x80, 0x4f, 0x09, 0x74, - 0xe5, 0xa5, 0xda, 0xaf, 0x09, 0x8c, 0xbe, 0x8c, - 0xf4, 0x97, 0xc3, 0x0e, 0x78, 0x8d, 0x18, 0xb1, - 0x34, 0xf2, 0x4c, 0x8d, 0x22, 0x67, 0x14, 0x4d, - 0xed, 0x49, 0xca, 0x63, 0xc1, 0xa1, 0x7f, 0x05, - 0x8b, 0x2b, 0x0a, 0xa8, 0x6b, 0x38, 0x40, 0x75, - 0xc9, 0x18, 0x8a, 0xa3, 0x36, 0x4a, 0x0a, 0x34, - 0x09, 0xda, 0x55, 0x18, 0x43, 0x17, 0x58, 0x7e, - 0xaf, 0x1c, 0x8e, 0xe5, 0x41, 0xa2, 0xa1, 0x3c, - 0xec, 0x80, 0xcd, 0xf2, 0x4d, 0xfb, 0x59, 0x18, - 0x8f, 0x0d, 0x1d, 0xb0, 0x28, 0x1e, 0xe3, 0x52, - 0xea, 0x0a, 0xef, 0xed, 0xf9, 0x8e, 0x25, 0xd5, - 0xe5, 0x44, 0x02, 0x26, 0x42, 0x08, 0x04, 0x20, - 0x04, 0x48, 0x01, 0x52, 0x78, 0xb5, 0xf7, 0x29, - 0x41, 0xd8, 0x54, 0x04, 0x7c, 0x06, 0xd1, 0x50, - 0x11, 0x5b, 0x9b, 0x8e, 0x61, 0xea, 0x59, 0x66, - 0x16, 0x46, 0x87, 0x0e, 0x70, 0x5d, 0x97, 0x57, - 0xe6, 0x96, 0xb2, 0x6c, 0xe3, 0x5e, 0x94, 0xd4, - 0x58, 0x51, 0x33, 0x93, 0xd8, 0x88, 0x30, 0x2e, - 0x90, 0xcd, 0x42, 0xd6, 0x85, 0x8c, 0xeb, 0x92, - 0xce, 0x78, 0x75, 0xff, 0xad, 0xc7, 0xc0, 0xd4, - 0xcb, 0x38, 0x7b, 0x29, 0x4d, 0xed, 0x86, 0xdd, - 0xac, 0x9c, 0x3d, 0x6e, 0xc0, 0x3f, 0xe1, 0x80, - 0x5f, 0xc1, 0x9c, 0x62, 0x87, 0x77, 0x1e, 0x9c, - 0xc8, 0xd4, 0x55, 0x9b, 0x59, 0xbb, 0xb8, 0x9a, - 0xa7, 0x66, 0xcd, 0xa0, 0xa3, 0xab, 0x8b, 0x53, - 0xc9, 0x5f, 0x48, 0xf5, 0x5e, 0x44, 0x93, 0x92, - 0xa0, 0xdf, 0xc6, 0xb1, 0x46, 0x62, 0xfa, 0x82, - 0x7c, 0x7a, 0xe8, 0x38, 0xb5, 0x1b, 0x76, 0xb3, - 0xfe, 0xd1, 0xc9, 0x4c, 0xca, 0x0f, 0x0f, 0xb8, - 0xcd, 0x0f, 0x6a, 0x3b, 0xbe, 0xab, 0xd0, 0x66, - 0xcd, 0x03, 0x65, 0xd4, 0x35, 0x34, 0xb2, 0x7a, - 0x47, 0x13, 0x2f, 0xde, 0x17, 0x67, 0x56, 0x69, - 0x8c, 0xc2, 0x48, 0x19, 0x00, 0x1d, 0x5d, 0x17, - 0xd9, 0xd6, 0xdc, 0x41, 0xdd, 0xd6, 0x43, 0x04, - 0xf5, 0x0c, 0xeb, 0xe6, 0x4f, 0xa2, 0x2c, 0x12, - 0x1a, 0x70, 0x8b, 0x1f, 0x54, 0x06, 0xfa, 0x47, - 0xf5, 0x58, 0x9b, 0xed, 0x4f, 0x4c, 0xe5, 0xb3, - 0xe3, 0x67, 0xa9, 0xff, 0xb2, 0x89, 0xe5, 0x9b, - 0xbe, 0xa5, 0xf3, 0x72, 0x1a, 0x80, 0x91, 0x61, - 0x9d, 0x8a, 0x58, 0x90, 0xe7, 0xaa, 0x62, 0x54, - 0x15, 0x38, 0x83, 0x5a, 0xef, 0xba, 0x01, 0xfd, - 0xa3, 0xa6, 0x24, 0x4a, 0x4d, 0x49, 0xf4, 0x9a, - 0xd7, 0xaf, 0xf7, 0x68, 0x77, 0xe3, 0x9d, 0x09, - 0x6f, 0x02, 0xfe, 0x33, 0x40, 0x79, 0x79, 0xf9, - 0xf0, 0x01, 0x12, 0x89, 0xc4, 0xb0, 0x04, 0x07, - 0xf8, 0x03, 0xb8, 0x02, 0x5b, 0x69, 0x7b, 0x2f, - 0x57, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, - 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x04, 0x2a, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd6, + 0x5d, 0x6c, 0x14, 0x55, 0x14, 0xc0, 0xf1, 0xff, + 0xbd, 0x77, 0x66, 0x77, 0x66, 0x67, 0x77, 0xe9, + 0xec, 0x74, 0x11, 0x96, 0x52, 0x5b, 0x4b, 0x03, + 0x05, 0x5c, 0xda, 0xa2, 0x21, 0xb4, 0xc8, 0x47, + 0x24, 0xb1, 0x8a, 0x1a, 0x45, 0x21, 0x41, 0x34, + 0x31, 0x25, 0x21, 0x1a, 0x8c, 0x0f, 0x98, 0x88, + 0x11, 0x63, 0x8d, 0xc1, 0x84, 0x07, 0xbf, 0x88, + 0x89, 0xa4, 0x0b, 0xd1, 0x10, 0x63, 0x88, 0x22, + 0x24, 0x16, 0x82, 0xc4, 0x48, 0x54, 0x02, 0x28, + 0xa4, 0x04, 0xe8, 0x87, 0x41, 0x40, 0x41, 0x4a, + 0xa9, 0x22, 0x4b, 0x29, 0x48, 0xb7, 0xd8, 0xdd, + 0x1d, 0x1f, 0xa6, 0x55, 0x62, 0x64, 0x5b, 0x6a, + 0xb4, 0x21, 0xe1, 0x26, 0xf7, 0x69, 0x66, 0xee, + 0xf9, 0xcd, 0x39, 0x67, 0xe6, 0x5e, 0x51, 0x5f, + 0x5f, 0xef, 0x32, 0x8c, 0x43, 0x03, 0x58, 0xba, + 0x74, 0xe9, 0xb0, 0x04, 0x4f, 0x24, 0x12, 0x1e, + 0x00, 0x20, 0x99, 0x4c, 0xfe, 0xaf, 0xc1, 0x1d, + 0xc7, 0x01, 0xf8, 0x0b, 0xe0, 0xba, 0xc3, 0x53, + 0x89, 0x9b, 0x80, 0x1b, 0x0f, 0xb0, 0xee, 0x9b, + 0x1f, 0x79, 0x7f, 0xff, 0x09, 0xda, 0x2e, 0x74, + 0x93, 0xce, 0x7a, 0xcf, 0xe8, 0x52, 0x30, 0xd6, + 0xb6, 0xa8, 0x9d, 0x56, 0xc4, 0x92, 0x69, 0xb7, + 0x0d, 0x0d, 0x90, 0xcd, 0x66, 0x73, 0xde, 0xd8, + 0xd0, 0x7a, 0x86, 0x15, 0xdb, 0x9a, 0x89, 0x58, + 0x06, 0xcf, 0xde, 0x1d, 0x67, 0xf6, 0xf8, 0xd1, + 0xc4, 0xc7, 0x78, 0x9d, 0xdc, 0x7a, 0xe6, 0x3c, + 0xbb, 0x8e, 0x75, 0xf0, 0xd6, 0x17, 0x2d, 0xbc, + 0xbd, 0xeb, 0x28, 0xab, 0xe7, 0xdd, 0xce, 0xbd, + 0x13, 0x46, 0x5f, 0x1f, 0x20, 0x57, 0x06, 0x1a, + 0x5a, 0xcf, 0xb0, 0x6c, 0xf3, 0x41, 0xde, 0x5c, + 0x38, 0x9d, 0xc7, 0xa7, 0x95, 0xb2, 0xe7, 0x87, + 0x0e, 0xde, 0xfd, 0xaa, 0x99, 0xe3, 0x67, 0x3b, + 0xf1, 0x69, 0x92, 0xc9, 0xb1, 0x08, 0xf3, 0xe2, + 0xc5, 0x1c, 0x7e, 0xf9, 0x11, 0x3e, 0xdc, 0x77, + 0x94, 0xa7, 0x37, 0xee, 0x65, 0xed, 0x82, 0x4a, + 0x6a, 0xc6, 0x8f, 0xfa, 0xf7, 0x80, 0xad, 0xad, + 0x1d, 0x2c, 0xdb, 0x72, 0x90, 0xc6, 0x95, 0xf3, + 0xe9, 0xe9, 0x4d, 0x73, 0xcf, 0x9a, 0x06, 0xce, + 0x5f, 0xee, 0x26, 0xe0, 0x93, 0x18, 0xba, 0xc4, + 0xaf, 0x09, 0x1a, 0x7f, 0xea, 0xe6, 0x60, 0x5b, + 0x3b, 0x05, 0x76, 0x88, 0xd7, 0x1e, 0x9a, 0xc9, + 0x8c, 0x71, 0xf3, 0xa9, 0x58, 0xb5, 0x85, 0xc4, + 0x82, 0x4a, 0xe6, 0x96, 0xde, 0x92, 0x13, 0x20, + 0xaf, 0x06, 0xfc, 0xd3, 0x7c, 0x61, 0x7b, 0x0b, + 0x6f, 0x2c, 0x98, 0xce, 0x85, 0xee, 0x2b, 0xd4, + 0x6e, 0xd8, 0xc9, 0xa5, 0x9e, 0x14, 0x79, 0x01, + 0x0d, 0x3b, 0xa0, 0x61, 0x07, 0x14, 0x11, 0x4b, + 0x23, 0x62, 0x69, 0x38, 0x96, 0x46, 0x4f, 0x6f, + 0x8a, 0x57, 0xb7, 0x7d, 0x8d, 0x92, 0x2e, 0x6b, + 0x1f, 0xab, 0xe2, 0xa5, 0x1d, 0x2d, 0xd7, 0x5c, + 0x77, 0x50, 0x80, 0xf5, 0xfb, 0x4e, 0x10, 0xb1, + 0x0c, 0x9e, 0x99, 0x33, 0x89, 0xe7, 0x37, 0xef, + 0xc1, 0x25, 0x43, 0xd8, 0x54, 0xe4, 0x99, 0x8a, + 0xbc, 0x80, 0xfa, 0x1b, 0x42, 0xe1, 0x58, 0x1a, + 0x4a, 0xa6, 0xf9, 0xb8, 0xf1, 0x30, 0x4f, 0x56, + 0x4d, 0xc4, 0xf4, 0xf9, 0xf9, 0xa4, 0xa9, 0x6d, + 0xe8, 0x80, 0x0f, 0x0e, 0x9c, 0xa2, 0xee, 0xfe, + 0x4a, 0x76, 0x1e, 0x39, 0x4d, 0x57, 0x4f, 0x8a, + 0x90, 0x21, 0x09, 0x1b, 0x8a, 0xb0, 0xa9, 0x18, + 0x61, 0x2a, 0x6c, 0x4b, 0xf5, 0xbd, 0xbd, 0xc2, + 0x09, 0x6a, 0xde, 0xb4, 0x14, 0xa9, 0xde, 0x6e, + 0x4e, 0x26, 0x93, 0xac, 0x7e, 0xf8, 0x0e, 0x3e, + 0x3a, 0x9c, 0x1b, 0x90, 0xb3, 0x07, 0xda, 0x2e, + 0xa4, 0xa8, 0x28, 0xcc, 0xe7, 0xf5, 0xcf, 0x0f, + 0x60, 0xf9, 0x24, 0x41, 0xbf, 0x22, 0x64, 0x28, + 0xc2, 0x86, 0x24, 0x64, 0x28, 0x82, 0x7e, 0xf9, + 0x67, 0x2f, 0xe8, 0x4a, 0x20, 0x05, 0xb8, 0x40, + 0x3a, 0xe3, 0xd2, 0xd2, 0x7e, 0x9a, 0xca, 0xc2, + 0x5b, 0xf9, 0xfe, 0xd7, 0xcb, 0x39, 0x1b, 0x3c, + 0x27, 0x20, 0x9d, 0x75, 0x99, 0x52, 0xe0, 0x70, + 0xe4, 0xe7, 0x24, 0x01, 0x9f, 0x17, 0xac, 0x1f, + 0x12, 0x36, 0x14, 0x21, 0x43, 0x62, 0xf9, 0x15, + 0xa6, 0x2e, 0xf0, 0x69, 0x12, 0x25, 0xc1, 0x75, + 0xa1, 0x37, 0xe3, 0xd2, 0xd9, 0xdd, 0x49, 0x91, + 0x33, 0x85, 0xae, 0x54, 0x7a, 0xe8, 0x80, 0xfe, + 0xe1, 0x53, 0x02, 0xbf, 0x2e, 0x31, 0x75, 0xe1, + 0x21, 0xfc, 0x92, 0xa0, 0x21, 0x09, 0x9b, 0x8a, + 0x90, 0x5f, 0xf5, 0x65, 0x41, 0xa0, 0xa4, 0xc0, + 0x75, 0xe1, 0xf7, 0x8c, 0x4b, 0xd6, 0x95, 0x08, + 0x21, 0x06, 0x5c, 0x3b, 0x27, 0x40, 0x57, 0x82, + 0xe6, 0xf6, 0x24, 0xf1, 0xb1, 0xf9, 0x9c, 0x3c, + 0x77, 0x0e, 0x43, 0xf7, 0x02, 0x5d, 0x9d, 0x89, + 0x50, 0x5f, 0x39, 0x02, 0x3e, 0x89, 0x26, 0x05, + 0x59, 0xd7, 0xe5, 0x4a, 0xda, 0x65, 0x84, 0x19, + 0xa5, 0xbd, 0xb3, 0x8b, 0xfc, 0xa0, 0x9e, 0x13, + 0x90, 0xb3, 0x09, 0x8b, 0x6c, 0x93, 0xa6, 0xf6, + 0x24, 0x8b, 0xee, 0x9c, 0x80, 0x4f, 0x09, 0x74, + 0xe5, 0xa5, 0xda, 0xaf, 0x09, 0x8c, 0xbe, 0x8c, + 0xf4, 0x97, 0xc3, 0x0e, 0x78, 0x8d, 0x18, 0xb1, + 0x34, 0xf2, 0x4c, 0x8d, 0x22, 0x67, 0x14, 0x4d, + 0xed, 0x49, 0xca, 0x63, 0xc1, 0xa1, 0x7f, 0x05, + 0x8b, 0x2b, 0x0a, 0xa8, 0x6b, 0x38, 0x40, 0x75, + 0xc9, 0x18, 0x8a, 0xa3, 0x36, 0x4a, 0x0a, 0x34, + 0x09, 0xda, 0x55, 0x18, 0x43, 0x17, 0x58, 0x7e, + 0xaf, 0x1c, 0x8e, 0xe5, 0x41, 0xa2, 0xa1, 0x3c, + 0xec, 0x80, 0xcd, 0xf2, 0x4d, 0xfb, 0x59, 0x18, + 0x8f, 0x0d, 0x1d, 0xb0, 0x28, 0x1e, 0xe3, 0x52, + 0xea, 0x0a, 0xef, 0xed, 0xf9, 0x8e, 0x25, 0xd5, + 0xe5, 0x44, 0x02, 0x26, 0x42, 0x08, 0x04, 0x20, + 0x04, 0x48, 0x01, 0x52, 0x78, 0xb5, 0xf7, 0x29, + 0x41, 0xd8, 0x54, 0x04, 0x7c, 0x06, 0xd1, 0x50, + 0x11, 0x5b, 0x9b, 0x8e, 0x61, 0xea, 0x59, 0x66, + 0x16, 0x46, 0x87, 0x0e, 0x70, 0x5d, 0x97, 0x57, + 0xe6, 0x96, 0xb2, 0x6c, 0xe3, 0x5e, 0x94, 0xd4, + 0x58, 0x51, 0x33, 0x93, 0xd8, 0x88, 0x30, 0x2e, + 0x90, 0xcd, 0x42, 0xd6, 0x85, 0x8c, 0xeb, 0x92, + 0xce, 0x78, 0x75, 0xff, 0xad, 0xc7, 0xc0, 0xd4, + 0xcb, 0x38, 0x7b, 0x29, 0x4d, 0xed, 0x86, 0xdd, + 0xac, 0x9c, 0x3d, 0x6e, 0xc0, 0x3f, 0xe1, 0x80, + 0x5f, 0xc1, 0x9c, 0x62, 0x87, 0x77, 0x1e, 0x9c, + 0xc8, 0xd4, 0x55, 0x9b, 0x59, 0xbb, 0xb8, 0x9a, + 0xa7, 0x66, 0xcd, 0xa0, 0xa3, 0xab, 0x8b, 0x53, + 0xc9, 0x5f, 0x48, 0xf5, 0x5e, 0x44, 0x93, 0x92, + 0xa0, 0xdf, 0xc6, 0xb1, 0x46, 0x62, 0xfa, 0x82, + 0x7c, 0x7a, 0xe8, 0x38, 0xb5, 0x1b, 0x76, 0xb3, + 0xfe, 0xd1, 0xc9, 0x4c, 0xca, 0x0f, 0x0f, 0xb8, + 0xcd, 0x0f, 0x6a, 0x3b, 0xbe, 0xab, 0xd0, 0x66, + 0xcd, 0x03, 0x65, 0xd4, 0x35, 0x34, 0xb2, 0x7a, + 0x47, 0x13, 0x2f, 0xde, 0x17, 0x67, 0x56, 0x69, + 0x8c, 0xc2, 0x48, 0x19, 0x00, 0x1d, 0x5d, 0x17, + 0xd9, 0xd6, 0xdc, 0x41, 0xdd, 0xd6, 0x43, 0x04, + 0xf5, 0x0c, 0xeb, 0xe6, 0x4f, 0xa2, 0x2c, 0x12, + 0x1a, 0x70, 0x8b, 0x1f, 0x54, 0x06, 0xfa, 0x47, + 0xf5, 0x58, 0x9b, 0xed, 0x4f, 0x4c, 0xe5, 0xb3, + 0xe3, 0x67, 0xa9, 0xff, 0xb2, 0x89, 0xe5, 0x9b, + 0xbe, 0xa5, 0xf3, 0x72, 0x1a, 0x80, 0x91, 0x61, + 0x9d, 0x8a, 0x58, 0x90, 0xe7, 0xaa, 0x62, 0x54, + 0x15, 0x38, 0x83, 0x5a, 0xef, 0xba, 0x01, 0xfd, + 0xa3, 0xa6, 0x24, 0x4a, 0x4d, 0x49, 0xf4, 0x9a, + 0xd7, 0xaf, 0xf7, 0x68, 0x77, 0xe3, 0x9d, 0x09, + 0x6f, 0x02, 0xfe, 0x33, 0x40, 0x79, 0x79, 0xf9, + 0xf0, 0x01, 0x12, 0x89, 0xc4, 0xb0, 0x04, 0x07, + 0xf8, 0x03, 0xb8, 0x02, 0x5b, 0x69, 0x7b, 0x2f, + 0x57, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* circular_5_small.png - 600 bytes */ unsigned char circular_5_small_png[600] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, - 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, - 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, - 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, - 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, - 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x01, 0xb4, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xad, 0x93, - 0xcf, 0x4b, 0x14, 0x61, 0x18, 0xc7, 0x3f, 0xef, - 0x3b, 0xef, 0xbb, 0x3b, 0xee, 0x38, 0x33, 0xba, - 0xdb, 0xf8, 0x63, 0xa2, 0x14, 0x44, 0x44, 0x08, - 0x14, 0xbb, 0x58, 0x76, 0xe9, 0xbe, 0x74, 0xd9, - 0x2e, 0x21, 0x5d, 0xc3, 0x53, 0x1d, 0xba, 0xf7, - 0x17, 0x04, 0x12, 0x78, 0x59, 0xaa, 0x43, 0x75, - 0xea, 0xb0, 0x08, 0x5e, 0x02, 0x15, 0x84, 0x28, - 0xd7, 0x05, 0x21, 0x82, 0x20, 0x05, 0x49, 0xfb, - 0x01, 0xe5, 0x61, 0x4d, 0x3d, 0xe8, 0xb6, 0xbb, - 0x33, 0xd3, 0x21, 0xda, 0xda, 0xdd, 0xe9, 0xa2, - 0x3d, 0xc7, 0x87, 0xef, 0xf3, 0xe1, 0x79, 0xbe, - 0x7c, 0x1f, 0x91, 0xcf, 0xe7, 0x23, 0x4e, 0x51, - 0x0a, 0x20, 0x97, 0xcb, 0x9d, 0x68, 0xb8, 0x50, - 0x28, 0xfc, 0x02, 0x84, 0x61, 0x78, 0xba, 0x0d, - 0x5a, 0x01, 0x0f, 0x8b, 0x1f, 0xb8, 0xbf, 0xb2, - 0xc1, 0x41, 0xa5, 0x06, 0x80, 0x6b, 0x6a, 0xee, - 0x5e, 0x1d, 0xe1, 0xd6, 0xa5, 0xa1, 0x78, 0x40, - 0x10, 0x04, 0x8d, 0xc6, 0xf5, 0x27, 0x45, 0x8a, - 0x3b, 0xe5, 0x3f, 0x02, 0x29, 0x38, 0xae, 0xd5, - 0xb9, 0xf7, 0xe2, 0x1d, 0x8b, 0x9b, 0xdf, 0x78, - 0x7e, 0x73, 0xf2, 0xdf, 0x1b, 0x3c, 0x2a, 0x6d, - 0x37, 0x86, 0x95, 0x14, 0x64, 0x3a, 0x15, 0x8e, - 0x29, 0x49, 0x25, 0x24, 0xd5, 0x7a, 0xc4, 0xda, - 0xc7, 0x32, 0xcf, 0xd6, 0xb7, 0x99, 0x9e, 0x18, - 0x88, 0x07, 0xcc, 0xbe, 0xdc, 0x02, 0xc0, 0xd4, - 0x92, 0x3e, 0x47, 0xe1, 0xd9, 0x9a, 0xee, 0x94, - 0x81, 0x95, 0x94, 0x28, 0x29, 0x08, 0x22, 0x98, - 0x7b, 0xbd, 0xc5, 0x8d, 0xf1, 0x73, 0xf1, 0x80, - 0xc3, 0x4a, 0x0d, 0x29, 0xa0, 0xc7, 0x56, 0xf4, - 0xbb, 0x9a, 0x3e, 0x57, 0x73, 0xa6, 0x53, 0xe1, - 0x98, 0x06, 0xda, 0x10, 0xa4, 0x12, 0x92, 0xa7, - 0x6b, 0xe5, 0x26, 0xcf, 0xda, 0x4c, 0x74, 0x3a, - 0x14, 0x19, 0x4b, 0xd1, 0x63, 0x6b, 0x7c, 0x57, - 0xd3, 0xeb, 0x68, 0xd2, 0x96, 0x22, 0xa9, 0x04, - 0xf5, 0x30, 0x42, 0xb4, 0xe8, 0xe5, 0x6f, 0x40, - 0x18, 0x86, 0x38, 0x49, 0x05, 0x44, 0xb8, 0x1d, - 0x06, 0x69, 0xcb, 0xc0, 0xb3, 0x35, 0x7e, 0x97, - 0x66, 0x20, 0x9d, 0x60, 0xc8, 0x4b, 0xb2, 0xf1, - 0xb5, 0xc2, 0x85, 0x7e, 0xab, 0xa1, 0x6f, 0x03, - 0xdc, 0x9e, 0x1a, 0xe4, 0xe0, 0x38, 0xe0, 0x47, - 0x3d, 0x22, 0x95, 0x90, 0xd8, 0xa6, 0x24, 0x63, - 0x29, 0xfc, 0x2e, 0xcd, 0xe7, 0xbd, 0x2a, 0x4b, - 0xef, 0x0f, 0xb9, 0x73, 0x65, 0xb0, 0x09, 0xd0, - 0x74, 0xc2, 0xf4, 0x98, 0xcf, 0xab, 0x9d, 0x3d, - 0x56, 0x3f, 0x7d, 0xe7, 0xa8, 0x1a, 0x60, 0x6a, - 0x89, 0x00, 0xe6, 0xdf, 0xec, 0xb3, 0xf0, 0x76, - 0x9f, 0x99, 0x29, 0x9f, 0xcb, 0x67, 0x33, 0xed, - 0x1e, 0xfc, 0x9d, 0x83, 0xb9, 0xec, 0x28, 0x0b, - 0x9b, 0xbb, 0x3c, 0x5e, 0xff, 0xc2, 0xec, 0xf2, - 0x2e, 0x00, 0x13, 0xe7, 0x2d, 0x1e, 0x5c, 0x1b, - 0xe1, 0x62, 0x6f, 0x77, 0x93, 0x36, 0xd6, 0x44, - 0x80, 0xec, 0xb0, 0x47, 0x76, 0xd8, 0xa3, 0xb5, - 0xe2, 0x22, 0xff, 0x7f, 0x7e, 0xa1, 0x54, 0x2a, - 0x9d, 0x18, 0xf0, 0x13, 0x96, 0x03, 0xb1, 0x08, - 0x92, 0x29, 0xc1, 0x47, 0x00, 0x00, 0x00, 0x00, - 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, + 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, + 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, + 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, + 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x01, 0xb4, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xad, 0x93, + 0xcf, 0x4b, 0x14, 0x61, 0x18, 0xc7, 0x3f, 0xef, + 0x3b, 0xef, 0xbb, 0x3b, 0xee, 0x38, 0x33, 0xba, + 0xdb, 0xf8, 0x63, 0xa2, 0x14, 0x44, 0x44, 0x08, + 0x14, 0xbb, 0x58, 0x76, 0xe9, 0xbe, 0x74, 0xd9, + 0x2e, 0x21, 0x5d, 0xc3, 0x53, 0x1d, 0xba, 0xf7, + 0x17, 0x04, 0x12, 0x78, 0x59, 0xaa, 0x43, 0x75, + 0xea, 0xb0, 0x08, 0x5e, 0x02, 0x15, 0x84, 0x28, + 0xd7, 0x05, 0x21, 0x82, 0x20, 0x05, 0x49, 0xfb, + 0x01, 0xe5, 0x61, 0x4d, 0x3d, 0xe8, 0xb6, 0xbb, + 0x33, 0xd3, 0x21, 0xda, 0xda, 0xdd, 0xe9, 0xa2, + 0x3d, 0xc7, 0x87, 0xef, 0xf3, 0xe1, 0x79, 0xbe, + 0x7c, 0x1f, 0x91, 0xcf, 0xe7, 0x23, 0x4e, 0x51, + 0x0a, 0x20, 0x97, 0xcb, 0x9d, 0x68, 0xb8, 0x50, + 0x28, 0xfc, 0x02, 0x84, 0x61, 0x78, 0xba, 0x0d, + 0x5a, 0x01, 0x0f, 0x8b, 0x1f, 0xb8, 0xbf, 0xb2, + 0xc1, 0x41, 0xa5, 0x06, 0x80, 0x6b, 0x6a, 0xee, + 0x5e, 0x1d, 0xe1, 0xd6, 0xa5, 0xa1, 0x78, 0x40, + 0x10, 0x04, 0x8d, 0xc6, 0xf5, 0x27, 0x45, 0x8a, + 0x3b, 0xe5, 0x3f, 0x02, 0x29, 0x38, 0xae, 0xd5, + 0xb9, 0xf7, 0xe2, 0x1d, 0x8b, 0x9b, 0xdf, 0x78, + 0x7e, 0x73, 0xf2, 0xdf, 0x1b, 0x3c, 0x2a, 0x6d, + 0x37, 0x86, 0x95, 0x14, 0x64, 0x3a, 0x15, 0x8e, + 0x29, 0x49, 0x25, 0x24, 0xd5, 0x7a, 0xc4, 0xda, + 0xc7, 0x32, 0xcf, 0xd6, 0xb7, 0x99, 0x9e, 0x18, + 0x88, 0x07, 0xcc, 0xbe, 0xdc, 0x02, 0xc0, 0xd4, + 0x92, 0x3e, 0x47, 0xe1, 0xd9, 0x9a, 0xee, 0x94, + 0x81, 0x95, 0x94, 0x28, 0x29, 0x08, 0x22, 0x98, + 0x7b, 0xbd, 0xc5, 0x8d, 0xf1, 0x73, 0xf1, 0x80, + 0xc3, 0x4a, 0x0d, 0x29, 0xa0, 0xc7, 0x56, 0xf4, + 0xbb, 0x9a, 0x3e, 0x57, 0x73, 0xa6, 0x53, 0xe1, + 0x98, 0x06, 0xda, 0x10, 0xa4, 0x12, 0x92, 0xa7, + 0x6b, 0xe5, 0x26, 0xcf, 0xda, 0x4c, 0x74, 0x3a, + 0x14, 0x19, 0x4b, 0xd1, 0x63, 0x6b, 0x7c, 0x57, + 0xd3, 0xeb, 0x68, 0xd2, 0x96, 0x22, 0xa9, 0x04, + 0xf5, 0x30, 0x42, 0xb4, 0xe8, 0xe5, 0x6f, 0x40, + 0x18, 0x86, 0x38, 0x49, 0x05, 0x44, 0xb8, 0x1d, + 0x06, 0x69, 0xcb, 0xc0, 0xb3, 0x35, 0x7e, 0x97, + 0x66, 0x20, 0x9d, 0x60, 0xc8, 0x4b, 0xb2, 0xf1, + 0xb5, 0xc2, 0x85, 0x7e, 0xab, 0xa1, 0x6f, 0x03, + 0xdc, 0x9e, 0x1a, 0xe4, 0xe0, 0x38, 0xe0, 0x47, + 0x3d, 0x22, 0x95, 0x90, 0xd8, 0xa6, 0x24, 0x63, + 0x29, 0xfc, 0x2e, 0xcd, 0xe7, 0xbd, 0x2a, 0x4b, + 0xef, 0x0f, 0xb9, 0x73, 0x65, 0xb0, 0x09, 0xd0, + 0x74, 0xc2, 0xf4, 0x98, 0xcf, 0xab, 0x9d, 0x3d, + 0x56, 0x3f, 0x7d, 0xe7, 0xa8, 0x1a, 0x60, 0x6a, + 0x89, 0x00, 0xe6, 0xdf, 0xec, 0xb3, 0xf0, 0x76, + 0x9f, 0x99, 0x29, 0x9f, 0xcb, 0x67, 0x33, 0xed, + 0x1e, 0xfc, 0x9d, 0x83, 0xb9, 0xec, 0x28, 0x0b, + 0x9b, 0xbb, 0x3c, 0x5e, 0xff, 0xc2, 0xec, 0xf2, + 0x2e, 0x00, 0x13, 0xe7, 0x2d, 0x1e, 0x5c, 0x1b, + 0xe1, 0x62, 0x6f, 0x77, 0x93, 0x36, 0xd6, 0x44, + 0x80, 0xec, 0xb0, 0x47, 0x76, 0xd8, 0xa3, 0xb5, + 0xe2, 0x22, 0xff, 0x7f, 0x7e, 0xa1, 0x54, 0x2a, + 0x9d, 0x18, 0xf0, 0x13, 0x96, 0x03, 0xb1, 0x08, + 0x92, 0x29, 0xc1, 0x47, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; /* End Of File */ /* circular_6.png - 1467 bytes */ unsigned char circular_6_png[1467] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x05, 0x17, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xd5, 0x97, - 0x6b, 0x6c, 0x14, 0x65, 0x14, 0x86, 0x9f, 0xef, - 0x9b, 0xfb, 0x6e, 0x77, 0xb7, 0xcb, 0xd2, 0x42, - 0x29, 0xd0, 0x02, 0x85, 0x42, 0xa1, 0x02, 0x22, - 0x81, 0x02, 0x8a, 0x68, 0x5a, 0x44, 0x40, 0x89, - 0x7f, 0x4c, 0x20, 0xd1, 0xe8, 0x0f, 0x22, 0x11, - 0x15, 0x25, 0x9a, 0x68, 0x4c, 0x04, 0x6a, 0x24, - 0x1a, 0x43, 0x02, 0x51, 0x09, 0x55, 0x7f, 0x19, - 0x8c, 0x41, 0x23, 0x20, 0xd8, 0x40, 0xe5, 0x22, - 0x92, 0x48, 0x41, 0xe4, 0x5a, 0x90, 0x4b, 0x69, - 0x25, 0xdc, 0x4a, 0xa1, 0xa5, 0x37, 0x76, 0xd9, - 0xee, 0x76, 0xc6, 0x1f, 0xd3, 0x2d, 0x05, 0x36, - 0xd2, 0x12, 0xb1, 0x61, 0x92, 0x37, 0x93, 0x4c, - 0x26, 0xf3, 0x3d, 0x39, 0xef, 0x79, 0x4f, 0xce, - 0x88, 0x35, 0x6b, 0xd6, 0x38, 0xf4, 0xe0, 0xa5, - 0x02, 0xcc, 0x9f, 0x3f, 0xbf, 0x47, 0x0e, 0x2f, - 0x29, 0x29, 0x71, 0x01, 0x00, 0xea, 0xea, 0xea, - 0xfe, 0xd7, 0xc3, 0x43, 0xa1, 0x10, 0xc0, 0x4d, - 0x00, 0xc7, 0xe9, 0x19, 0x27, 0x1e, 0x4c, 0x80, - 0x8d, 0x15, 0x17, 0xd8, 0x55, 0x59, 0x4b, 0x75, - 0xfd, 0x75, 0x00, 0x06, 0xf5, 0xf2, 0x32, 0x35, - 0x27, 0x9d, 0x67, 0x47, 0x65, 0xde, 0x3f, 0x80, - 0xf3, 0x0d, 0x61, 0x5e, 0x5f, 0x7f, 0x90, 0x7d, - 0x67, 0xeb, 0xe8, 0x1f, 0x4c, 0x61, 0xea, 0xb0, - 0x0c, 0x8a, 0x46, 0xf5, 0x46, 0x00, 0x7f, 0xd7, - 0xb7, 0xb0, 0x7c, 0xfb, 0x09, 0x16, 0xfe, 0xb0, - 0x9f, 0x82, 0xec, 0xde, 0xac, 0x98, 0x33, 0x96, - 0xcc, 0x80, 0xf5, 0xdf, 0x01, 0x7c, 0xb9, 0xa7, - 0x8a, 0x65, 0x65, 0xc7, 0x98, 0x99, 0x9f, 0xc5, - 0xde, 0x77, 0x1f, 0x63, 0x44, 0x46, 0x2a, 0xd5, - 0x57, 0x9b, 0xb9, 0xdc, 0x14, 0x46, 0x91, 0x82, - 0x7e, 0x01, 0x2f, 0xab, 0xe7, 0x4e, 0xe1, 0xd4, - 0xe5, 0x06, 0x8a, 0x7f, 0x3e, 0xc0, 0xe4, 0x55, - 0xdb, 0x58, 0x32, 0x7d, 0x24, 0x2f, 0x8e, 0x1f, - 0xd4, 0x75, 0x00, 0xdb, 0xb6, 0x93, 0xbe, 0xf0, - 0xf6, 0xa6, 0x23, 0x94, 0x9e, 0xa8, 0x61, 0xdd, - 0xfc, 0x42, 0xf2, 0x33, 0x83, 0xac, 0xda, 0x71, - 0x94, 0x4d, 0x47, 0xaa, 0xb0, 0x1d, 0x1b, 0x5d, - 0x15, 0x68, 0x8a, 0x40, 0x95, 0x02, 0x45, 0x0a, - 0x5e, 0x98, 0x38, 0x82, 0xd5, 0x73, 0xa7, 0xf0, - 0xd2, 0xa4, 0x61, 0xcc, 0xfd, 0x7a, 0x27, 0xa7, - 0xaf, 0x34, 0xb1, 0xec, 0xa9, 0xfc, 0x7f, 0x05, - 0x90, 0x9d, 0x2b, 0x70, 0xbb, 0xbe, 0x2a, 0xaf, - 0xa2, 0xf4, 0x44, 0x0d, 0xdb, 0x16, 0xcd, 0x22, - 0xd6, 0xd6, 0xc6, 0xec, 0xcf, 0x4b, 0x59, 0x7f, - 0xa8, 0x12, 0x4d, 0x71, 0xf0, 0x9b, 0x0a, 0x01, - 0x4b, 0x21, 0xd5, 0x52, 0x48, 0xf5, 0xb8, 0xf7, - 0xcd, 0x47, 0x4f, 0xf1, 0xc6, 0xba, 0x6d, 0x04, - 0x2c, 0x95, 0xdf, 0xdf, 0x79, 0x86, 0x0d, 0x15, - 0x35, 0x7c, 0x7b, 0xe0, 0x6c, 0xd2, 0x6f, 0xdf, - 0x15, 0xe0, 0x7c, 0x43, 0x98, 0xe2, 0x5f, 0xfe, - 0xe2, 0xc7, 0x57, 0x8a, 0x38, 0x73, 0xa5, 0x91, - 0x85, 0xdf, 0xed, 0x22, 0x12, 0x8b, 0xe2, 0x33, - 0x25, 0x7e, 0xcb, 0x3d, 0x3c, 0xa1, 0xce, 0x10, - 0x91, 0xd6, 0x08, 0xab, 0x76, 0x96, 0x13, 0x6e, - 0x8d, 0xb2, 0xf9, 0xb5, 0xe9, 0x2c, 0x2d, 0x3b, - 0x4e, 0x4d, 0x73, 0xa4, 0xfb, 0x00, 0x6f, 0x6e, - 0x3c, 0xcc, 0xbc, 0x09, 0x43, 0xc9, 0x0e, 0xf9, - 0x58, 0xbe, 0x65, 0x3f, 0x5e, 0x5d, 0xe2, 0x33, - 0x94, 0x0e, 0x75, 0x86, 0x48, 0xf5, 0xa8, 0x2e, - 0x80, 0x47, 0x25, 0xe8, 0x51, 0xf1, 0xea, 0x82, - 0x6f, 0xf6, 0x1e, 0x60, 0x68, 0x7a, 0x80, 0x79, - 0x13, 0x72, 0x58, 0x52, 0x56, 0xd1, 0x7d, 0x80, - 0x3f, 0xce, 0x5d, 0x63, 0xd1, 0x93, 0xf9, 0xac, - 0xdc, 0x71, 0x98, 0x6b, 0xe1, 0x08, 0x29, 0x86, - 0x82, 0xd7, 0x90, 0xf8, 0x4c, 0x57, 0x7e, 0x53, - 0x76, 0xd8, 0x90, 0xa8, 0x42, 0xd0, 0x73, 0xb3, - 0x12, 0x8e, 0x13, 0x63, 0xe7, 0xc9, 0x4a, 0x16, - 0x17, 0x3e, 0xc4, 0x6f, 0x55, 0x75, 0xdd, 0x03, - 0xd8, 0x74, 0xec, 0x12, 0xfd, 0x83, 0x29, 0xe4, - 0xa4, 0xfb, 0xd9, 0x70, 0xe8, 0x0c, 0x1e, 0x5d, - 0xe2, 0xd1, 0x25, 0x29, 0x86, 0xc4, 0x6b, 0x28, - 0xf8, 0x4c, 0x57, 0xb7, 0xf6, 0x41, 0xa2, 0x0a, - 0x37, 0x75, 0xec, 0xe2, 0x79, 0xb2, 0x43, 0x7e, - 0xd2, 0x52, 0xbc, 0xec, 0xaa, 0xaa, 0x4d, 0x0a, - 0x90, 0x34, 0x86, 0xbb, 0xab, 0xaf, 0xf2, 0x78, - 0x6e, 0x06, 0x95, 0xb5, 0x8d, 0x68, 0x0a, 0x58, - 0x9a, 0xec, 0x80, 0xf0, 0x76, 0x02, 0xf1, 0xe8, - 0x12, 0x4b, 0x13, 0x18, 0xaa, 0x44, 0x53, 0x04, - 0x8a, 0x04, 0x21, 0x04, 0xb6, 0xe3, 0x10, 0x6f, - 0x73, 0x88, 0xc6, 0x6d, 0x5a, 0xa2, 0x51, 0x8a, - 0xf2, 0xfa, 0x71, 0xf0, 0x62, 0x3d, 0x8f, 0x66, - 0xf7, 0xbe, 0x23, 0x05, 0x49, 0x01, 0xce, 0x5e, - 0x0b, 0x33, 0x63, 0x60, 0x5f, 0xe2, 0xb6, 0x8d, - 0xa1, 0x4a, 0x4c, 0x4d, 0x62, 0x6a, 0x02, 0x4b, - 0x97, 0x78, 0x8d, 0xce, 0xd5, 0x90, 0x58, 0x9a, - 0x2b, 0x5d, 0x75, 0xa3, 0x28, 0x00, 0xdb, 0x71, - 0x88, 0xb5, 0x39, 0x44, 0xe3, 0x0e, 0xd7, 0xa3, - 0x37, 0x18, 0x9a, 0xee, 0xa3, 0xfc, 0xf4, 0xb5, - 0xa4, 0xb3, 0x26, 0xf9, 0x20, 0x12, 0x20, 0x04, - 0x98, 0x9a, 0x82, 0xa1, 0x0a, 0x0c, 0x55, 0xb8, - 0x10, 0xaa, 0xbc, 0xa5, 0x1a, 0x29, 0x86, 0x82, - 0x57, 0x97, 0x58, 0xba, 0xc4, 0x50, 0xdd, 0x79, - 0x20, 0x04, 0xd8, 0x0e, 0xb4, 0xc6, 0x6d, 0x22, - 0x31, 0x07, 0xa5, 0x7d, 0x46, 0x48, 0x21, 0xba, - 0x0e, 0x30, 0x28, 0xe8, 0xa1, 0xfa, 0x6a, 0x33, - 0x52, 0xb8, 0x83, 0x46, 0x57, 0x5d, 0x19, 0x9a, - 0x2b, 0x4b, 0xef, 0x04, 0x61, 0xca, 0x76, 0x2b, - 0x5c, 0x1b, 0x84, 0x80, 0x36, 0x1b, 0xa2, 0x71, - 0x81, 0xaa, 0xd8, 0xf8, 0x4c, 0x93, 0x13, 0x35, - 0x4d, 0x64, 0x05, 0xad, 0xa4, 0x00, 0x49, 0x9b, - 0x70, 0x72, 0x56, 0x90, 0x5f, 0x4f, 0x5e, 0x24, - 0x23, 0xe0, 0x25, 0xd5, 0xd2, 0x51, 0x65, 0x3b, - 0x48, 0xbb, 0x12, 0xb6, 0x58, 0x9a, 0xc0, 0xd3, - 0x1e, 0x4f, 0xbf, 0xe9, 0x36, 0x5e, 0xd0, 0xa3, - 0x12, 0xb0, 0x12, 0x51, 0xd5, 0xb1, 0x34, 0x83, - 0x2d, 0x15, 0xe7, 0x19, 0x9b, 0x11, 0xe8, 0x7a, - 0x0a, 0x8a, 0x86, 0xa6, 0x71, 0xb1, 0x31, 0xcc, - 0x85, 0x86, 0x16, 0x8a, 0x46, 0x66, 0xa3, 0x48, - 0xb7, 0xbc, 0xaa, 0x92, 0x18, 0xbd, 0xa0, 0x25, - 0x40, 0x54, 0xd7, 0x02, 0x9f, 0x29, 0x3b, 0x12, - 0xe1, 0x37, 0xdd, 0xfe, 0x18, 0x14, 0xca, 0xa4, - 0xa6, 0xa9, 0x99, 0x70, 0x2c, 0xca, 0xc3, 0x19, - 0xc1, 0xee, 0xcd, 0x81, 0x89, 0x03, 0x53, 0x59, - 0xb9, 0xbd, 0x82, 0xb9, 0xe3, 0xf3, 0xf0, 0xe8, - 0x2a, 0x42, 0x80, 0x14, 0xae, 0x97, 0xae, 0xaf, - 0x74, 0x00, 0x25, 0x7a, 0x24, 0x51, 0x05, 0xaf, - 0xa1, 0xe0, 0x35, 0x4c, 0x06, 0x04, 0xb3, 0xf8, - 0xb4, 0xec, 0x08, 0x4f, 0x0f, 0x0f, 0x75, 0x7f, - 0x10, 0x15, 0x17, 0x0e, 0x63, 0xed, 0xbe, 0xd3, - 0x54, 0xd7, 0x35, 0xb3, 0xb8, 0x70, 0x22, 0x29, - 0xba, 0x7e, 0x8b, 0x77, 0xe2, 0x36, 0x2f, 0x5d, - 0x40, 0xda, 0x1b, 0x4e, 0xa1, 0xaf, 0x3f, 0x87, - 0x53, 0x97, 0xeb, 0x59, 0xf7, 0xe7, 0x19, 0x16, - 0x8c, 0x1f, 0xdc, 0x7d, 0x80, 0x34, 0x8f, 0xce, - 0x7b, 0x53, 0x87, 0x30, 0xeb, 0xb3, 0xad, 0x78, - 0x75, 0x93, 0x97, 0xa7, 0x3c, 0x82, 0xa9, 0xa9, - 0xd8, 0x8e, 0x83, 0xed, 0xb8, 0x8d, 0xd6, 0x66, - 0x3b, 0xc4, 0xed, 0xf6, 0xc8, 0xc5, 0x1c, 0x5a, - 0xa2, 0x36, 0x2d, 0x51, 0x15, 0x9f, 0x39, 0x9c, - 0xc6, 0x88, 0x60, 0xda, 0x8a, 0x52, 0x8a, 0x0b, - 0x73, 0xf0, 0xe9, 0xea, 0xdd, 0x01, 0x6c, 0xdb, - 0xbe, 0x43, 0xcf, 0xe5, 0xf5, 0x61, 0xce, 0x88, - 0xde, 0x14, 0x7c, 0xfc, 0x13, 0x0d, 0xe1, 0x38, - 0x1f, 0xcc, 0x9a, 0x4e, 0xc1, 0xe0, 0x21, 0xe8, - 0x8a, 0x4e, 0xac, 0xcd, 0xa1, 0x35, 0xee, 0x66, - 0x3d, 0x12, 0xb3, 0xb9, 0x11, 0x97, 0xe8, 0x4a, - 0x7f, 0x02, 0x56, 0x1e, 0x15, 0x17, 0x9a, 0x18, - 0xb9, 0x64, 0x3d, 0xaf, 0x16, 0xf4, 0x63, 0x62, - 0xbf, 0x5e, 0x49, 0xbf, 0x9d, 0xb8, 0xee, 0xba, - 0x90, 0xbc, 0x35, 0x29, 0x9b, 0x9c, 0x5e, 0x16, - 0x73, 0xbe, 0x28, 0x63, 0xf6, 0xe8, 0x2c, 0x96, - 0xce, 0x1e, 0xc7, 0x13, 0xc3, 0x73, 0xb9, 0x1e, - 0xbd, 0xc1, 0x8d, 0x78, 0x14, 0x55, 0x4a, 0x3c, - 0xba, 0x81, 0xa1, 0xea, 0xd4, 0x36, 0xb7, 0xb0, - 0x60, 0xed, 0x6e, 0x4a, 0x2b, 0xce, 0xf1, 0xc9, - 0x8c, 0xc1, 0x14, 0x64, 0x86, 0xee, 0xba, 0x69, - 0x75, 0x69, 0x23, 0x9a, 0x9d, 0x9b, 0xce, 0xa4, - 0x01, 0xa9, 0xac, 0x28, 0xaf, 0x66, 0xfc, 0x47, - 0xeb, 0x09, 0xa5, 0x58, 0x4c, 0xcf, 0xcb, 0x24, - 0xb7, 0x8f, 0x1f, 0x29, 0x05, 0x95, 0xb5, 0x4d, - 0x6c, 0x3d, 0x7e, 0x81, 0x86, 0x70, 0x84, 0x99, - 0xc3, 0x43, 0x7c, 0xff, 0xfc, 0x68, 0xfc, 0xba, - 0xd6, 0xa5, 0x3d, 0xb3, 0xcb, 0x3b, 0x61, 0x2f, - 0x4b, 0xe3, 0xc3, 0x69, 0xc3, 0x60, 0x1a, 0xec, - 0xbf, 0xd4, 0xc8, 0xd1, 0xda, 0x66, 0xf6, 0x9c, - 0xaa, 0x47, 0x0a, 0x18, 0x18, 0x30, 0x79, 0xff, - 0xb1, 0x01, 0xe4, 0xa7, 0xf9, 0x3b, 0xde, 0xef, - 0xea, 0x92, 0x7b, 0x4f, 0x5b, 0xf1, 0xb8, 0xbe, - 0x7e, 0xc6, 0xf5, 0xf5, 0xdf, 0xf1, 0xfc, 0x5e, - 0x56, 0xfb, 0x07, 0xf3, 0xbf, 0xe0, 0xbe, 0x00, - 0x8c, 0x19, 0x33, 0xa6, 0xe7, 0x00, 0x4a, 0x4a, - 0x4a, 0x7a, 0xe4, 0x70, 0x80, 0x7f, 0x00, 0x9e, - 0xdd, 0xc8, 0x46, 0x68, 0x1f, 0x4e, 0x08, 0x00, - 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, - 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x05, 0x17, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xd5, 0x97, + 0x6b, 0x6c, 0x14, 0x65, 0x14, 0x86, 0x9f, 0xef, + 0x9b, 0xfb, 0x6e, 0x77, 0xb7, 0xcb, 0xd2, 0x42, + 0x29, 0xd0, 0x02, 0x85, 0x42, 0xa1, 0x02, 0x22, + 0x81, 0x02, 0x8a, 0x68, 0x5a, 0x44, 0x40, 0x89, + 0x7f, 0x4c, 0x20, 0xd1, 0xe8, 0x0f, 0x22, 0x11, + 0x15, 0x25, 0x9a, 0x68, 0x4c, 0x04, 0x6a, 0x24, + 0x1a, 0x43, 0x02, 0x51, 0x09, 0x55, 0x7f, 0x19, + 0x8c, 0x41, 0x23, 0x20, 0xd8, 0x40, 0xe5, 0x22, + 0x92, 0x48, 0x41, 0xe4, 0x5a, 0x90, 0x4b, 0x69, + 0x25, 0xdc, 0x4a, 0xa1, 0xa5, 0x37, 0x76, 0xd9, + 0xee, 0x76, 0xc6, 0x1f, 0xd3, 0x2d, 0x05, 0x36, + 0xd2, 0x12, 0xb1, 0x61, 0x92, 0x37, 0x93, 0x4c, + 0x26, 0xf3, 0x3d, 0x39, 0xef, 0x79, 0x4f, 0xce, + 0x88, 0x35, 0x6b, 0xd6, 0x38, 0xf4, 0xe0, 0xa5, + 0x02, 0xcc, 0x9f, 0x3f, 0xbf, 0x47, 0x0e, 0x2f, + 0x29, 0x29, 0x71, 0x01, 0x00, 0xea, 0xea, 0xea, + 0xfe, 0xd7, 0xc3, 0x43, 0xa1, 0x10, 0xc0, 0x4d, + 0x00, 0xc7, 0xe9, 0x19, 0x27, 0x1e, 0x4c, 0x80, + 0x8d, 0x15, 0x17, 0xd8, 0x55, 0x59, 0x4b, 0x75, + 0xfd, 0x75, 0x00, 0x06, 0xf5, 0xf2, 0x32, 0x35, + 0x27, 0x9d, 0x67, 0x47, 0x65, 0xde, 0x3f, 0x80, + 0xf3, 0x0d, 0x61, 0x5e, 0x5f, 0x7f, 0x90, 0x7d, + 0x67, 0xeb, 0xe8, 0x1f, 0x4c, 0x61, 0xea, 0xb0, + 0x0c, 0x8a, 0x46, 0xf5, 0x46, 0x00, 0x7f, 0xd7, + 0xb7, 0xb0, 0x7c, 0xfb, 0x09, 0x16, 0xfe, 0xb0, + 0x9f, 0x82, 0xec, 0xde, 0xac, 0x98, 0x33, 0x96, + 0xcc, 0x80, 0xf5, 0xdf, 0x01, 0x7c, 0xb9, 0xa7, + 0x8a, 0x65, 0x65, 0xc7, 0x98, 0x99, 0x9f, 0xc5, + 0xde, 0x77, 0x1f, 0x63, 0x44, 0x46, 0x2a, 0xd5, + 0x57, 0x9b, 0xb9, 0xdc, 0x14, 0x46, 0x91, 0x82, + 0x7e, 0x01, 0x2f, 0xab, 0xe7, 0x4e, 0xe1, 0xd4, + 0xe5, 0x06, 0x8a, 0x7f, 0x3e, 0xc0, 0xe4, 0x55, + 0xdb, 0x58, 0x32, 0x7d, 0x24, 0x2f, 0x8e, 0x1f, + 0xd4, 0x75, 0x00, 0xdb, 0xb6, 0x93, 0xbe, 0xf0, + 0xf6, 0xa6, 0x23, 0x94, 0x9e, 0xa8, 0x61, 0xdd, + 0xfc, 0x42, 0xf2, 0x33, 0x83, 0xac, 0xda, 0x71, + 0x94, 0x4d, 0x47, 0xaa, 0xb0, 0x1d, 0x1b, 0x5d, + 0x15, 0x68, 0x8a, 0x40, 0x95, 0x02, 0x45, 0x0a, + 0x5e, 0x98, 0x38, 0x82, 0xd5, 0x73, 0xa7, 0xf0, + 0xd2, 0xa4, 0x61, 0xcc, 0xfd, 0x7a, 0x27, 0xa7, + 0xaf, 0x34, 0xb1, 0xec, 0xa9, 0xfc, 0x7f, 0x05, + 0x90, 0x9d, 0x2b, 0x70, 0xbb, 0xbe, 0x2a, 0xaf, + 0xa2, 0xf4, 0x44, 0x0d, 0xdb, 0x16, 0xcd, 0x22, + 0xd6, 0xd6, 0xc6, 0xec, 0xcf, 0x4b, 0x59, 0x7f, + 0xa8, 0x12, 0x4d, 0x71, 0xf0, 0x9b, 0x0a, 0x01, + 0x4b, 0x21, 0xd5, 0x52, 0x48, 0xf5, 0xb8, 0xf7, + 0xcd, 0x47, 0x4f, 0xf1, 0xc6, 0xba, 0x6d, 0x04, + 0x2c, 0x95, 0xdf, 0xdf, 0x79, 0x86, 0x0d, 0x15, + 0x35, 0x7c, 0x7b, 0xe0, 0x6c, 0xd2, 0x6f, 0xdf, + 0x15, 0xe0, 0x7c, 0x43, 0x98, 0xe2, 0x5f, 0xfe, + 0xe2, 0xc7, 0x57, 0x8a, 0x38, 0x73, 0xa5, 0x91, + 0x85, 0xdf, 0xed, 0x22, 0x12, 0x8b, 0xe2, 0x33, + 0x25, 0x7e, 0xcb, 0x3d, 0x3c, 0xa1, 0xce, 0x10, + 0x91, 0xd6, 0x08, 0xab, 0x76, 0x96, 0x13, 0x6e, + 0x8d, 0xb2, 0xf9, 0xb5, 0xe9, 0x2c, 0x2d, 0x3b, + 0x4e, 0x4d, 0x73, 0xa4, 0xfb, 0x00, 0x6f, 0x6e, + 0x3c, 0xcc, 0xbc, 0x09, 0x43, 0xc9, 0x0e, 0xf9, + 0x58, 0xbe, 0x65, 0x3f, 0x5e, 0x5d, 0xe2, 0x33, + 0x94, 0x0e, 0x75, 0x86, 0x48, 0xf5, 0xa8, 0x2e, + 0x80, 0x47, 0x25, 0xe8, 0x51, 0xf1, 0xea, 0x82, + 0x6f, 0xf6, 0x1e, 0x60, 0x68, 0x7a, 0x80, 0x79, + 0x13, 0x72, 0x58, 0x52, 0x56, 0xd1, 0x7d, 0x80, + 0x3f, 0xce, 0x5d, 0x63, 0xd1, 0x93, 0xf9, 0xac, + 0xdc, 0x71, 0x98, 0x6b, 0xe1, 0x08, 0x29, 0x86, + 0x82, 0xd7, 0x90, 0xf8, 0x4c, 0x57, 0x7e, 0x53, + 0x76, 0xd8, 0x90, 0xa8, 0x42, 0xd0, 0x73, 0xb3, + 0x12, 0x8e, 0x13, 0x63, 0xe7, 0xc9, 0x4a, 0x16, + 0x17, 0x3e, 0xc4, 0x6f, 0x55, 0x75, 0xdd, 0x03, + 0xd8, 0x74, 0xec, 0x12, 0xfd, 0x83, 0x29, 0xe4, + 0xa4, 0xfb, 0xd9, 0x70, 0xe8, 0x0c, 0x1e, 0x5d, + 0xe2, 0xd1, 0x25, 0x29, 0x86, 0xc4, 0x6b, 0x28, + 0xf8, 0x4c, 0x57, 0xb7, 0xf6, 0x41, 0xa2, 0x0a, + 0x37, 0x75, 0xec, 0xe2, 0x79, 0xb2, 0x43, 0x7e, + 0xd2, 0x52, 0xbc, 0xec, 0xaa, 0xaa, 0x4d, 0x0a, + 0x90, 0x34, 0x86, 0xbb, 0xab, 0xaf, 0xf2, 0x78, + 0x6e, 0x06, 0x95, 0xb5, 0x8d, 0x68, 0x0a, 0x58, + 0x9a, 0xec, 0x80, 0xf0, 0x76, 0x02, 0xf1, 0xe8, + 0x12, 0x4b, 0x13, 0x18, 0xaa, 0x44, 0x53, 0x04, + 0x8a, 0x04, 0x21, 0x04, 0xb6, 0xe3, 0x10, 0x6f, + 0x73, 0x88, 0xc6, 0x6d, 0x5a, 0xa2, 0x51, 0x8a, + 0xf2, 0xfa, 0x71, 0xf0, 0x62, 0x3d, 0x8f, 0x66, + 0xf7, 0xbe, 0x23, 0x05, 0x49, 0x01, 0xce, 0x5e, + 0x0b, 0x33, 0x63, 0x60, 0x5f, 0xe2, 0xb6, 0x8d, + 0xa1, 0x4a, 0x4c, 0x4d, 0x62, 0x6a, 0x02, 0x4b, + 0x97, 0x78, 0x8d, 0xce, 0xd5, 0x90, 0x58, 0x9a, + 0x2b, 0x5d, 0x75, 0xa3, 0x28, 0x00, 0xdb, 0x71, + 0x88, 0xb5, 0x39, 0x44, 0xe3, 0x0e, 0xd7, 0xa3, + 0x37, 0x18, 0x9a, 0xee, 0xa3, 0xfc, 0xf4, 0xb5, + 0xa4, 0xb3, 0x26, 0xf9, 0x20, 0x12, 0x20, 0x04, + 0x98, 0x9a, 0x82, 0xa1, 0x0a, 0x0c, 0x55, 0xb8, + 0x10, 0xaa, 0xbc, 0xa5, 0x1a, 0x29, 0x86, 0x82, + 0x57, 0x97, 0x58, 0xba, 0xc4, 0x50, 0xdd, 0x79, + 0x20, 0x04, 0xd8, 0x0e, 0xb4, 0xc6, 0x6d, 0x22, + 0x31, 0x07, 0xa5, 0x7d, 0x46, 0x48, 0x21, 0xba, + 0x0e, 0x30, 0x28, 0xe8, 0xa1, 0xfa, 0x6a, 0x33, + 0x52, 0xb8, 0x83, 0x46, 0x57, 0x5d, 0x19, 0x9a, + 0x2b, 0x4b, 0xef, 0x04, 0x61, 0xca, 0x76, 0x2b, + 0x5c, 0x1b, 0x84, 0x80, 0x36, 0x1b, 0xa2, 0x71, + 0x81, 0xaa, 0xd8, 0xf8, 0x4c, 0x93, 0x13, 0x35, + 0x4d, 0x64, 0x05, 0xad, 0xa4, 0x00, 0x49, 0x9b, + 0x70, 0x72, 0x56, 0x90, 0x5f, 0x4f, 0x5e, 0x24, + 0x23, 0xe0, 0x25, 0xd5, 0xd2, 0x51, 0x65, 0x3b, + 0x48, 0xbb, 0x12, 0xb6, 0x58, 0x9a, 0xc0, 0xd3, + 0x1e, 0x4f, 0xbf, 0xe9, 0x36, 0x5e, 0xd0, 0xa3, + 0x12, 0xb0, 0x12, 0x51, 0xd5, 0xb1, 0x34, 0x83, + 0x2d, 0x15, 0xe7, 0x19, 0x9b, 0x11, 0xe8, 0x7a, + 0x0a, 0x8a, 0x86, 0xa6, 0x71, 0xb1, 0x31, 0xcc, + 0x85, 0x86, 0x16, 0x8a, 0x46, 0x66, 0xa3, 0x48, + 0xb7, 0xbc, 0xaa, 0x92, 0x18, 0xbd, 0xa0, 0x25, + 0x40, 0x54, 0xd7, 0x02, 0x9f, 0x29, 0x3b, 0x12, + 0xe1, 0x37, 0xdd, 0xfe, 0x18, 0x14, 0xca, 0xa4, + 0xa6, 0xa9, 0x99, 0x70, 0x2c, 0xca, 0xc3, 0x19, + 0xc1, 0xee, 0xcd, 0x81, 0x89, 0x03, 0x53, 0x59, + 0xb9, 0xbd, 0x82, 0xb9, 0xe3, 0xf3, 0xf0, 0xe8, + 0x2a, 0x42, 0x80, 0x14, 0xae, 0x97, 0xae, 0xaf, + 0x74, 0x00, 0x25, 0x7a, 0x24, 0x51, 0x05, 0xaf, + 0xa1, 0xe0, 0x35, 0x4c, 0x06, 0x04, 0xb3, 0xf8, + 0xb4, 0xec, 0x08, 0x4f, 0x0f, 0x0f, 0x75, 0x7f, + 0x10, 0x15, 0x17, 0x0e, 0x63, 0xed, 0xbe, 0xd3, + 0x54, 0xd7, 0x35, 0xb3, 0xb8, 0x70, 0x22, 0x29, + 0xba, 0x7e, 0x8b, 0x77, 0xe2, 0x36, 0x2f, 0x5d, + 0x40, 0xda, 0x1b, 0x4e, 0xa1, 0xaf, 0x3f, 0x87, + 0x53, 0x97, 0xeb, 0x59, 0xf7, 0xe7, 0x19, 0x16, + 0x8c, 0x1f, 0xdc, 0x7d, 0x80, 0x34, 0x8f, 0xce, + 0x7b, 0x53, 0x87, 0x30, 0xeb, 0xb3, 0xad, 0x78, + 0x75, 0x93, 0x97, 0xa7, 0x3c, 0x82, 0xa9, 0xa9, + 0xd8, 0x8e, 0x83, 0xed, 0xb8, 0x8d, 0xd6, 0x66, + 0x3b, 0xc4, 0xed, 0xf6, 0xc8, 0xc5, 0x1c, 0x5a, + 0xa2, 0x36, 0x2d, 0x51, 0x15, 0x9f, 0x39, 0x9c, + 0xc6, 0x88, 0x60, 0xda, 0x8a, 0x52, 0x8a, 0x0b, + 0x73, 0xf0, 0xe9, 0xea, 0xdd, 0x01, 0x6c, 0xdb, + 0xbe, 0x43, 0xcf, 0xe5, 0xf5, 0x61, 0xce, 0x88, + 0xde, 0x14, 0x7c, 0xfc, 0x13, 0x0d, 0xe1, 0x38, + 0x1f, 0xcc, 0x9a, 0x4e, 0xc1, 0xe0, 0x21, 0xe8, + 0x8a, 0x4e, 0xac, 0xcd, 0xa1, 0x35, 0xee, 0x66, + 0x3d, 0x12, 0xb3, 0xb9, 0x11, 0x97, 0xe8, 0x4a, + 0x7f, 0x02, 0x56, 0x1e, 0x15, 0x17, 0x9a, 0x18, + 0xb9, 0x64, 0x3d, 0xaf, 0x16, 0xf4, 0x63, 0x62, + 0xbf, 0x5e, 0x49, 0xbf, 0x9d, 0xb8, 0xee, 0xba, + 0x90, 0xbc, 0x35, 0x29, 0x9b, 0x9c, 0x5e, 0x16, + 0x73, 0xbe, 0x28, 0x63, 0xf6, 0xe8, 0x2c, 0x96, + 0xce, 0x1e, 0xc7, 0x13, 0xc3, 0x73, 0xb9, 0x1e, + 0xbd, 0xc1, 0x8d, 0x78, 0x14, 0x55, 0x4a, 0x3c, + 0xba, 0x81, 0xa1, 0xea, 0xd4, 0x36, 0xb7, 0xb0, + 0x60, 0xed, 0x6e, 0x4a, 0x2b, 0xce, 0xf1, 0xc9, + 0x8c, 0xc1, 0x14, 0x64, 0x86, 0xee, 0xba, 0x69, + 0x75, 0x69, 0x23, 0x9a, 0x9d, 0x9b, 0xce, 0xa4, + 0x01, 0xa9, 0xac, 0x28, 0xaf, 0x66, 0xfc, 0x47, + 0xeb, 0x09, 0xa5, 0x58, 0x4c, 0xcf, 0xcb, 0x24, + 0xb7, 0x8f, 0x1f, 0x29, 0x05, 0x95, 0xb5, 0x4d, + 0x6c, 0x3d, 0x7e, 0x81, 0x86, 0x70, 0x84, 0x99, + 0xc3, 0x43, 0x7c, 0xff, 0xfc, 0x68, 0xfc, 0xba, + 0xd6, 0xa5, 0x3d, 0xb3, 0xcb, 0x3b, 0x61, 0x2f, + 0x4b, 0xe3, 0xc3, 0x69, 0xc3, 0x60, 0x1a, 0xec, + 0xbf, 0xd4, 0xc8, 0xd1, 0xda, 0x66, 0xf6, 0x9c, + 0xaa, 0x47, 0x0a, 0x18, 0x18, 0x30, 0x79, 0xff, + 0xb1, 0x01, 0xe4, 0xa7, 0xf9, 0x3b, 0xde, 0xef, + 0xea, 0x92, 0x7b, 0x4f, 0x5b, 0xf1, 0xb8, 0xbe, + 0x7e, 0xc6, 0xf5, 0xf5, 0xdf, 0xf1, 0xfc, 0x5e, + 0x56, 0xfb, 0x07, 0xf3, 0xbf, 0xe0, 0xbe, 0x00, + 0x8c, 0x19, 0x33, 0xa6, 0xe7, 0x00, 0x4a, 0x4a, + 0x4a, 0x7a, 0xe4, 0x70, 0x80, 0x7f, 0x00, 0x9e, + 0xdd, 0xc8, 0x46, 0x68, 0x1f, 0x4e, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, + 0x42, 0x60, 0x82 +}; /* End Of File */ /* circular_6_small.png - 678 bytes */ unsigned char circular_6_small_png[678] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, - 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, - 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, - 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, - 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, - 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x02, 0x02, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, - 0x3d, 0x6b, 0x54, 0x41, 0x14, 0x86, 0x9f, 0xb9, - 0x33, 0xf7, 0x73, 0xef, 0x7e, 0x67, 0x13, 0xdd, - 0xdc, 0xa8, 0xa0, 0x01, 0x11, 0x51, 0x63, 0xb0, - 0x5b, 0x9b, 0xf5, 0x07, 0x44, 0x59, 0x1b, 0x41, - 0x1b, 0xab, 0x14, 0x36, 0x4a, 0x2a, 0xab, 0x60, - 0x2b, 0x58, 0x28, 0x04, 0x52, 0xd9, 0x88, 0x95, - 0x1b, 0x35, 0x76, 0xe2, 0x27, 0x82, 0xb0, 0x8a, - 0x84, 0x18, 0x21, 0x2a, 0x08, 0xc1, 0x18, 0x05, - 0x13, 0x31, 0x10, 0x37, 0x46, 0xb3, 0x77, 0xd6, - 0x62, 0xdd, 0xab, 0x37, 0x6b, 0x21, 0xfa, 0x96, - 0x73, 0xce, 0xfb, 0xcc, 0x7b, 0xce, 0x8c, 0x18, - 0x1f, 0x1f, 0x6f, 0xf2, 0x1f, 0x52, 0x00, 0x95, - 0x4a, 0xe5, 0x9f, 0xcc, 0xd5, 0x6a, 0xb5, 0x05, - 0xd0, 0x5a, 0xc7, 0x0a, 0x67, 0x6e, 0x4c, 0x71, - 0x6d, 0x7a, 0x9e, 0xb5, 0xf5, 0x10, 0x00, 0xc7, - 0x94, 0x1c, 0xdd, 0xdb, 0xc7, 0x85, 0xc3, 0x03, - 0x7f, 0x4e, 0xd0, 0x06, 0xbc, 0x5b, 0x5e, 0xa5, - 0x74, 0xe9, 0x5e, 0x64, 0x6c, 0x6b, 0x3d, 0xd4, - 0x5c, 0x7d, 0x36, 0x47, 0xf5, 0xf9, 0x3c, 0x8f, - 0x4e, 0x95, 0x09, 0x32, 0x5e, 0x54, 0x33, 0x00, - 0xc2, 0x30, 0x24, 0x0c, 0x43, 0x4a, 0x17, 0x7f, - 0x99, 0x85, 0x80, 0xb4, 0x2b, 0x29, 0x66, 0x4c, - 0xb6, 0xe6, 0x2c, 0xb6, 0x17, 0x1c, 0xa4, 0x68, - 0x52, 0x1e, 0xbb, 0x1f, 0xf5, 0x47, 0x00, 0xad, - 0x35, 0x23, 0x93, 0xd3, 0xac, 0x35, 0x5a, 0x87, - 0xb6, 0x12, 0x6c, 0x4a, 0x99, 0x14, 0x33, 0x26, - 0xbd, 0x19, 0x8b, 0x20, 0x6b, 0xb2, 0x25, 0x67, - 0xb2, 0xaf, 0xcf, 0xa3, 0xa1, 0x35, 0xe7, 0x6e, - 0xbf, 0x88, 0x52, 0x47, 0x23, 0x5c, 0x9f, 0x79, - 0x1f, 0x99, 0x0b, 0x49, 0x93, 0x2e, 0x5f, 0x91, - 0x4b, 0x48, 0x52, 0x8e, 0xc4, 0xb3, 0x0c, 0x2c, - 0x25, 0x10, 0x40, 0xfd, 0x9b, 0x66, 0x62, 0x66, - 0x81, 0xb3, 0xe5, 0x9d, 0x71, 0x40, 0xfb, 0xf6, - 0xac, 0xa7, 0xe8, 0xf2, 0x15, 0xdd, 0x49, 0x45, - 0x3e, 0xa1, 0xc8, 0x26, 0x24, 0xbe, 0x2d, 0xb1, - 0x95, 0x40, 0x08, 0xf0, 0x2c, 0x83, 0xb1, 0x87, - 0x8b, 0x9d, 0x09, 0x00, 0x7c, 0x5b, 0x92, 0x76, - 0x25, 0x59, 0x4f, 0x92, 0x4f, 0x28, 0xba, 0x53, - 0x2d, 0x48, 0xda, 0x95, 0xb8, 0xa6, 0x81, 0x10, - 0x60, 0x1a, 0x82, 0xdf, 0x3d, 0x11, 0xc0, 0x51, - 0x06, 0x86, 0x00, 0xdf, 0x31, 0x48, 0x3a, 0x2d, - 0x50, 0xce, 0xfb, 0x99, 0xc4, 0x57, 0xf8, 0xb6, - 0x44, 0x00, 0x8f, 0xdf, 0xd4, 0xd9, 0x96, 0xb7, - 0x23, 0x40, 0xb4, 0xc4, 0xa1, 0x5d, 0x3d, 0x7c, - 0x5d, 0xd7, 0x58, 0xd2, 0xc0, 0xb3, 0x0c, 0x7c, - 0xc7, 0x20, 0xe5, 0x4a, 0x72, 0x09, 0x45, 0x4f, - 0xd2, 0x24, 0xc8, 0x9a, 0xb8, 0x96, 0x60, 0x62, - 0xea, 0x33, 0x27, 0x06, 0x7a, 0x3b, 0x01, 0xa3, - 0x87, 0xfa, 0x71, 0x94, 0xc1, 0xeb, 0x8f, 0x6b, - 0x7c, 0x6f, 0x68, 0x2c, 0x29, 0xb0, 0x95, 0xc0, - 0x35, 0x5b, 0x20, 0x29, 0x04, 0xa3, 0xb7, 0x3e, - 0x50, 0x4c, 0x5b, 0x1c, 0xdb, 0x1d, 0xc4, 0x01, - 0xed, 0x77, 0xbd, 0x79, 0x7c, 0x3f, 0x4d, 0x0d, - 0x77, 0x66, 0x57, 0x78, 0x32, 0x57, 0x67, 0x79, - 0x35, 0x64, 0xe9, 0x4b, 0x83, 0x2b, 0xb5, 0x4f, - 0x94, 0xce, 0xbf, 0x62, 0x69, 0x25, 0xe4, 0xf2, - 0x91, 0x3d, 0xb1, 0x7f, 0x10, 0x5b, 0x62, 0x97, - 0xab, 0x78, 0x70, 0xf2, 0x00, 0x63, 0x4f, 0xdf, - 0x32, 0x39, 0xbb, 0xc8, 0xdd, 0x97, 0x0b, 0x00, - 0xf4, 0x17, 0x1c, 0x4e, 0x1f, 0x0c, 0x18, 0xda, - 0xb1, 0x39, 0xb6, 0xc0, 0x0e, 0x40, 0x5b, 0xc3, - 0x83, 0x01, 0xc3, 0x83, 0x01, 0x1b, 0xb5, 0xb1, - 0x2f, 0x02, 0xd4, 0x6a, 0xb5, 0x8e, 0xc2, 0xdf, - 0xea, 0x07, 0x14, 0x72, 0xcc, 0x59, 0x90, 0x52, - 0x68, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, - 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, + 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, + 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, + 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, + 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x02, 0x02, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, + 0x3d, 0x6b, 0x54, 0x41, 0x14, 0x86, 0x9f, 0xb9, + 0x33, 0xf7, 0x73, 0xef, 0x7e, 0x67, 0x13, 0xdd, + 0xdc, 0xa8, 0xa0, 0x01, 0x11, 0x51, 0x63, 0xb0, + 0x5b, 0x9b, 0xf5, 0x07, 0x44, 0x59, 0x1b, 0x41, + 0x1b, 0xab, 0x14, 0x36, 0x4a, 0x2a, 0xab, 0x60, + 0x2b, 0x58, 0x28, 0x04, 0x52, 0xd9, 0x88, 0x95, + 0x1b, 0x35, 0x76, 0xe2, 0x27, 0x82, 0xb0, 0x8a, + 0x84, 0x18, 0x21, 0x2a, 0x08, 0xc1, 0x18, 0x05, + 0x13, 0x31, 0x10, 0x37, 0x46, 0xb3, 0x77, 0xd6, + 0x62, 0xdd, 0xab, 0x37, 0x6b, 0x21, 0xfa, 0x96, + 0x73, 0xce, 0xfb, 0xcc, 0x7b, 0xce, 0x8c, 0x18, + 0x1f, 0x1f, 0x6f, 0xf2, 0x1f, 0x52, 0x00, 0x95, + 0x4a, 0xe5, 0x9f, 0xcc, 0xd5, 0x6a, 0xb5, 0x05, + 0xd0, 0x5a, 0xc7, 0x0a, 0x67, 0x6e, 0x4c, 0x71, + 0x6d, 0x7a, 0x9e, 0xb5, 0xf5, 0x10, 0x00, 0xc7, + 0x94, 0x1c, 0xdd, 0xdb, 0xc7, 0x85, 0xc3, 0x03, + 0x7f, 0x4e, 0xd0, 0x06, 0xbc, 0x5b, 0x5e, 0xa5, + 0x74, 0xe9, 0x5e, 0x64, 0x6c, 0x6b, 0x3d, 0xd4, + 0x5c, 0x7d, 0x36, 0x47, 0xf5, 0xf9, 0x3c, 0x8f, + 0x4e, 0x95, 0x09, 0x32, 0x5e, 0x54, 0x33, 0x00, + 0xc2, 0x30, 0x24, 0x0c, 0x43, 0x4a, 0x17, 0x7f, + 0x99, 0x85, 0x80, 0xb4, 0x2b, 0x29, 0x66, 0x4c, + 0xb6, 0xe6, 0x2c, 0xb6, 0x17, 0x1c, 0xa4, 0x68, + 0x52, 0x1e, 0xbb, 0x1f, 0xf5, 0x47, 0x00, 0xad, + 0x35, 0x23, 0x93, 0xd3, 0xac, 0x35, 0x5a, 0x87, + 0xb6, 0x12, 0x6c, 0x4a, 0x99, 0x14, 0x33, 0x26, + 0xbd, 0x19, 0x8b, 0x20, 0x6b, 0xb2, 0x25, 0x67, + 0xb2, 0xaf, 0xcf, 0xa3, 0xa1, 0x35, 0xe7, 0x6e, + 0xbf, 0x88, 0x52, 0x47, 0x23, 0x5c, 0x9f, 0x79, + 0x1f, 0x99, 0x0b, 0x49, 0x93, 0x2e, 0x5f, 0x91, + 0x4b, 0x48, 0x52, 0x8e, 0xc4, 0xb3, 0x0c, 0x2c, + 0x25, 0x10, 0x40, 0xfd, 0x9b, 0x66, 0x62, 0x66, + 0x81, 0xb3, 0xe5, 0x9d, 0x71, 0x40, 0xfb, 0xf6, + 0xac, 0xa7, 0xe8, 0xf2, 0x15, 0xdd, 0x49, 0x45, + 0x3e, 0xa1, 0xc8, 0x26, 0x24, 0xbe, 0x2d, 0xb1, + 0x95, 0x40, 0x08, 0xf0, 0x2c, 0x83, 0xb1, 0x87, + 0x8b, 0x9d, 0x09, 0x00, 0x7c, 0x5b, 0x92, 0x76, + 0x25, 0x59, 0x4f, 0x92, 0x4f, 0x28, 0xba, 0x53, + 0x2d, 0x48, 0xda, 0x95, 0xb8, 0xa6, 0x81, 0x10, + 0x60, 0x1a, 0x82, 0xdf, 0x3d, 0x11, 0xc0, 0x51, + 0x06, 0x86, 0x00, 0xdf, 0x31, 0x48, 0x3a, 0x2d, + 0x50, 0xce, 0xfb, 0x99, 0xc4, 0x57, 0xf8, 0xb6, + 0x44, 0x00, 0x8f, 0xdf, 0xd4, 0xd9, 0x96, 0xb7, + 0x23, 0x40, 0xb4, 0xc4, 0xa1, 0x5d, 0x3d, 0x7c, + 0x5d, 0xd7, 0x58, 0xd2, 0xc0, 0xb3, 0x0c, 0x7c, + 0xc7, 0x20, 0xe5, 0x4a, 0x72, 0x09, 0x45, 0x4f, + 0xd2, 0x24, 0xc8, 0x9a, 0xb8, 0x96, 0x60, 0x62, + 0xea, 0x33, 0x27, 0x06, 0x7a, 0x3b, 0x01, 0xa3, + 0x87, 0xfa, 0x71, 0x94, 0xc1, 0xeb, 0x8f, 0x6b, + 0x7c, 0x6f, 0x68, 0x2c, 0x29, 0xb0, 0x95, 0xc0, + 0x35, 0x5b, 0x20, 0x29, 0x04, 0xa3, 0xb7, 0x3e, + 0x50, 0x4c, 0x5b, 0x1c, 0xdb, 0x1d, 0xc4, 0x01, + 0xed, 0x77, 0xbd, 0x79, 0x7c, 0x3f, 0x4d, 0x0d, + 0x77, 0x66, 0x57, 0x78, 0x32, 0x57, 0x67, 0x79, + 0x35, 0x64, 0xe9, 0x4b, 0x83, 0x2b, 0xb5, 0x4f, + 0x94, 0xce, 0xbf, 0x62, 0x69, 0x25, 0xe4, 0xf2, + 0x91, 0x3d, 0xb1, 0x7f, 0x10, 0x5b, 0x62, 0x97, + 0xab, 0x78, 0x70, 0xf2, 0x00, 0x63, 0x4f, 0xdf, + 0x32, 0x39, 0xbb, 0xc8, 0xdd, 0x97, 0x0b, 0x00, + 0xf4, 0x17, 0x1c, 0x4e, 0x1f, 0x0c, 0x18, 0xda, + 0xb1, 0x39, 0xb6, 0xc0, 0x0e, 0x40, 0x5b, 0xc3, + 0x83, 0x01, 0xc3, 0x83, 0x01, 0x1b, 0xb5, 0xb1, + 0x2f, 0x02, 0xd4, 0x6a, 0xb5, 0x8e, 0xc2, 0xdf, + 0xea, 0x07, 0x14, 0x72, 0xcc, 0x59, 0x90, 0x52, + 0x68, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* circular_7.png - 1563 bytes */ unsigned char circular_7_png[1563] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x05, 0x77, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xcd, 0x97, - 0x5b, 0x6c, 0x54, 0x55, 0x14, 0x86, 0xbf, 0x7d, - 0xee, 0x73, 0xed, 0x65, 0xa6, 0x40, 0x4b, 0x81, - 0x52, 0x68, 0x81, 0x52, 0xea, 0x00, 0x12, 0x28, - 0x57, 0x01, 0x01, 0xa1, 0x8a, 0x94, 0xf8, 0x40, - 0x62, 0x0c, 0x4a, 0x42, 0x0d, 0x18, 0x24, 0x80, - 0x12, 0x85, 0xc4, 0x84, 0x10, 0x22, 0x51, 0xa3, - 0x18, 0x34, 0x0d, 0xe3, 0x03, 0x98, 0x78, 0xc1, - 0x28, 0x44, 0x04, 0x2c, 0x0a, 0x46, 0x08, 0x72, - 0x29, 0x02, 0x96, 0x5a, 0xe5, 0x56, 0x68, 0x5a, - 0x08, 0xb4, 0xd0, 0x69, 0x4b, 0xc1, 0xb6, 0xd0, - 0x32, 0xc7, 0x87, 0x33, 0x53, 0xa6, 0x94, 0xe9, - 0x80, 0x31, 0xd6, 0x93, 0xfc, 0x39, 0xe7, 0x61, - 0x66, 0xaf, 0xef, 0xac, 0x7f, 0xad, 0xb5, 0xf7, - 0x11, 0x9b, 0x36, 0x6d, 0x32, 0xe9, 0xc6, 0x4b, - 0x01, 0x28, 0x28, 0x28, 0xe8, 0x96, 0xe0, 0x7e, - 0xbf, 0xdf, 0x02, 0x00, 0x08, 0x04, 0x02, 0xff, - 0x69, 0x70, 0x8f, 0xc7, 0x03, 0x70, 0x0f, 0xc0, - 0x34, 0xbb, 0xc7, 0x89, 0x47, 0x02, 0x28, 0xae, - 0x0c, 0x50, 0x78, 0xa8, 0x9c, 0x43, 0x17, 0xaf, - 0xd3, 0x78, 0xbb, 0x95, 0xf0, 0x5f, 0x84, 0x00, - 0xb7, 0xae, 0x32, 0xb6, 0xbf, 0x97, 0xc5, 0xe3, - 0x33, 0x18, 0xdd, 0xcf, 0xf3, 0xef, 0x02, 0x14, - 0x57, 0x06, 0x58, 0xba, 0xfd, 0x24, 0xf5, 0x2d, - 0xad, 0xcc, 0xcf, 0xcd, 0x64, 0xe1, 0xa4, 0x6c, - 0x72, 0x52, 0x13, 0x49, 0xf3, 0xb8, 0x00, 0xa8, - 0xa8, 0xbd, 0x49, 0xe9, 0xe5, 0x3a, 0x0e, 0x9c, - 0xbf, 0xc2, 0x0b, 0x9f, 0x1f, 0x25, 0xc1, 0x50, - 0xf9, 0x70, 0xee, 0x88, 0x87, 0x02, 0x89, 0x09, - 0xb0, 0xfc, 0xdb, 0x12, 0x8a, 0xce, 0x54, 0xb3, - 0x74, 0x6a, 0x36, 0x8b, 0x26, 0x65, 0x71, 0xfe, - 0xda, 0x0d, 0xbe, 0x39, 0x51, 0xc1, 0x8a, 0xaf, - 0x8f, 0x72, 0xb1, 0xb6, 0x11, 0xbb, 0xa6, 0x30, - 0x34, 0x25, 0x81, 0x99, 0x43, 0x53, 0x59, 0x30, - 0x76, 0x10, 0x6f, 0xe5, 0x8d, 0xe4, 0xa3, 0xfd, - 0x65, 0xbc, 0xf8, 0x65, 0x31, 0x4f, 0x67, 0xa5, - 0xf0, 0xce, 0x33, 0x8f, 0xfd, 0x73, 0x80, 0x15, - 0x3b, 0x4a, 0x38, 0x5c, 0x59, 0xcf, 0xbe, 0x65, - 0x79, 0x28, 0x92, 0x44, 0xde, 0xc6, 0x3d, 0x1c, - 0xaf, 0xbc, 0x0e, 0x58, 0x69, 0xd7, 0x15, 0x81, - 0x24, 0x82, 0x94, 0x5f, 0xab, 0xa3, 0x30, 0x50, - 0x8f, 0xff, 0x60, 0x19, 0x63, 0xd2, 0x7b, 0xb2, - 0x66, 0xf6, 0x68, 0xf2, 0x7d, 0x69, 0xe4, 0x17, - 0xee, 0xe5, 0x8d, 0x5d, 0xa7, 0x78, 0x3b, 0x2f, - 0x27, 0x2a, 0x80, 0x14, 0x7e, 0x08, 0x06, 0x83, - 0x1d, 0x14, 0x0e, 0x7e, 0xec, 0xcd, 0x7c, 0x7e, - 0xbb, 0x54, 0xcb, 0x94, 0xf7, 0x77, 0xb5, 0x07, - 0xd7, 0x14, 0x81, 0x53, 0x97, 0x71, 0x19, 0x11, - 0xd2, 0x65, 0xdc, 0x36, 0x99, 0x33, 0xd5, 0xb5, - 0xcc, 0xfb, 0x64, 0x37, 0x67, 0x6b, 0xea, 0xf8, - 0x75, 0x55, 0x3e, 0x07, 0x2e, 0x04, 0x58, 0xfd, - 0xfd, 0xa9, 0x4e, 0xeb, 0x77, 0x99, 0x81, 0x63, - 0x55, 0x75, 0x14, 0x9d, 0xa9, 0x61, 0xdf, 0xb2, - 0x3c, 0xbe, 0x3a, 0x7e, 0x81, 0x25, 0x5b, 0x0f, - 0x59, 0xb4, 0x02, 0x0c, 0x55, 0x0a, 0x49, 0xa0, - 0x2b, 0x12, 0x9a, 0x2c, 0x50, 0x65, 0x81, 0x22, - 0x0b, 0x14, 0x09, 0x24, 0x21, 0x10, 0x02, 0x3e, - 0xde, 0x7f, 0x12, 0xbb, 0x26, 0xb3, 0x6b, 0xc9, - 0x0c, 0x26, 0xbf, 0xb7, 0x93, 0xb9, 0xc3, 0x52, - 0xf1, 0xa5, 0xc4, 0x47, 0xcf, 0x80, 0x69, 0x9a, - 0xed, 0x5a, 0xf1, 0x5d, 0x29, 0xaf, 0x4e, 0xc9, - 0xe6, 0x6e, 0xd0, 0x64, 0xcd, 0xae, 0x13, 0x00, - 0xc8, 0x92, 0xc0, 0xa1, 0xcb, 0x38, 0x75, 0x29, - 0x24, 0xeb, 0xd9, 0x65, 0x58, 0x72, 0x1b, 0x12, - 0x2e, 0xc3, 0xca, 0x42, 0x9c, 0x4d, 0x46, 0x93, - 0x4d, 0x0a, 0xf7, 0x9f, 0xc0, 0x6d, 0xa8, 0x2c, - 0x9f, 0x3e, 0x8c, 0xd5, 0x45, 0xa5, 0x1d, 0x62, - 0x44, 0x05, 0x38, 0x56, 0x55, 0x47, 0x7d, 0x4b, - 0x2b, 0x4b, 0xa6, 0x0c, 0x65, 0xe5, 0xb6, 0x62, - 0x6a, 0x6f, 0xb5, 0x58, 0xc1, 0x35, 0xc9, 0x52, - 0x04, 0x84, 0xcb, 0x90, 0x3b, 0x58, 0xe1, 0x36, - 0x64, 0xdc, 0x86, 0x84, 0xdb, 0xb0, 0x20, 0x0c, - 0x15, 0x3e, 0x3d, 0x52, 0x42, 0xc1, 0x84, 0x2c, - 0x2e, 0x37, 0xdc, 0xa1, 0xf4, 0x6a, 0x7d, 0x27, - 0x80, 0x4e, 0x16, 0xf8, 0x8f, 0x56, 0x30, 0x3f, - 0x37, 0x93, 0xaa, 0xba, 0x5b, 0xfc, 0x52, 0x5e, - 0x8d, 0x24, 0xc0, 0xae, 0x49, 0x1d, 0x64, 0xd3, - 0x24, 0x6c, 0xaa, 0xc0, 0x50, 0x25, 0x74, 0x45, - 0xa0, 0x85, 0xac, 0x50, 0x64, 0x81, 0x1c, 0xb6, - 0x01, 0x30, 0x81, 0xf2, 0xeb, 0xd7, 0xb8, 0xd1, - 0xdc, 0x42, 0xc1, 0xc4, 0x41, 0x6c, 0x2d, 0xa9, - 0x22, 0x7b, 0x46, 0x5c, 0xd7, 0x16, 0x1c, 0xa9, - 0x0c, 0x30, 0x29, 0x23, 0x85, 0x2f, 0x8e, 0x95, - 0xd3, 0x16, 0x0c, 0x62, 0xa8, 0x56, 0x30, 0x5b, - 0x04, 0x40, 0xc7, 0x4c, 0xc8, 0x1d, 0x6c, 0x68, - 0xcf, 0x82, 0xed, 0x5e, 0x36, 0xce, 0x56, 0xd7, - 0x30, 0x6d, 0x48, 0x0a, 0x87, 0x2a, 0x02, 0xb1, - 0x2d, 0xb8, 0xd9, 0xd2, 0x86, 0xaf, 0x8f, 0x87, - 0xa2, 0xb2, 0x4b, 0x68, 0x8a, 0x68, 0x2f, 0xba, - 0xa8, 0x10, 0x86, 0x84, 0xeb, 0x3e, 0x1b, 0xe2, - 0x42, 0xc1, 0xad, 0xbb, 0x4c, 0x55, 0x5d, 0x80, - 0xac, 0xe4, 0x44, 0xae, 0x36, 0xde, 0x89, 0x6d, - 0x81, 0x09, 0xf4, 0xf7, 0xba, 0xf8, 0xf3, 0x6a, - 0x3d, 0x4e, 0x5d, 0xc6, 0x50, 0xa3, 0x43, 0x84, - 0xed, 0x88, 0xec, 0x88, 0xb0, 0x0d, 0x61, 0x0b, - 0xee, 0x06, 0xe1, 0x66, 0xcb, 0x4d, 0x92, 0x5c, - 0x0e, 0x5a, 0xda, 0x82, 0x9d, 0xe6, 0x4d, 0xd4, - 0x41, 0xa4, 0xc9, 0x02, 0x5d, 0xb1, 0x16, 0xd6, - 0xbb, 0xc8, 0x44, 0x24, 0x44, 0xb8, 0x25, 0x65, - 0xc9, 0x6a, 0x45, 0xd3, 0x84, 0xbb, 0x41, 0x13, - 0x49, 0xc8, 0x08, 0x42, 0x50, 0xb1, 0x00, 0x04, - 0xd6, 0x6c, 0x4f, 0xf7, 0xba, 0x68, 0x68, 0x6e, - 0x6e, 0x07, 0x89, 0x04, 0x32, 0x22, 0x20, 0x1c, - 0xba, 0x84, 0x4d, 0xb5, 0x20, 0x74, 0x25, 0x34, - 0x13, 0x22, 0x00, 0xda, 0x82, 0x26, 0x5e, 0x67, - 0x02, 0x75, 0x4d, 0x4d, 0xd8, 0x55, 0xa9, 0x13, - 0x40, 0xa7, 0x1a, 0x70, 0xe9, 0x0a, 0xa7, 0x2e, - 0x07, 0x78, 0x6e, 0x64, 0x3a, 0x6a, 0xe8, 0x8d, - 0x54, 0x59, 0xa0, 0x85, 0xaa, 0x5d, 0x57, 0x05, - 0x46, 0x04, 0x84, 0x4d, 0xb5, 0x20, 0x1c, 0x9a, - 0xd5, 0x9a, 0xee, 0xd0, 0x2c, 0x88, 0xbc, 0xf7, - 0xf3, 0x78, 0x38, 0x7f, 0xad, 0x81, 0x34, 0xaf, - 0x11, 0xbb, 0x08, 0xc7, 0xf4, 0x4d, 0xe0, 0xc0, - 0xb9, 0x2b, 0xcc, 0x1b, 0x35, 0x10, 0x9b, 0x2a, - 0xa3, 0x44, 0x42, 0x84, 0x75, 0x5f, 0x26, 0xc2, - 0x10, 0xe1, 0x8e, 0xb8, 0x57, 0x80, 0x56, 0x77, - 0xa4, 0xc6, 0xf7, 0xe0, 0x87, 0x3f, 0x2e, 0x33, - 0x75, 0xa0, 0x27, 0x36, 0xc0, 0x82, 0xc7, 0x53, - 0xd9, 0x7c, 0xf8, 0x1c, 0xbd, 0xdc, 0x0e, 0xc6, - 0x67, 0xa4, 0xa0, 0x48, 0xd6, 0x14, 0x54, 0x24, - 0xf1, 0x40, 0x18, 0xab, 0x3e, 0xc4, 0x7d, 0x10, - 0xd6, 0xdb, 0xbb, 0x0c, 0x99, 0xde, 0xf1, 0x49, - 0xc8, 0x92, 0xc2, 0xc6, 0x9f, 0xcf, 0x90, 0x97, - 0xd9, 0x2b, 0x36, 0x80, 0x2f, 0xd9, 0x8d, 0xc7, - 0xa6, 0xf0, 0xf1, 0xfe, 0x32, 0x96, 0x3f, 0x39, - 0x1c, 0xaf, 0xd3, 0x86, 0x2c, 0x59, 0x95, 0x2d, - 0x47, 0x81, 0x69, 0xcf, 0x46, 0x08, 0x22, 0x3c, - 0x0b, 0xe2, 0x6d, 0x1a, 0x7d, 0x3d, 0x03, 0xd8, - 0x72, 0xf8, 0x34, 0xb9, 0x69, 0x76, 0xfa, 0xba, - 0xed, 0xb1, 0x01, 0x4c, 0xd3, 0x64, 0xdd, 0xf4, - 0x4c, 0x3e, 0xd8, 0xfb, 0x3b, 0x77, 0x83, 0x26, - 0x8b, 0x9f, 0xf0, 0x21, 0x09, 0x6b, 0xba, 0x59, - 0x22, 0x2a, 0x8c, 0xa6, 0xdc, 0x83, 0x88, 0xb3, - 0xa9, 0xf4, 0x70, 0x0f, 0xa0, 0xa1, 0xe9, 0x0e, - 0xeb, 0x8b, 0x4a, 0x59, 0x3a, 0x66, 0x40, 0xd7, - 0x7b, 0x41, 0xe4, 0x56, 0x99, 0xd3, 0xd3, 0xc9, - 0xcc, 0x41, 0x1e, 0xf2, 0x0b, 0x7f, 0x64, 0x62, - 0x46, 0x2a, 0xab, 0x67, 0x8d, 0x25, 0xde, 0x6e, - 0x58, 0xad, 0x24, 0x44, 0x7b, 0xb7, 0x08, 0x11, - 0x12, 0x16, 0x60, 0x38, 0x53, 0xba, 0x22, 0xe3, - 0x32, 0x06, 0x22, 0x70, 0x33, 0x6d, 0xc3, 0x1e, - 0x5e, 0xce, 0x4d, 0x26, 0xc5, 0x61, 0x3c, 0x70, - 0x3b, 0x7e, 0x60, 0x06, 0x4c, 0xd3, 0x64, 0xd5, - 0xc4, 0x74, 0xc6, 0xf5, 0x71, 0x32, 0x7c, 0xed, - 0x36, 0x92, 0x9c, 0x4e, 0xd6, 0xcd, 0x99, 0xc2, - 0xe0, 0x5e, 0x49, 0x1d, 0x06, 0x96, 0x69, 0x86, - 0x04, 0x04, 0x4d, 0x93, 0xa0, 0x29, 0xd0, 0x95, - 0x44, 0xec, 0xda, 0x50, 0x6a, 0x1a, 0x25, 0x46, - 0xac, 0xdb, 0xce, 0xf3, 0xbe, 0x44, 0x66, 0x0f, - 0x4c, 0xee, 0xb4, 0x7e, 0xd4, 0x39, 0x10, 0x79, - 0xbd, 0x3e, 0xae, 0x3f, 0x12, 0x15, 0x4c, 0x7a, - 0x77, 0x27, 0x2b, 0x9f, 0xca, 0x61, 0xe1, 0x84, - 0x51, 0xb4, 0xb4, 0xb6, 0x72, 0xae, 0xa6, 0x86, - 0x4b, 0xf5, 0xd7, 0xb9, 0xdd, 0xd6, 0x84, 0x2a, - 0xab, 0x24, 0xda, 0xe3, 0x48, 0x89, 0x4f, 0x24, - 0xc9, 0xe5, 0x05, 0x14, 0xb6, 0x1c, 0x3e, 0xcd, - 0xda, 0xdd, 0x25, 0x2c, 0x1a, 0x93, 0xcc, 0xac, - 0xfe, 0xbd, 0xba, 0x3c, 0x6f, 0xc6, 0x3e, 0x13, - 0x8e, 0x4d, 0x63, 0x66, 0xa6, 0x97, 0xf5, 0x07, - 0x4f, 0xb3, 0x7e, 0x4f, 0x29, 0xaf, 0x4c, 0x1e, - 0xcc, 0xb4, 0x21, 0xbd, 0x99, 0x96, 0x95, 0x83, - 0xd7, 0x61, 0x07, 0x01, 0x0d, 0x4d, 0xcd, 0x54, - 0xd4, 0x36, 0xf0, 0x59, 0x71, 0x19, 0x1b, 0x7e, - 0x3a, 0x4d, 0x6e, 0x9a, 0x03, 0xff, 0xb3, 0x43, - 0x48, 0x76, 0x18, 0x31, 0x4f, 0xdb, 0x0f, 0x75, - 0x2a, 0x1e, 0xec, 0x71, 0xb0, 0x65, 0x4e, 0x36, - 0xe7, 0x02, 0x7f, 0xb1, 0xe3, 0x6c, 0x35, 0x2f, - 0x1d, 0x3d, 0xcb, 0xd5, 0xc6, 0x3b, 0x34, 0xb7, - 0x5a, 0x5e, 0x3a, 0x34, 0x89, 0x01, 0x49, 0x06, - 0x93, 0xd3, 0x13, 0xd8, 0x9c, 0x3f, 0x88, 0xde, - 0x4e, 0x5b, 0xcc, 0x35, 0x1f, 0x09, 0x20, 0x7c, - 0x65, 0x24, 0xda, 0x79, 0x2d, 0x37, 0x0d, 0x72, - 0xbb, 0xfe, 0xdd, 0xa3, 0x7c, 0xe4, 0xfc, 0x7f, - 0xbe, 0x8c, 0x7c, 0x3e, 0x5f, 0xf7, 0x01, 0xf8, - 0xfd, 0xfe, 0x6e, 0x09, 0x0e, 0xf0, 0x37, 0x84, - 0xe8, 0x81, 0xdc, 0xd3, 0x5d, 0xde, 0x50, 0x00, - 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, - 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x05, 0x77, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xcd, 0x97, + 0x5b, 0x6c, 0x54, 0x55, 0x14, 0x86, 0xbf, 0x7d, + 0xee, 0x73, 0xed, 0x65, 0xa6, 0x40, 0x4b, 0x81, + 0x52, 0x68, 0x81, 0x52, 0xea, 0x00, 0x12, 0x28, + 0x57, 0x01, 0x01, 0xa1, 0x8a, 0x94, 0xf8, 0x40, + 0x62, 0x0c, 0x4a, 0x42, 0x0d, 0x18, 0x24, 0x80, + 0x12, 0x85, 0xc4, 0x84, 0x10, 0x22, 0x51, 0xa3, + 0x18, 0x34, 0x0d, 0xe3, 0x03, 0x98, 0x78, 0xc1, + 0x28, 0x44, 0x04, 0x2c, 0x0a, 0x46, 0x08, 0x72, + 0x29, 0x02, 0x96, 0x5a, 0xe5, 0x56, 0x68, 0x5a, + 0x08, 0xb4, 0xd0, 0x69, 0x4b, 0xc1, 0xb6, 0xd0, + 0x32, 0xc7, 0x87, 0x33, 0x53, 0xa6, 0x94, 0xe9, + 0x80, 0x31, 0xd6, 0x93, 0xfc, 0x39, 0xe7, 0x61, + 0x66, 0xaf, 0xef, 0xac, 0x7f, 0xad, 0xb5, 0xf7, + 0x11, 0x9b, 0x36, 0x6d, 0x32, 0xe9, 0xc6, 0x4b, + 0x01, 0x28, 0x28, 0x28, 0xe8, 0x96, 0xe0, 0x7e, + 0xbf, 0xdf, 0x02, 0x00, 0x08, 0x04, 0x02, 0xff, + 0x69, 0x70, 0x8f, 0xc7, 0x03, 0x70, 0x0f, 0xc0, + 0x34, 0xbb, 0xc7, 0x89, 0x47, 0x02, 0x28, 0xae, + 0x0c, 0x50, 0x78, 0xa8, 0x9c, 0x43, 0x17, 0xaf, + 0xd3, 0x78, 0xbb, 0x95, 0xf0, 0x5f, 0x84, 0x00, + 0xb7, 0xae, 0x32, 0xb6, 0xbf, 0x97, 0xc5, 0xe3, + 0x33, 0x18, 0xdd, 0xcf, 0xf3, 0xef, 0x02, 0x14, + 0x57, 0x06, 0x58, 0xba, 0xfd, 0x24, 0xf5, 0x2d, + 0xad, 0xcc, 0xcf, 0xcd, 0x64, 0xe1, 0xa4, 0x6c, + 0x72, 0x52, 0x13, 0x49, 0xf3, 0xb8, 0x00, 0xa8, + 0xa8, 0xbd, 0x49, 0xe9, 0xe5, 0x3a, 0x0e, 0x9c, + 0xbf, 0xc2, 0x0b, 0x9f, 0x1f, 0x25, 0xc1, 0x50, + 0xf9, 0x70, 0xee, 0x88, 0x87, 0x02, 0x89, 0x09, + 0xb0, 0xfc, 0xdb, 0x12, 0x8a, 0xce, 0x54, 0xb3, + 0x74, 0x6a, 0x36, 0x8b, 0x26, 0x65, 0x71, 0xfe, + 0xda, 0x0d, 0xbe, 0x39, 0x51, 0xc1, 0x8a, 0xaf, + 0x8f, 0x72, 0xb1, 0xb6, 0x11, 0xbb, 0xa6, 0x30, + 0x34, 0x25, 0x81, 0x99, 0x43, 0x53, 0x59, 0x30, + 0x76, 0x10, 0x6f, 0xe5, 0x8d, 0xe4, 0xa3, 0xfd, + 0x65, 0xbc, 0xf8, 0x65, 0x31, 0x4f, 0x67, 0xa5, + 0xf0, 0xce, 0x33, 0x8f, 0xfd, 0x73, 0x80, 0x15, + 0x3b, 0x4a, 0x38, 0x5c, 0x59, 0xcf, 0xbe, 0x65, + 0x79, 0x28, 0x92, 0x44, 0xde, 0xc6, 0x3d, 0x1c, + 0xaf, 0xbc, 0x0e, 0x58, 0x69, 0xd7, 0x15, 0x81, + 0x24, 0x82, 0x94, 0x5f, 0xab, 0xa3, 0x30, 0x50, + 0x8f, 0xff, 0x60, 0x19, 0x63, 0xd2, 0x7b, 0xb2, + 0x66, 0xf6, 0x68, 0xf2, 0x7d, 0x69, 0xe4, 0x17, + 0xee, 0xe5, 0x8d, 0x5d, 0xa7, 0x78, 0x3b, 0x2f, + 0x27, 0x2a, 0x80, 0x14, 0x7e, 0x08, 0x06, 0x83, + 0x1d, 0x14, 0x0e, 0x7e, 0xec, 0xcd, 0x7c, 0x7e, + 0xbb, 0x54, 0xcb, 0x94, 0xf7, 0x77, 0xb5, 0x07, + 0xd7, 0x14, 0x81, 0x53, 0x97, 0x71, 0x19, 0x11, + 0xd2, 0x65, 0xdc, 0x36, 0x99, 0x33, 0xd5, 0xb5, + 0xcc, 0xfb, 0x64, 0x37, 0x67, 0x6b, 0xea, 0xf8, + 0x75, 0x55, 0x3e, 0x07, 0x2e, 0x04, 0x58, 0xfd, + 0xfd, 0xa9, 0x4e, 0xeb, 0x77, 0x99, 0x81, 0x63, + 0x55, 0x75, 0x14, 0x9d, 0xa9, 0x61, 0xdf, 0xb2, + 0x3c, 0xbe, 0x3a, 0x7e, 0x81, 0x25, 0x5b, 0x0f, + 0x59, 0xb4, 0x02, 0x0c, 0x55, 0x0a, 0x49, 0xa0, + 0x2b, 0x12, 0x9a, 0x2c, 0x50, 0x65, 0x81, 0x22, + 0x0b, 0x14, 0x09, 0x24, 0x21, 0x10, 0x02, 0x3e, + 0xde, 0x7f, 0x12, 0xbb, 0x26, 0xb3, 0x6b, 0xc9, + 0x0c, 0x26, 0xbf, 0xb7, 0x93, 0xb9, 0xc3, 0x52, + 0xf1, 0xa5, 0xc4, 0x47, 0xcf, 0x80, 0x69, 0x9a, + 0xed, 0x5a, 0xf1, 0x5d, 0x29, 0xaf, 0x4e, 0xc9, + 0xe6, 0x6e, 0xd0, 0x64, 0xcd, 0xae, 0x13, 0x00, + 0xc8, 0x92, 0xc0, 0xa1, 0xcb, 0x38, 0x75, 0x29, + 0x24, 0xeb, 0xd9, 0x65, 0x58, 0x72, 0x1b, 0x12, + 0x2e, 0xc3, 0xca, 0x42, 0x9c, 0x4d, 0x46, 0x93, + 0x4d, 0x0a, 0xf7, 0x9f, 0xc0, 0x6d, 0xa8, 0x2c, + 0x9f, 0x3e, 0x8c, 0xd5, 0x45, 0xa5, 0x1d, 0x62, + 0x44, 0x05, 0x38, 0x56, 0x55, 0x47, 0x7d, 0x4b, + 0x2b, 0x4b, 0xa6, 0x0c, 0x65, 0xe5, 0xb6, 0x62, + 0x6a, 0x6f, 0xb5, 0x58, 0xc1, 0x35, 0xc9, 0x52, + 0x04, 0x84, 0xcb, 0x90, 0x3b, 0x58, 0xe1, 0x36, + 0x64, 0xdc, 0x86, 0x84, 0xdb, 0xb0, 0x20, 0x0c, + 0x15, 0x3e, 0x3d, 0x52, 0x42, 0xc1, 0x84, 0x2c, + 0x2e, 0x37, 0xdc, 0xa1, 0xf4, 0x6a, 0x7d, 0x27, + 0x80, 0x4e, 0x16, 0xf8, 0x8f, 0x56, 0x30, 0x3f, + 0x37, 0x93, 0xaa, 0xba, 0x5b, 0xfc, 0x52, 0x5e, + 0x8d, 0x24, 0xc0, 0xae, 0x49, 0x1d, 0x64, 0xd3, + 0x24, 0x6c, 0xaa, 0xc0, 0x50, 0x25, 0x74, 0x45, + 0xa0, 0x85, 0xac, 0x50, 0x64, 0x81, 0x1c, 0xb6, + 0x01, 0x30, 0x81, 0xf2, 0xeb, 0xd7, 0xb8, 0xd1, + 0xdc, 0x42, 0xc1, 0xc4, 0x41, 0x6c, 0x2d, 0xa9, + 0x22, 0x7b, 0x46, 0x5c, 0xd7, 0x16, 0x1c, 0xa9, + 0x0c, 0x30, 0x29, 0x23, 0x85, 0x2f, 0x8e, 0x95, + 0xd3, 0x16, 0x0c, 0x62, 0xa8, 0x56, 0x30, 0x5b, + 0x04, 0x40, 0xc7, 0x4c, 0xc8, 0x1d, 0x6c, 0x68, + 0xcf, 0x82, 0xed, 0x5e, 0x36, 0xce, 0x56, 0xd7, + 0x30, 0x6d, 0x48, 0x0a, 0x87, 0x2a, 0x02, 0xb1, + 0x2d, 0xb8, 0xd9, 0xd2, 0x86, 0xaf, 0x8f, 0x87, + 0xa2, 0xb2, 0x4b, 0x68, 0x8a, 0x68, 0x2f, 0xba, + 0xa8, 0x10, 0x86, 0x84, 0xeb, 0x3e, 0x1b, 0xe2, + 0x42, 0xc1, 0xad, 0xbb, 0x4c, 0x55, 0x5d, 0x80, + 0xac, 0xe4, 0x44, 0xae, 0x36, 0xde, 0x89, 0x6d, + 0x81, 0x09, 0xf4, 0xf7, 0xba, 0xf8, 0xf3, 0x6a, + 0x3d, 0x4e, 0x5d, 0xc6, 0x50, 0xa3, 0x43, 0x84, + 0xed, 0x88, 0xec, 0x88, 0xb0, 0x0d, 0x61, 0x0b, + 0xee, 0x06, 0xe1, 0x66, 0xcb, 0x4d, 0x92, 0x5c, + 0x0e, 0x5a, 0xda, 0x82, 0x9d, 0xe6, 0x4d, 0xd4, + 0x41, 0xa4, 0xc9, 0x02, 0x5d, 0xb1, 0x16, 0xd6, + 0xbb, 0xc8, 0x44, 0x24, 0x44, 0xb8, 0x25, 0x65, + 0xc9, 0x6a, 0x45, 0xd3, 0x84, 0xbb, 0x41, 0x13, + 0x49, 0xc8, 0x08, 0x42, 0x50, 0xb1, 0x00, 0x04, + 0xd6, 0x6c, 0x4f, 0xf7, 0xba, 0x68, 0x68, 0x6e, + 0x6e, 0x07, 0x89, 0x04, 0x32, 0x22, 0x20, 0x1c, + 0xba, 0x84, 0x4d, 0xb5, 0x20, 0x74, 0x25, 0x34, + 0x13, 0x22, 0x00, 0xda, 0x82, 0x26, 0x5e, 0x67, + 0x02, 0x75, 0x4d, 0x4d, 0xd8, 0x55, 0xa9, 0x13, + 0x40, 0xa7, 0x1a, 0x70, 0xe9, 0x0a, 0xa7, 0x2e, + 0x07, 0x78, 0x6e, 0x64, 0x3a, 0x6a, 0xe8, 0x8d, + 0x54, 0x59, 0xa0, 0x85, 0xaa, 0x5d, 0x57, 0x05, + 0x46, 0x04, 0x84, 0x4d, 0xb5, 0x20, 0x1c, 0x9a, + 0xd5, 0x9a, 0xee, 0xd0, 0x2c, 0x88, 0xbc, 0xf7, + 0xf3, 0x78, 0x38, 0x7f, 0xad, 0x81, 0x34, 0xaf, + 0x11, 0xbb, 0x08, 0xc7, 0xf4, 0x4d, 0xe0, 0xc0, + 0xb9, 0x2b, 0xcc, 0x1b, 0x35, 0x10, 0x9b, 0x2a, + 0xa3, 0x44, 0x42, 0x84, 0x75, 0x5f, 0x26, 0xc2, + 0x10, 0xe1, 0x8e, 0xb8, 0x57, 0x80, 0x56, 0x77, + 0xa4, 0xc6, 0xf7, 0xe0, 0x87, 0x3f, 0x2e, 0x33, + 0x75, 0xa0, 0x27, 0x36, 0xc0, 0x82, 0xc7, 0x53, + 0xd9, 0x7c, 0xf8, 0x1c, 0xbd, 0xdc, 0x0e, 0xc6, + 0x67, 0xa4, 0xa0, 0x48, 0xd6, 0x14, 0x54, 0x24, + 0xf1, 0x40, 0x18, 0xab, 0x3e, 0xc4, 0x7d, 0x10, + 0xd6, 0xdb, 0xbb, 0x0c, 0x99, 0xde, 0xf1, 0x49, + 0xc8, 0x92, 0xc2, 0xc6, 0x9f, 0xcf, 0x90, 0x97, + 0xd9, 0x2b, 0x36, 0x80, 0x2f, 0xd9, 0x8d, 0xc7, + 0xa6, 0xf0, 0xf1, 0xfe, 0x32, 0x96, 0x3f, 0x39, + 0x1c, 0xaf, 0xd3, 0x86, 0x2c, 0x59, 0x95, 0x2d, + 0x47, 0x81, 0x69, 0xcf, 0x46, 0x08, 0x22, 0x3c, + 0x0b, 0xe2, 0x6d, 0x1a, 0x7d, 0x3d, 0x03, 0xd8, + 0x72, 0xf8, 0x34, 0xb9, 0x69, 0x76, 0xfa, 0xba, + 0xed, 0xb1, 0x01, 0x4c, 0xd3, 0x64, 0xdd, 0xf4, + 0x4c, 0x3e, 0xd8, 0xfb, 0x3b, 0x77, 0x83, 0x26, + 0x8b, 0x9f, 0xf0, 0x21, 0x09, 0x6b, 0xba, 0x59, + 0x22, 0x2a, 0x8c, 0xa6, 0xdc, 0x83, 0x88, 0xb3, + 0xa9, 0xf4, 0x70, 0x0f, 0xa0, 0xa1, 0xe9, 0x0e, + 0xeb, 0x8b, 0x4a, 0x59, 0x3a, 0x66, 0x40, 0xd7, + 0x7b, 0x41, 0xe4, 0x56, 0x99, 0xd3, 0xd3, 0xc9, + 0xcc, 0x41, 0x1e, 0xf2, 0x0b, 0x7f, 0x64, 0x62, + 0x46, 0x2a, 0xab, 0x67, 0x8d, 0x25, 0xde, 0x6e, + 0x58, 0xad, 0x24, 0x44, 0x7b, 0xb7, 0x08, 0x11, + 0x12, 0x16, 0x60, 0x38, 0x53, 0xba, 0x22, 0xe3, + 0x32, 0x06, 0x22, 0x70, 0x33, 0x6d, 0xc3, 0x1e, + 0x5e, 0xce, 0x4d, 0x26, 0xc5, 0x61, 0x3c, 0x70, + 0x3b, 0x7e, 0x60, 0x06, 0x4c, 0xd3, 0x64, 0xd5, + 0xc4, 0x74, 0xc6, 0xf5, 0x71, 0x32, 0x7c, 0xed, + 0x36, 0x92, 0x9c, 0x4e, 0xd6, 0xcd, 0x99, 0xc2, + 0xe0, 0x5e, 0x49, 0x1d, 0x06, 0x96, 0x69, 0x86, + 0x04, 0x04, 0x4d, 0x93, 0xa0, 0x29, 0xd0, 0x95, + 0x44, 0xec, 0xda, 0x50, 0x6a, 0x1a, 0x25, 0x46, + 0xac, 0xdb, 0xce, 0xf3, 0xbe, 0x44, 0x66, 0x0f, + 0x4c, 0xee, 0xb4, 0x7e, 0xd4, 0x39, 0x10, 0x79, + 0xbd, 0x3e, 0xae, 0x3f, 0x12, 0x15, 0x4c, 0x7a, + 0x77, 0x27, 0x2b, 0x9f, 0xca, 0x61, 0xe1, 0x84, + 0x51, 0xb4, 0xb4, 0xb6, 0x72, 0xae, 0xa6, 0x86, + 0x4b, 0xf5, 0xd7, 0xb9, 0xdd, 0xd6, 0x84, 0x2a, + 0xab, 0x24, 0xda, 0xe3, 0x48, 0x89, 0x4f, 0x24, + 0xc9, 0xe5, 0x05, 0x14, 0xb6, 0x1c, 0x3e, 0xcd, + 0xda, 0xdd, 0x25, 0x2c, 0x1a, 0x93, 0xcc, 0xac, + 0xfe, 0xbd, 0xba, 0x3c, 0x6f, 0xc6, 0x3e, 0x13, + 0x8e, 0x4d, 0x63, 0x66, 0xa6, 0x97, 0xf5, 0x07, + 0x4f, 0xb3, 0x7e, 0x4f, 0x29, 0xaf, 0x4c, 0x1e, + 0xcc, 0xb4, 0x21, 0xbd, 0x99, 0x96, 0x95, 0x83, + 0xd7, 0x61, 0x07, 0x01, 0x0d, 0x4d, 0xcd, 0x54, + 0xd4, 0x36, 0xf0, 0x59, 0x71, 0x19, 0x1b, 0x7e, + 0x3a, 0x4d, 0x6e, 0x9a, 0x03, 0xff, 0xb3, 0x43, + 0x48, 0x76, 0x18, 0x31, 0x4f, 0xdb, 0x0f, 0x75, + 0x2a, 0x1e, 0xec, 0x71, 0xb0, 0x65, 0x4e, 0x36, + 0xe7, 0x02, 0x7f, 0xb1, 0xe3, 0x6c, 0x35, 0x2f, + 0x1d, 0x3d, 0xcb, 0xd5, 0xc6, 0x3b, 0x34, 0xb7, + 0x5a, 0x5e, 0x3a, 0x34, 0x89, 0x01, 0x49, 0x06, + 0x93, 0xd3, 0x13, 0xd8, 0x9c, 0x3f, 0x88, 0xde, + 0x4e, 0x5b, 0xcc, 0x35, 0x1f, 0x09, 0x20, 0x7c, + 0x65, 0x24, 0xda, 0x79, 0x2d, 0x37, 0x0d, 0x72, + 0xbb, 0xfe, 0xdd, 0xa3, 0x7c, 0xe4, 0xfc, 0x7f, + 0xbe, 0x8c, 0x7c, 0x3e, 0x5f, 0xf7, 0x01, 0xf8, + 0xfd, 0xfe, 0x6e, 0x09, 0x0e, 0xf0, 0x37, 0x84, + 0xe8, 0x81, 0xdc, 0xd3, 0x5d, 0xde, 0x50, 0x00, + 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, + 0x42, 0x60, 0x82 +}; /* End Of File */ /* circular_7_small.png - 740 bytes */ unsigned char circular_7_small_png[740] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, - 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, - 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, - 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, - 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, - 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x02, 0x40, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0xd3, - 0x4d, 0x48, 0x14, 0x61, 0x1c, 0xc7, 0xf1, 0xef, - 0xf3, 0x32, 0x3b, 0xcf, 0xce, 0xb8, 0x6f, 0x6a, - 0xe5, 0x12, 0x9a, 0x66, 0x54, 0xa7, 0xa4, 0x14, - 0x8a, 0xea, 0x60, 0x74, 0x88, 0xf0, 0x22, 0xd8, - 0xa1, 0x43, 0xdd, 0x83, 0x3a, 0xf4, 0x06, 0xd1, - 0xa1, 0x73, 0x41, 0x14, 0x04, 0x75, 0xf0, 0x9e, - 0x51, 0x90, 0x54, 0x97, 0xec, 0x10, 0x04, 0x11, - 0x15, 0xe5, 0xa6, 0x94, 0x97, 0x28, 0x4c, 0xdd, - 0x82, 0x5e, 0x60, 0x57, 0x6b, 0xcd, 0x6d, 0x5f, - 0x66, 0x3a, 0xcc, 0x3a, 0xeb, 0x46, 0x37, 0xe7, - 0x38, 0xf3, 0xfc, 0x3f, 0xf3, 0x7b, 0xfe, 0xcf, - 0xff, 0x11, 0xc3, 0xc3, 0xc3, 0x3e, 0xab, 0x78, - 0x34, 0xc0, 0xd0, 0xd0, 0x50, 0xf8, 0x22, 0x3b, - 0xff, 0x9b, 0x13, 0x77, 0xc7, 0xc9, 0x64, 0x73, - 0x14, 0xcb, 0x55, 0x00, 0x8c, 0xa5, 0xe8, 0x6d, - 0x6f, 0xe6, 0xfa, 0xa1, 0x3e, 0xda, 0x93, 0x4e, - 0xb8, 0x76, 0x74, 0x74, 0x34, 0x00, 0x3c, 0xcf, - 0x03, 0xe0, 0xf4, 0xfd, 0x09, 0x46, 0x32, 0x33, - 0xf8, 0xff, 0x64, 0x2a, 0x96, 0xab, 0x3c, 0x9f, - 0xfe, 0xc1, 0x8e, 0xcb, 0x63, 0x1c, 0xe9, 0xed, - 0xe4, 0xca, 0xe0, 0xf6, 0xc6, 0x04, 0x9e, 0xe7, - 0x71, 0xe6, 0xc1, 0x24, 0x23, 0x99, 0xd9, 0x86, - 0xc2, 0xa8, 0x25, 0x89, 0x46, 0x24, 0xb6, 0x16, - 0x28, 0x29, 0x58, 0x2a, 0x7b, 0x8c, 0x64, 0x66, - 0xd0, 0x0a, 0x2e, 0x0e, 0xf4, 0xd4, 0x81, 0xd9, - 0x5c, 0x81, 0x5b, 0x2b, 0x8a, 0x2d, 0x25, 0x88, - 0x1b, 0x45, 0xcc, 0x48, 0x9c, 0x88, 0xc4, 0xd6, - 0x12, 0x4b, 0x09, 0x84, 0x80, 0xef, 0xb6, 0xe2, - 0xe6, 0xeb, 0x59, 0x8e, 0xef, 0xee, 0xae, 0x03, - 0x27, 0xef, 0x4d, 0xb2, 0x9c, 0xda, 0x58, 0x92, - 0x94, 0xa3, 0x48, 0x44, 0x15, 0x71, 0xa3, 0x70, - 0x6d, 0x89, 0xb1, 0x24, 0x91, 0x1a, 0xb0, 0x36, - 0xa6, 0xc9, 0x2f, 0x55, 0xb8, 0xf0, 0xe8, 0x1d, - 0x83, 0x4e, 0x0d, 0x98, 0xf8, 0x32, 0x1f, 0xfe, - 0x39, 0xe5, 0x28, 0x9a, 0x5d, 0x1d, 0x22, 0x31, - 0xa3, 0x88, 0x5a, 0x82, 0x88, 0x96, 0x48, 0x01, - 0x9e, 0x0f, 0x5b, 0xd7, 0x19, 0xc6, 0x3f, 0xe7, - 0x19, 0xdc, 0x5c, 0x03, 0x8a, 0x95, 0xa0, 0xdb, - 0x71, 0x13, 0x14, 0xa5, 0x1c, 0x45, 0x8b, 0xab, - 0x49, 0xd6, 0x10, 0xd7, 0x0e, 0xb6, 0xb1, 0x0c, - 0x48, 0xe1, 0xf0, 0xf2, 0xd3, 0x62, 0x7d, 0x0b, - 0xcb, 0xd1, 0x63, 0x46, 0x86, 0x48, 0x72, 0x05, - 0x12, 0x37, 0x0a, 0x63, 0x05, 0x8d, 0xac, 0x7a, - 0x3e, 0x9e, 0xef, 0x23, 0x56, 0x9e, 0x82, 0xd1, - 0x12, 0x25, 0xc1, 0x89, 0x48, 0x5c, 0x5b, 0x12, - 0xfb, 0x0f, 0xe2, 0xda, 0x12, 0x2d, 0x05, 0x15, - 0xcf, 0xe7, 0xe9, 0x87, 0x02, 0x1b, 0x5a, 0x6c, - 0xe0, 0x0f, 0x12, 0xa0, 0x27, 0x1d, 0xa7, 0x5c, - 0xf5, 0x89, 0xa8, 0xa0, 0x61, 0x51, 0x4b, 0xe0, - 0xda, 0x41, 0x9a, 0xa4, 0xa3, 0x68, 0x6d, 0xd2, - 0xb4, 0xc5, 0x2d, 0xd2, 0x09, 0x8b, 0x94, 0xa3, - 0x79, 0x31, 0xbd, 0x48, 0x7f, 0x77, 0x0a, 0x20, - 0x00, 0x2e, 0x1d, 0xd8, 0x42, 0xb5, 0xea, 0xf3, - 0xb3, 0x58, 0x25, 0xa2, 0x82, 0x86, 0xd9, 0x5a, - 0x62, 0x6a, 0x50, 0x22, 0x1a, 0x20, 0xe9, 0x84, - 0xc5, 0x93, 0xf7, 0xbf, 0xc8, 0x2f, 0x56, 0x38, - 0xd6, 0xd7, 0x55, 0x07, 0xd6, 0x38, 0x9a, 0xc3, - 0x3d, 0x69, 0xe6, 0x72, 0x25, 0xb2, 0xf9, 0x52, - 0xf0, 0x41, 0x80, 0x92, 0x02, 0x2d, 0x45, 0x38, - 0x03, 0x77, 0xc6, 0xf3, 0x5c, 0x7d, 0xfc, 0x8d, - 0xb3, 0xfd, 0x1d, 0x34, 0x69, 0xd9, 0x38, 0x89, - 0xe7, 0xf6, 0x76, 0xa2, 0x25, 0xdc, 0x7e, 0xfb, - 0x95, 0xb9, 0x5c, 0x89, 0x9d, 0x5d, 0x2e, 0x7b, - 0xba, 0x5d, 0x8a, 0x15, 0x8f, 0xb1, 0xa9, 0x05, - 0x9e, 0x7d, 0x2c, 0x90, 0xcd, 0x95, 0x38, 0xbf, - 0xaf, 0x83, 0x81, 0x8d, 0x6d, 0xe1, 0xf8, 0x37, - 0xdc, 0x85, 0x53, 0xbb, 0x3a, 0x38, 0xba, 0x2d, - 0xcd, 0xb5, 0x57, 0x33, 0xbc, 0x99, 0x2b, 0xf0, - 0x70, 0x6a, 0x01, 0x80, 0xee, 0x56, 0xc3, 0xfe, - 0x4d, 0x49, 0x6e, 0x1c, 0x5c, 0x4f, 0x93, 0xa5, - 0xc3, 0xf5, 0x00, 0x62, 0xb5, 0xd7, 0xf9, 0x2f, - 0x86, 0xd5, 0xb0, 0xe8, 0x83, 0xec, 0x7c, 0xb2, - 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, - 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, + 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, + 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, + 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, + 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x02, 0x40, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0xd3, + 0x4d, 0x48, 0x14, 0x61, 0x1c, 0xc7, 0xf1, 0xef, + 0xf3, 0x32, 0x3b, 0xcf, 0xce, 0xb8, 0x6f, 0x6a, + 0xe5, 0x12, 0x9a, 0x66, 0x54, 0xa7, 0xa4, 0x14, + 0x8a, 0xea, 0x60, 0x74, 0x88, 0xf0, 0x22, 0xd8, + 0xa1, 0x43, 0xdd, 0x83, 0x3a, 0xf4, 0x06, 0xd1, + 0xa1, 0x73, 0x41, 0x14, 0x04, 0x75, 0xf0, 0x9e, + 0x51, 0x90, 0x54, 0x97, 0xec, 0x10, 0x04, 0x11, + 0x15, 0xe5, 0xa6, 0x94, 0x97, 0x28, 0x4c, 0xdd, + 0x82, 0x5e, 0x60, 0x57, 0x6b, 0xcd, 0x6d, 0x5f, + 0x66, 0x3a, 0xcc, 0x3a, 0xeb, 0x46, 0x37, 0xe7, + 0x38, 0xf3, 0xfc, 0x3f, 0xf3, 0x7b, 0xfe, 0xcf, + 0xff, 0x11, 0xc3, 0xc3, 0xc3, 0x3e, 0xab, 0x78, + 0x34, 0xc0, 0xd0, 0xd0, 0x50, 0xf8, 0x22, 0x3b, + 0xff, 0x9b, 0x13, 0x77, 0xc7, 0xc9, 0x64, 0x73, + 0x14, 0xcb, 0x55, 0x00, 0x8c, 0xa5, 0xe8, 0x6d, + 0x6f, 0xe6, 0xfa, 0xa1, 0x3e, 0xda, 0x93, 0x4e, + 0xb8, 0x76, 0x74, 0x74, 0x34, 0x00, 0x3c, 0xcf, + 0x03, 0xe0, 0xf4, 0xfd, 0x09, 0x46, 0x32, 0x33, + 0xf8, 0xff, 0x64, 0x2a, 0x96, 0xab, 0x3c, 0x9f, + 0xfe, 0xc1, 0x8e, 0xcb, 0x63, 0x1c, 0xe9, 0xed, + 0xe4, 0xca, 0xe0, 0xf6, 0xc6, 0x04, 0x9e, 0xe7, + 0x71, 0xe6, 0xc1, 0x24, 0x23, 0x99, 0xd9, 0x86, + 0xc2, 0xa8, 0x25, 0x89, 0x46, 0x24, 0xb6, 0x16, + 0x28, 0x29, 0x58, 0x2a, 0x7b, 0x8c, 0x64, 0x66, + 0xd0, 0x0a, 0x2e, 0x0e, 0xf4, 0xd4, 0x81, 0xd9, + 0x5c, 0x81, 0x5b, 0x2b, 0x8a, 0x2d, 0x25, 0x88, + 0x1b, 0x45, 0xcc, 0x48, 0x9c, 0x88, 0xc4, 0xd6, + 0x12, 0x4b, 0x09, 0x84, 0x80, 0xef, 0xb6, 0xe2, + 0xe6, 0xeb, 0x59, 0x8e, 0xef, 0xee, 0xae, 0x03, + 0x27, 0xef, 0x4d, 0xb2, 0x9c, 0xda, 0x58, 0x92, + 0x94, 0xa3, 0x48, 0x44, 0x15, 0x71, 0xa3, 0x70, + 0x6d, 0x89, 0xb1, 0x24, 0x91, 0x1a, 0xb0, 0x36, + 0xa6, 0xc9, 0x2f, 0x55, 0xb8, 0xf0, 0xe8, 0x1d, + 0x83, 0x4e, 0x0d, 0x98, 0xf8, 0x32, 0x1f, 0xfe, + 0x39, 0xe5, 0x28, 0x9a, 0x5d, 0x1d, 0x22, 0x31, + 0xa3, 0x88, 0x5a, 0x82, 0x88, 0x96, 0x48, 0x01, + 0x9e, 0x0f, 0x5b, 0xd7, 0x19, 0xc6, 0x3f, 0xe7, + 0x19, 0xdc, 0x5c, 0x03, 0x8a, 0x95, 0xa0, 0xdb, + 0x71, 0x13, 0x14, 0xa5, 0x1c, 0x45, 0x8b, 0xab, + 0x49, 0xd6, 0x10, 0xd7, 0x0e, 0xb6, 0xb1, 0x0c, + 0x48, 0xe1, 0xf0, 0xf2, 0xd3, 0x62, 0x7d, 0x0b, + 0xcb, 0xd1, 0x63, 0x46, 0x86, 0x48, 0x72, 0x05, + 0x12, 0x37, 0x0a, 0x63, 0x05, 0x8d, 0xac, 0x7a, + 0x3e, 0x9e, 0xef, 0x23, 0x56, 0x9e, 0x82, 0xd1, + 0x12, 0x25, 0xc1, 0x89, 0x48, 0x5c, 0x5b, 0x12, + 0xfb, 0x0f, 0xe2, 0xda, 0x12, 0x2d, 0x05, 0x15, + 0xcf, 0xe7, 0xe9, 0x87, 0x02, 0x1b, 0x5a, 0x6c, + 0xe0, 0x0f, 0x12, 0xa0, 0x27, 0x1d, 0xa7, 0x5c, + 0xf5, 0x89, 0xa8, 0xa0, 0x61, 0x51, 0x4b, 0xe0, + 0xda, 0x41, 0x9a, 0xa4, 0xa3, 0x68, 0x6d, 0xd2, + 0xb4, 0xc5, 0x2d, 0xd2, 0x09, 0x8b, 0x94, 0xa3, + 0x79, 0x31, 0xbd, 0x48, 0x7f, 0x77, 0x0a, 0x20, + 0x00, 0x2e, 0x1d, 0xd8, 0x42, 0xb5, 0xea, 0xf3, + 0xb3, 0x58, 0x25, 0xa2, 0x82, 0x86, 0xd9, 0x5a, + 0x62, 0x6a, 0x50, 0x22, 0x1a, 0x20, 0xe9, 0x84, + 0xc5, 0x93, 0xf7, 0xbf, 0xc8, 0x2f, 0x56, 0x38, + 0xd6, 0xd7, 0x55, 0x07, 0xd6, 0x38, 0x9a, 0xc3, + 0x3d, 0x69, 0xe6, 0x72, 0x25, 0xb2, 0xf9, 0x52, + 0xf0, 0x41, 0x80, 0x92, 0x02, 0x2d, 0x45, 0x38, + 0x03, 0x77, 0xc6, 0xf3, 0x5c, 0x7d, 0xfc, 0x8d, + 0xb3, 0xfd, 0x1d, 0x34, 0x69, 0xd9, 0x38, 0x89, + 0xe7, 0xf6, 0x76, 0xa2, 0x25, 0xdc, 0x7e, 0xfb, + 0x95, 0xb9, 0x5c, 0x89, 0x9d, 0x5d, 0x2e, 0x7b, + 0xba, 0x5d, 0x8a, 0x15, 0x8f, 0xb1, 0xa9, 0x05, + 0x9e, 0x7d, 0x2c, 0x90, 0xcd, 0x95, 0x38, 0xbf, + 0xaf, 0x83, 0x81, 0x8d, 0x6d, 0xe1, 0xf8, 0x37, + 0xdc, 0x85, 0x53, 0xbb, 0x3a, 0x38, 0xba, 0x2d, + 0xcd, 0xb5, 0x57, 0x33, 0xbc, 0x99, 0x2b, 0xf0, + 0x70, 0x6a, 0x01, 0x80, 0xee, 0x56, 0xc3, 0xfe, + 0x4d, 0x49, 0x6e, 0x1c, 0x5c, 0x4f, 0x93, 0xa5, + 0xc3, 0xf5, 0x00, 0x62, 0xb5, 0xd7, 0xf9, 0x2f, + 0x86, 0xd5, 0xb0, 0xe8, 0x83, 0xec, 0x7c, 0xb2, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, + 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* door_locked.png - 752 bytes */ unsigned char door_locked_png[752] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x4c, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x97, - 0x3d, 0xaf, 0x12, 0x41, 0x14, 0x86, 0x5f, 0xfc, - 0x88, 0xae, 0x85, 0x37, 0x8a, 0x16, 0xe6, 0x86, - 0xd0, 0x90, 0x10, 0x0a, 0x09, 0xb5, 0xad, 0x8d, - 0x3f, 0x82, 0x10, 0x2c, 0xd8, 0x84, 0x8e, 0x7e, - 0x6b, 0x6b, 0x4a, 0x5c, 0x28, 0x48, 0x36, 0xc4, - 0xc6, 0xc4, 0xca, 0xc2, 0xc2, 0xbf, 0x60, 0x43, - 0x29, 0x0d, 0x16, 0x9a, 0x6b, 0x22, 0x37, 0x76, - 0xab, 0x3b, 0xe7, 0xc3, 0x62, 0x76, 0x17, 0x16, - 0x82, 0x80, 0xb9, 0x0b, 0xb7, 0x70, 0x92, 0xc9, - 0xcc, 0x99, 0xaf, 0xf3, 0xcc, 0x7b, 0xce, 0xee, - 0x66, 0x0b, 0xbe, 0xef, 0x2b, 0x4e, 0x58, 0x6e, - 0x01, 0x80, 0xeb, 0xba, 0x27, 0x71, 0x3e, 0x1c, - 0x0e, 0x2d, 0x00, 0x00, 0x2c, 0x16, 0x8b, 0xa3, - 0x3a, 0x2f, 0x16, 0x8b, 0x00, 0xb0, 0x04, 0x50, - 0x3d, 0x4d, 0x24, 0xfe, 0x03, 0x1c, 0x04, 0xb0, - 0x78, 0xff, 0x0a, 0x22, 0x02, 0x55, 0x06, 0x33, - 0x43, 0xc4, 0x56, 0x66, 0x02, 0x27, 0x2d, 0x13, - 0x6a, 0x2f, 0x5f, 0xe7, 0x03, 0x20, 0xc2, 0x78, - 0xfc, 0xec, 0x39, 0xa0, 0x0c, 0x15, 0xb5, 0x30, - 0xc2, 0x80, 0x70, 0xda, 0xff, 0xfc, 0xf1, 0xdd, - 0x41, 0x6a, 0xa6, 0x00, 0x22, 0xb2, 0x73, 0x31, - 0x33, 0x41, 0x99, 0xf1, 0xeb, 0xe7, 0x57, 0x68, - 0x7c, 0x7b, 0x65, 0x86, 0x32, 0x41, 0x84, 0x71, - 0xf7, 0xfe, 0x13, 0x10, 0x45, 0x7b, 0x9d, 0xb5, - 0x01, 0xb0, 0x0f, 0x35, 0xc7, 0x8e, 0x84, 0x09, - 0x2a, 0x16, 0x46, 0x98, 0x20, 0xcc, 0x50, 0x21, - 0x30, 0x1b, 0x10, 0x45, 0xff, 0xa6, 0xc0, 0x3e, - 0x9b, 0x88, 0x8c, 0xbd, 0x2d, 0x19, 0xab, 0x00, - 0x93, 0xb5, 0x99, 0xa1, 0x6c, 0xa0, 0x64, 0x60, - 0x4c, 0x9e, 0x00, 0x1c, 0x03, 0xa4, 0xed, 0x52, - 0x85, 0x82, 0x46, 0x10, 0xe6, 0xbc, 0x15, 0x88, - 0x20, 0x44, 0x10, 0x13, 0xd9, 0xf8, 0x13, 0x41, - 0x84, 0xf0, 0xf0, 0xec, 0x12, 0xe7, 0xe7, 0x3f, - 0xf0, 0xe5, 0xdb, 0x99, 0x55, 0x29, 0xcf, 0x10, - 0x48, 0x1c, 0x82, 0x54, 0x7e, 0xb1, 0xed, 0xe5, - 0xc2, 0x41, 0xf8, 0xfb, 0xf6, 0x11, 0x14, 0x60, - 0x03, 0xa6, 0x28, 0x13, 0x82, 0xef, 0x17, 0x77, - 0xa0, 0x7c, 0x13, 0xf7, 0x1e, 0x49, 0xbe, 0x0a, - 0x18, 0x13, 0x2d, 0x93, 0x90, 0x4d, 0x9c, 0x7c, - 0x31, 0x88, 0xd8, 0x3e, 0x73, 0xae, 0x21, 0x58, - 0xe6, 0x80, 0x8a, 0xcd, 0xfe, 0x44, 0x05, 0x15, - 0xfb, 0x68, 0xe6, 0x9c, 0x03, 0x36, 0x04, 0xce, - 0x83, 0x12, 0x54, 0x05, 0xca, 0x04, 0x15, 0xb1, - 0x55, 0x19, 0xc2, 0xf6, 0x75, 0x7c, 0xe5, 0x00, - 0xb3, 0xd9, 0x0c, 0x61, 0x18, 0x82, 0x28, 0xc2, - 0xa7, 0x0f, 0x6f, 0xd2, 0x77, 0x7e, 0xf2, 0x1d, - 0x58, 0x7e, 0x13, 0x18, 0xaa, 0x82, 0x7e, 0xbf, - 0x0f, 0x00, 0xe8, 0xf5, 0x7a, 0x57, 0x03, 0x50, - 0xa9, 0x54, 0x6c, 0xe7, 0xe9, 0xdb, 0xdd, 0x57, - 0x02, 0xf0, 0x62, 0x8f, 0x33, 0x0f, 0x02, 0xc8, - 0xb3, 0x5c, 0x5f, 0x80, 0x4e, 0xa7, 0x83, 0xd1, - 0x68, 0x04, 0x00, 0x68, 0x36, 0x9b, 0xe9, 0xf8, - 0x64, 0x32, 0xd9, 0xb0, 0x93, 0xb5, 0x49, 0xbb, - 0x6d, 0x7d, 0xad, 0x56, 0x83, 0xe7, 0x79, 0x19, - 0x3f, 0x37, 0x92, 0x8e, 0x88, 0x64, 0xea, 0xea, - 0x98, 0xe3, 0x38, 0x08, 0x82, 0x00, 0x8e, 0xe3, - 0x64, 0xec, 0x20, 0x08, 0x32, 0x6b, 0x93, 0x76, - 0x7d, 0x3e, 0xb1, 0xe7, 0xf3, 0x79, 0xe6, 0xfc, - 0x0c, 0x80, 0xaa, 0x66, 0xea, 0xea, 0xd8, 0xaa, - 0x42, 0xeb, 0x73, 0xaa, 0x8a, 0x30, 0x0c, 0xd1, - 0x6a, 0xb5, 0x50, 0x2e, 0x97, 0x33, 0xb6, 0xe7, - 0x79, 0x5b, 0xf7, 0xed, 0x0c, 0xc1, 0xfa, 0xd8, - 0x36, 0x10, 0x00, 0x70, 0x1c, 0x07, 0x83, 0xc1, - 0x00, 0xdd, 0x6e, 0x17, 0xaa, 0x9a, 0xda, 0xbb, - 0xf6, 0xfd, 0x15, 0x20, 0x0c, 0x43, 0xb4, 0xdb, - 0x6d, 0x94, 0x4a, 0xa5, 0xb4, 0x9f, 0xac, 0x5b, - 0xb5, 0xc7, 0xe3, 0xf1, 0x86, 0x83, 0xf5, 0xf9, - 0xc4, 0xae, 0x56, 0xab, 0x1b, 0x7e, 0x0a, 0xbe, - 0xef, 0xab, 0xeb, 0xba, 0x98, 0x4e, 0xa7, 0x1b, - 0x0a, 0xe4, 0x59, 0xea, 0xf5, 0x7a, 0xf6, 0xcf, - 0xe8, 0xda, 0x3d, 0x86, 0x47, 0x07, 0x68, 0x34, - 0x1a, 0xa7, 0x03, 0x18, 0x0e, 0x87, 0x27, 0x71, - 0x0e, 0x00, 0x7f, 0x00, 0x47, 0xef, 0xb9, 0xb2, - 0x75, 0xa3, 0xa3, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x4c, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x97, + 0x3d, 0xaf, 0x12, 0x41, 0x14, 0x86, 0x5f, 0xfc, + 0x88, 0xae, 0x85, 0x37, 0x8a, 0x16, 0xe6, 0x86, + 0xd0, 0x90, 0x10, 0x0a, 0x09, 0xb5, 0xad, 0x8d, + 0x3f, 0x82, 0x10, 0x2c, 0xd8, 0x84, 0x8e, 0x7e, + 0x6b, 0x6b, 0x4a, 0x5c, 0x28, 0x48, 0x36, 0xc4, + 0xc6, 0xc4, 0xca, 0xc2, 0xc2, 0xbf, 0x60, 0x43, + 0x29, 0x0d, 0x16, 0x9a, 0x6b, 0x22, 0x37, 0x76, + 0xab, 0x3b, 0xe7, 0xc3, 0x62, 0x76, 0x17, 0x16, + 0x82, 0x80, 0xb9, 0x0b, 0xb7, 0x70, 0x92, 0xc9, + 0xcc, 0x99, 0xaf, 0xf3, 0xcc, 0x7b, 0xce, 0xee, + 0x66, 0x0b, 0xbe, 0xef, 0x2b, 0x4e, 0x58, 0x6e, + 0x01, 0x80, 0xeb, 0xba, 0x27, 0x71, 0x3e, 0x1c, + 0x0e, 0x2d, 0x00, 0x00, 0x2c, 0x16, 0x8b, 0xa3, + 0x3a, 0x2f, 0x16, 0x8b, 0x00, 0xb0, 0x04, 0x50, + 0x3d, 0x4d, 0x24, 0xfe, 0x03, 0x1c, 0x04, 0xb0, + 0x78, 0xff, 0x0a, 0x22, 0x02, 0x55, 0x06, 0x33, + 0x43, 0xc4, 0x56, 0x66, 0x02, 0x27, 0x2d, 0x13, + 0x6a, 0x2f, 0x5f, 0xe7, 0x03, 0x20, 0xc2, 0x78, + 0xfc, 0xec, 0x39, 0xa0, 0x0c, 0x15, 0xb5, 0x30, + 0xc2, 0x80, 0x70, 0xda, 0xff, 0xfc, 0xf1, 0xdd, + 0x41, 0x6a, 0xa6, 0x00, 0x22, 0xb2, 0x73, 0x31, + 0x33, 0x41, 0x99, 0xf1, 0xeb, 0xe7, 0x57, 0x68, + 0x7c, 0x7b, 0x65, 0x86, 0x32, 0x41, 0x84, 0x71, + 0xf7, 0xfe, 0x13, 0x10, 0x45, 0x7b, 0x9d, 0xb5, + 0x01, 0xb0, 0x0f, 0x35, 0xc7, 0x8e, 0x84, 0x09, + 0x2a, 0x16, 0x46, 0x98, 0x20, 0xcc, 0x50, 0x21, + 0x30, 0x1b, 0x10, 0x45, 0xff, 0xa6, 0xc0, 0x3e, + 0x9b, 0x88, 0x8c, 0xbd, 0x2d, 0x19, 0xab, 0x00, + 0x93, 0xb5, 0x99, 0xa1, 0x6c, 0xa0, 0x64, 0x60, + 0x4c, 0x9e, 0x00, 0x1c, 0x03, 0xa4, 0xed, 0x52, + 0x85, 0x82, 0x46, 0x10, 0xe6, 0xbc, 0x15, 0x88, + 0x20, 0x44, 0x10, 0x13, 0xd9, 0xf8, 0x13, 0x41, + 0x84, 0xf0, 0xf0, 0xec, 0x12, 0xe7, 0xe7, 0x3f, + 0xf0, 0xe5, 0xdb, 0x99, 0x55, 0x29, 0xcf, 0x10, + 0x48, 0x1c, 0x82, 0x54, 0x7e, 0xb1, 0xed, 0xe5, + 0xc2, 0x41, 0xf8, 0xfb, 0xf6, 0x11, 0x14, 0x60, + 0x03, 0xa6, 0x28, 0x13, 0x82, 0xef, 0x17, 0x77, + 0xa0, 0x7c, 0x13, 0xf7, 0x1e, 0x49, 0xbe, 0x0a, + 0x18, 0x13, 0x2d, 0x93, 0x90, 0x4d, 0x9c, 0x7c, + 0x31, 0x88, 0xd8, 0x3e, 0x73, 0xae, 0x21, 0x58, + 0xe6, 0x80, 0x8a, 0xcd, 0xfe, 0x44, 0x05, 0x15, + 0xfb, 0x68, 0xe6, 0x9c, 0x03, 0x36, 0x04, 0xce, + 0x83, 0x12, 0x54, 0x05, 0xca, 0x04, 0x15, 0xb1, + 0x55, 0x19, 0xc2, 0xf6, 0x75, 0x7c, 0xe5, 0x00, + 0xb3, 0xd9, 0x0c, 0x61, 0x18, 0x82, 0x28, 0xc2, + 0xa7, 0x0f, 0x6f, 0xd2, 0x77, 0x7e, 0xf2, 0x1d, + 0x58, 0x7e, 0x13, 0x18, 0xaa, 0x82, 0x7e, 0xbf, + 0x0f, 0x00, 0xe8, 0xf5, 0x7a, 0x57, 0x03, 0x50, + 0xa9, 0x54, 0x6c, 0xe7, 0xe9, 0xdb, 0xdd, 0x57, + 0x02, 0xf0, 0x62, 0x8f, 0x33, 0x0f, 0x02, 0xc8, + 0xb3, 0x5c, 0x5f, 0x80, 0x4e, 0xa7, 0x83, 0xd1, + 0x68, 0x04, 0x00, 0x68, 0x36, 0x9b, 0xe9, 0xf8, + 0x64, 0x32, 0xd9, 0xb0, 0x93, 0xb5, 0x49, 0xbb, + 0x6d, 0x7d, 0xad, 0x56, 0x83, 0xe7, 0x79, 0x19, + 0x3f, 0x37, 0x92, 0x8e, 0x88, 0x64, 0xea, 0xea, + 0x98, 0xe3, 0x38, 0x08, 0x82, 0x00, 0x8e, 0xe3, + 0x64, 0xec, 0x20, 0x08, 0x32, 0x6b, 0x93, 0x76, + 0x7d, 0x3e, 0xb1, 0xe7, 0xf3, 0x79, 0xe6, 0xfc, + 0x0c, 0x80, 0xaa, 0x66, 0xea, 0xea, 0xd8, 0xaa, + 0x42, 0xeb, 0x73, 0xaa, 0x8a, 0x30, 0x0c, 0xd1, + 0x6a, 0xb5, 0x50, 0x2e, 0x97, 0x33, 0xb6, 0xe7, + 0x79, 0x5b, 0xf7, 0xed, 0x0c, 0xc1, 0xfa, 0xd8, + 0x36, 0x10, 0x00, 0x70, 0x1c, 0x07, 0x83, 0xc1, + 0x00, 0xdd, 0x6e, 0x17, 0xaa, 0x9a, 0xda, 0xbb, + 0xf6, 0xfd, 0x15, 0x20, 0x0c, 0x43, 0xb4, 0xdb, + 0x6d, 0x94, 0x4a, 0xa5, 0xb4, 0x9f, 0xac, 0x5b, + 0xb5, 0xc7, 0xe3, 0xf1, 0x86, 0x83, 0xf5, 0xf9, + 0xc4, 0xae, 0x56, 0xab, 0x1b, 0x7e, 0x0a, 0xbe, + 0xef, 0xab, 0xeb, 0xba, 0x98, 0x4e, 0xa7, 0x1b, + 0x0a, 0xe4, 0x59, 0xea, 0xf5, 0x7a, 0xf6, 0xcf, + 0xe8, 0xda, 0x3d, 0x86, 0x47, 0x07, 0x68, 0x34, + 0x1a, 0xa7, 0x03, 0x18, 0x0e, 0x87, 0x27, 0x71, + 0x0e, 0x00, 0x7f, 0x00, 0x47, 0xef, 0xb9, 0xb2, + 0x75, 0xa3, 0xa3, 0x70, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; /* End Of File */ /* door_locked_small.png - 552 bytes */ unsigned char door_locked_small_png[552] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x84, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, - 0xcd, 0x6a, 0x93, 0x51, 0x10, 0x86, 0x9f, 0xb4, - 0x69, 0x68, 0x5a, 0x28, 0x6d, 0x25, 0xa0, 0xa5, - 0x14, 0xdc, 0x8b, 0xe0, 0x52, 0x7a, 0x05, 0xae, - 0xb3, 0x71, 0x21, 0x78, 0x13, 0xde, 0x4c, 0x96, - 0x5e, 0x40, 0xb6, 0x82, 0x3b, 0x57, 0x42, 0x70, - 0xa3, 0x78, 0x05, 0x1a, 0x5a, 0x5a, 0x68, 0xa9, - 0x95, 0xa4, 0x5f, 0xce, 0x99, 0x79, 0xe7, 0xb8, - 0xf8, 0x92, 0xe8, 0x87, 0x21, 0x82, 0x9d, 0xcd, - 0x81, 0xc3, 0xbc, 0xcf, 0xbc, 0xf3, 0xd3, 0x1a, - 0x0c, 0x06, 0x85, 0x7b, 0x44, 0x1b, 0xa0, 0xdf, - 0xef, 0xff, 0x97, 0x78, 0x38, 0x1c, 0xd6, 0x80, - 0x88, 0xb8, 0x9f, 0x83, 0x05, 0xc0, 0x6f, 0xce, - 0xb9, 0xfd, 0xf8, 0x96, 0x56, 0x7b, 0x03, 0x49, - 0x48, 0x22, 0x42, 0x48, 0x86, 0xc2, 0x49, 0x77, - 0x13, 0x4e, 0x5e, 0xbc, 0xa1, 0xdb, 0x7b, 0xdc, - 0x04, 0x48, 0x02, 0xc0, 0x52, 0xc5, 0xd6, 0xc1, - 0x21, 0xfb, 0x4f, 0x9e, 0xe1, 0x93, 0x5b, 0x14, - 0x85, 0x12, 0x02, 0x19, 0x9b, 0xdb, 0xbb, 0x8c, - 0x3f, 0x7d, 0x20, 0x57, 0x53, 0x3a, 0xf3, 0xfc, - 0xbf, 0x1c, 0x84, 0x44, 0x28, 0xb0, 0xe9, 0x0f, - 0xaa, 0xeb, 0x31, 0xa5, 0x14, 0x42, 0x42, 0x36, - 0x63, 0x67, 0xff, 0x11, 0xf2, 0x85, 0xab, 0x58, - 0x0d, 0x50, 0x08, 0x97, 0xd5, 0xa0, 0x08, 0x4a, - 0x04, 0x45, 0x4e, 0x71, 0x27, 0x3c, 0x93, 0x6d, - 0xf6, 0x0f, 0x80, 0x84, 0x2c, 0x53, 0x2c, 0x23, - 0x4b, 0x73, 0xc0, 0xef, 0x3f, 0xb7, 0x8c, 0xa2, - 0x09, 0xd8, 0x58, 0x00, 0x22, 0xa2, 0x76, 0xe0, - 0x99, 0x70, 0x23, 0x2c, 0xa3, 0x6c, 0x84, 0xcd, - 0x38, 0x3e, 0x3a, 0xe3, 0xf8, 0xe8, 0x0c, 0x4b, - 0x09, 0x57, 0x2c, 0xf3, 0x57, 0x3a, 0xf0, 0xa5, - 0x38, 0x51, 0xa2, 0x00, 0x99, 0xe9, 0xcf, 0x16, - 0x49, 0x5d, 0xcc, 0x9d, 0x90, 0xaf, 0x6f, 0xc1, - 0x2d, 0x11, 0xca, 0xc8, 0x13, 0x45, 0x75, 0x0b, - 0xe3, 0x9b, 0x0e, 0x7b, 0x0f, 0x36, 0xa1, 0x64, - 0xf4, 0x47, 0xf5, 0x15, 0x43, 0x74, 0xdc, 0xeb, - 0xea, 0x5e, 0x4d, 0x28, 0x85, 0xf9, 0x10, 0x2b, - 0x88, 0x0a, 0xb9, 0x21, 0xad, 0x00, 0x2c, 0xee, - 0x40, 0x2e, 0x2c, 0xdd, 0xd1, 0xee, 0xec, 0xd2, - 0x3d, 0x38, 0xa9, 0xc5, 0x21, 0x8a, 0x9c, 0xad, - 0x9d, 0x3d, 0x2c, 0xcf, 0x88, 0x68, 0x2d, 0xf3, - 0x1b, 0x0e, 0xce, 0x2f, 0xaf, 0xa8, 0x2e, 0x2e, - 0xc9, 0xdf, 0xbe, 0x72, 0x7d, 0xf1, 0xbd, 0xbe, - 0x3e, 0x39, 0x92, 0x53, 0x8a, 0x23, 0x09, 0x9b, - 0x5c, 0xf1, 0xe5, 0xfd, 0x3b, 0xd2, 0xf6, 0x67, - 0x5e, 0xbf, 0x7a, 0xd9, 0x04, 0x3c, 0xec, 0x1d, - 0x42, 0xef, 0x14, 0x9e, 0x9e, 0xb2, 0x2e, 0x9e, - 0xcf, 0xdf, 0xc6, 0x16, 0x46, 0xa3, 0xd1, 0x5a, - 0xd1, 0xba, 0xf8, 0x05, 0x29, 0xdb, 0x71, 0xff, - 0xd6, 0x47, 0x96, 0x83, 0x00, 0x00, 0x00, 0x00, - 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x84, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, + 0xcd, 0x6a, 0x93, 0x51, 0x10, 0x86, 0x9f, 0xb4, + 0x69, 0x68, 0x5a, 0x28, 0x6d, 0x25, 0xa0, 0xa5, + 0x14, 0xdc, 0x8b, 0xe0, 0x52, 0x7a, 0x05, 0xae, + 0xb3, 0x71, 0x21, 0x78, 0x13, 0xde, 0x4c, 0x96, + 0x5e, 0x40, 0xb6, 0x82, 0x3b, 0x57, 0x42, 0x70, + 0xa3, 0x78, 0x05, 0x1a, 0x5a, 0x5a, 0x68, 0xa9, + 0x95, 0xa4, 0x5f, 0xce, 0x99, 0x79, 0xe7, 0xb8, + 0xf8, 0x92, 0xe8, 0x87, 0x21, 0x82, 0x9d, 0xcd, + 0x81, 0xc3, 0xbc, 0xcf, 0xbc, 0xf3, 0xd3, 0x1a, + 0x0c, 0x06, 0x85, 0x7b, 0x44, 0x1b, 0xa0, 0xdf, + 0xef, 0xff, 0x97, 0x78, 0x38, 0x1c, 0xd6, 0x80, + 0x88, 0xb8, 0x9f, 0x83, 0x05, 0xc0, 0x6f, 0xce, + 0xb9, 0xfd, 0xf8, 0x96, 0x56, 0x7b, 0x03, 0x49, + 0x48, 0x22, 0x42, 0x48, 0x86, 0xc2, 0x49, 0x77, + 0x13, 0x4e, 0x5e, 0xbc, 0xa1, 0xdb, 0x7b, 0xdc, + 0x04, 0x48, 0x02, 0xc0, 0x52, 0xc5, 0xd6, 0xc1, + 0x21, 0xfb, 0x4f, 0x9e, 0xe1, 0x93, 0x5b, 0x14, + 0x85, 0x12, 0x02, 0x19, 0x9b, 0xdb, 0xbb, 0x8c, + 0x3f, 0x7d, 0x20, 0x57, 0x53, 0x3a, 0xf3, 0xfc, + 0xbf, 0x1c, 0x84, 0x44, 0x28, 0xb0, 0xe9, 0x0f, + 0xaa, 0xeb, 0x31, 0xa5, 0x14, 0x42, 0x42, 0x36, + 0x63, 0x67, 0xff, 0x11, 0xf2, 0x85, 0xab, 0x58, + 0x0d, 0x50, 0x08, 0x97, 0xd5, 0xa0, 0x08, 0x4a, + 0x04, 0x45, 0x4e, 0x71, 0x27, 0x3c, 0x93, 0x6d, + 0xf6, 0x0f, 0x80, 0x84, 0x2c, 0x53, 0x2c, 0x23, + 0x4b, 0x73, 0xc0, 0xef, 0x3f, 0xb7, 0x8c, 0xa2, + 0x09, 0xd8, 0x58, 0x00, 0x22, 0xa2, 0x76, 0xe0, + 0x99, 0x70, 0x23, 0x2c, 0xa3, 0x6c, 0x84, 0xcd, + 0x38, 0x3e, 0x3a, 0xe3, 0xf8, 0xe8, 0x0c, 0x4b, + 0x09, 0x57, 0x2c, 0xf3, 0x57, 0x3a, 0xf0, 0xa5, + 0x38, 0x51, 0xa2, 0x00, 0x99, 0xe9, 0xcf, 0x16, + 0x49, 0x5d, 0xcc, 0x9d, 0x90, 0xaf, 0x6f, 0xc1, + 0x2d, 0x11, 0xca, 0xc8, 0x13, 0x45, 0x75, 0x0b, + 0xe3, 0x9b, 0x0e, 0x7b, 0x0f, 0x36, 0xa1, 0x64, + 0xf4, 0x47, 0xf5, 0x15, 0x43, 0x74, 0xdc, 0xeb, + 0xea, 0x5e, 0x4d, 0x28, 0x85, 0xf9, 0x10, 0x2b, + 0x88, 0x0a, 0xb9, 0x21, 0xad, 0x00, 0x2c, 0xee, + 0x40, 0x2e, 0x2c, 0xdd, 0xd1, 0xee, 0xec, 0xd2, + 0x3d, 0x38, 0xa9, 0xc5, 0x21, 0x8a, 0x9c, 0xad, + 0x9d, 0x3d, 0x2c, 0xcf, 0x88, 0x68, 0x2d, 0xf3, + 0x1b, 0x0e, 0xce, 0x2f, 0xaf, 0xa8, 0x2e, 0x2e, + 0xc9, 0xdf, 0xbe, 0x72, 0x7d, 0xf1, 0xbd, 0xbe, + 0x3e, 0x39, 0x92, 0x53, 0x8a, 0x23, 0x09, 0x9b, + 0x5c, 0xf1, 0xe5, 0xfd, 0x3b, 0xd2, 0xf6, 0x67, + 0x5e, 0xbf, 0x7a, 0xd9, 0x04, 0x3c, 0xec, 0x1d, + 0x42, 0xef, 0x14, 0x9e, 0x9e, 0xb2, 0x2e, 0x9e, + 0xcf, 0xdf, 0xc6, 0x16, 0x46, 0xa3, 0xd1, 0x5a, + 0xd1, 0xba, 0xf8, 0x05, 0x29, 0xdb, 0x71, 0xff, + 0xd6, 0x47, 0x96, 0x83, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; /* End Of File */ /* door_magic.png - 761 bytes */ unsigned char door_magic_png[761] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x55, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x97, - 0xbf, 0x8f, 0x12, 0x51, 0x10, 0xc7, 0xbf, 0xa8, - 0x44, 0xd6, 0xc2, 0x8b, 0xa2, 0x85, 0xb9, 0xd8, - 0xd1, 0x58, 0x48, 0x28, 0x08, 0x85, 0xad, 0x8d, - 0x21, 0xb4, 0x24, 0x14, 0x40, 0x20, 0x04, 0xe8, - 0x08, 0xff, 0x84, 0x35, 0xad, 0xbb, 0x84, 0x04, - 0x12, 0x62, 0x63, 0x62, 0x65, 0x61, 0xe1, 0xbf, - 0x60, 0x43, 0x79, 0x54, 0x16, 0x1a, 0x4d, 0xe4, - 0x62, 0xb7, 0xb8, 0x3b, 0x3f, 0x2c, 0x1e, 0x2c, - 0x20, 0x20, 0x70, 0xb9, 0x85, 0x2b, 0x7c, 0xc9, - 0xcb, 0xbc, 0x99, 0xb0, 0x33, 0x9f, 0xf7, 0x9d, - 0xb7, 0xfb, 0x42, 0xc4, 0xb6, 0x6d, 0xc5, 0x09, - 0xc7, 0x1d, 0x00, 0x68, 0x34, 0x1a, 0x27, 0x29, - 0xee, 0x38, 0x8e, 0x01, 0x00, 0x80, 0xc9, 0x64, - 0x72, 0xd4, 0xe2, 0xf1, 0x78, 0x1c, 0x00, 0x16, - 0x00, 0xaa, 0xa7, 0xe9, 0xc4, 0x7f, 0x80, 0x83, - 0x00, 0x26, 0x1f, 0x5e, 0x43, 0x44, 0xa0, 0xca, - 0x60, 0x66, 0x88, 0x98, 0xc9, 0x4c, 0xe0, 0xb9, - 0x65, 0xc2, 0xb3, 0xea, 0x9b, 0x70, 0x00, 0x44, - 0x18, 0x8f, 0x5f, 0xbc, 0x04, 0x94, 0xa1, 0xa2, - 0x06, 0x46, 0x18, 0x10, 0x0e, 0xd6, 0x17, 0x9f, - 0xde, 0x1f, 0xa4, 0x66, 0x00, 0x20, 0x22, 0x3b, - 0x7f, 0xcc, 0x4c, 0x50, 0x66, 0x4c, 0x7f, 0x7d, - 0x85, 0xce, 0x76, 0xaf, 0xcc, 0x50, 0x26, 0x88, - 0x30, 0x62, 0xf7, 0x9f, 0x80, 0xc8, 0xdb, 0x2b, - 0xd7, 0x1a, 0xc0, 0x3e, 0xd4, 0x3c, 0x2b, 0x24, - 0x4c, 0x50, 0x31, 0x30, 0xc2, 0x04, 0x61, 0x86, - 0x0a, 0x81, 0xd9, 0x07, 0x91, 0x77, 0x35, 0x05, - 0xf6, 0x79, 0x88, 0xc8, 0x37, 0xbb, 0x25, 0xdf, - 0x28, 0xc0, 0x64, 0x7c, 0x66, 0x28, 0xfb, 0x50, - 0xf2, 0xe1, 0xfb, 0x61, 0x02, 0xf0, 0x0c, 0x20, - 0xb0, 0x0b, 0x15, 0x22, 0xea, 0x41, 0x98, 0xc3, - 0x56, 0xc0, 0x83, 0x10, 0x41, 0x7c, 0xcf, 0xf4, - 0x9f, 0x08, 0x22, 0x84, 0x87, 0x67, 0x97, 0x38, - 0x3f, 0xff, 0x89, 0x2f, 0xdf, 0xce, 0x8c, 0x4a, - 0x61, 0xb6, 0x40, 0x66, 0x2d, 0x08, 0xe4, 0x17, - 0x63, 0x2f, 0x27, 0x16, 0xdc, 0xdf, 0xd1, 0x23, - 0x28, 0xc0, 0x3e, 0x98, 0xbc, 0x95, 0x16, 0xfc, - 0xf8, 0x7e, 0x17, 0xca, 0xb7, 0x71, 0xef, 0x91, - 0x84, 0xab, 0x80, 0xef, 0x7b, 0x8b, 0x43, 0xc8, - 0xfe, 0xec, 0xf0, 0xcd, 0x40, 0xc4, 0xac, 0x99, - 0x43, 0x6d, 0xc1, 0xe2, 0x0c, 0xa8, 0x98, 0xd3, - 0x3f, 0x57, 0x41, 0xc5, 0xbc, 0x9a, 0x21, 0x9f, - 0x01, 0xd3, 0x02, 0xeb, 0xc1, 0x53, 0xa8, 0x0a, - 0x94, 0x09, 0x2a, 0x62, 0xa6, 0x32, 0x84, 0xcd, - 0xe7, 0xf8, 0xda, 0x01, 0xc6, 0xe3, 0x31, 0x5c, - 0xd7, 0x05, 0x91, 0x87, 0xcf, 0x1f, 0xdf, 0x06, - 0xdf, 0xfc, 0xf9, 0x3d, 0xb0, 0xb8, 0x13, 0x18, - 0xaa, 0x82, 0x4e, 0xa7, 0x03, 0x00, 0x68, 0xb7, - 0xdb, 0xd7, 0x03, 0x90, 0x48, 0x24, 0xcc, 0xe2, - 0xf9, 0xbb, 0xdd, 0x5b, 0x02, 0xf0, 0x6a, 0x8f, - 0x9c, 0x07, 0x01, 0x84, 0x39, 0x6e, 0x36, 0x40, - 0xb1, 0x58, 0x5c, 0xf1, 0x5b, 0xad, 0x16, 0x32, - 0x99, 0xcc, 0x4a, 0x7c, 0x38, 0x1c, 0xae, 0xf9, - 0xf5, 0x7a, 0x1d, 0xdd, 0x6e, 0x17, 0xa5, 0x52, - 0x29, 0xc8, 0x5b, 0x28, 0x14, 0x90, 0xcb, 0xe5, - 0xb6, 0x03, 0x6c, 0xba, 0x42, 0xa3, 0xd1, 0x28, - 0x7a, 0xbd, 0x1e, 0x6a, 0xb5, 0x5a, 0x60, 0xd3, - 0xe9, 0x34, 0x2c, 0xcb, 0x82, 0x6d, 0xdb, 0x68, - 0x36, 0x9b, 0x10, 0x91, 0xc0, 0x5f, 0xce, 0x23, - 0x22, 0x88, 0xc5, 0x62, 0x41, 0x7c, 0x5b, 0x8d, - 0x9d, 0x2d, 0x98, 0xc7, 0x97, 0xad, 0xeb, 0xba, - 0x28, 0x97, 0xcb, 0x2b, 0xf1, 0x6a, 0xb5, 0x0a, - 0x66, 0xc6, 0x60, 0x30, 0xd8, 0xf8, 0xdc, 0xb6, - 0x71, 0x6b, 0xb9, 0xd0, 0xdf, 0x73, 0x1b, 0x80, - 0x65, 0x59, 0xe8, 0xf7, 0xfb, 0xb0, 0x2c, 0x2b, - 0x88, 0xf7, 0x7a, 0xbd, 0x15, 0x7f, 0xd9, 0x6e, - 0xcb, 0x7d, 0x65, 0x05, 0x36, 0x29, 0x52, 0xa9, - 0x54, 0xd6, 0xe2, 0xd3, 0xe9, 0x34, 0x88, 0xe7, - 0xf3, 0x79, 0x64, 0xb3, 0xd9, 0xb5, 0xfc, 0x11, - 0xdb, 0xb6, 0xb5, 0xd1, 0x68, 0x60, 0x34, 0x1a, - 0xfd, 0x53, 0xaa, 0xeb, 0x1e, 0xc9, 0x64, 0x72, - 0xf5, 0x9f, 0xd1, 0x8d, 0x7c, 0x0d, 0x8f, 0x0a, - 0x90, 0x4a, 0xa5, 0x4e, 0x07, 0xe0, 0x38, 0xce, - 0x49, 0x8a, 0x03, 0xc0, 0x1f, 0xc1, 0xb5, 0x94, - 0x6a, 0x3d, 0x48, 0x0b, 0xf7, 0x00, 0x00, 0x00, - 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, - 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x55, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x97, + 0xbf, 0x8f, 0x12, 0x51, 0x10, 0xc7, 0xbf, 0xa8, + 0x44, 0xd6, 0xc2, 0x8b, 0xa2, 0x85, 0xb9, 0xd8, + 0xd1, 0x58, 0x48, 0x28, 0x08, 0x85, 0xad, 0x8d, + 0x21, 0xb4, 0x24, 0x14, 0x40, 0x20, 0x04, 0xe8, + 0x08, 0xff, 0x84, 0x35, 0xad, 0xbb, 0x84, 0x04, + 0x12, 0x62, 0x63, 0x62, 0x65, 0x61, 0xe1, 0xbf, + 0x60, 0x43, 0x79, 0x54, 0x16, 0x1a, 0x4d, 0xe4, + 0x62, 0xb7, 0xb8, 0x3b, 0x3f, 0x2c, 0x1e, 0x2c, + 0x20, 0x20, 0x70, 0xb9, 0x85, 0x2b, 0x7c, 0xc9, + 0xcb, 0xbc, 0x99, 0xb0, 0x33, 0x9f, 0xf7, 0x9d, + 0xb7, 0xfb, 0x42, 0xc4, 0xb6, 0x6d, 0xc5, 0x09, + 0xc7, 0x1d, 0x00, 0x68, 0x34, 0x1a, 0x27, 0x29, + 0xee, 0x38, 0x8e, 0x01, 0x00, 0x80, 0xc9, 0x64, + 0x72, 0xd4, 0xe2, 0xf1, 0x78, 0x1c, 0x00, 0x16, + 0x00, 0xaa, 0xa7, 0xe9, 0xc4, 0x7f, 0x80, 0x83, + 0x00, 0x26, 0x1f, 0x5e, 0x43, 0x44, 0xa0, 0xca, + 0x60, 0x66, 0x88, 0x98, 0xc9, 0x4c, 0xe0, 0xb9, + 0x65, 0xc2, 0xb3, 0xea, 0x9b, 0x70, 0x00, 0x44, + 0x18, 0x8f, 0x5f, 0xbc, 0x04, 0x94, 0xa1, 0xa2, + 0x06, 0x46, 0x18, 0x10, 0x0e, 0xd6, 0x17, 0x9f, + 0xde, 0x1f, 0xa4, 0x66, 0x00, 0x20, 0x22, 0x3b, + 0x7f, 0xcc, 0x4c, 0x50, 0x66, 0x4c, 0x7f, 0x7d, + 0x85, 0xce, 0x76, 0xaf, 0xcc, 0x50, 0x26, 0x88, + 0x30, 0x62, 0xf7, 0x9f, 0x80, 0xc8, 0xdb, 0x2b, + 0xd7, 0x1a, 0xc0, 0x3e, 0xd4, 0x3c, 0x2b, 0x24, + 0x4c, 0x50, 0x31, 0x30, 0xc2, 0x04, 0x61, 0x86, + 0x0a, 0x81, 0xd9, 0x07, 0x91, 0x77, 0x35, 0x05, + 0xf6, 0x79, 0x88, 0xc8, 0x37, 0xbb, 0x25, 0xdf, + 0x28, 0xc0, 0x64, 0x7c, 0x66, 0x28, 0xfb, 0x50, + 0xf2, 0xe1, 0xfb, 0x61, 0x02, 0xf0, 0x0c, 0x20, + 0xb0, 0x0b, 0x15, 0x22, 0xea, 0x41, 0x98, 0xc3, + 0x56, 0xc0, 0x83, 0x10, 0x41, 0x7c, 0xcf, 0xf4, + 0x9f, 0x08, 0x22, 0x84, 0x87, 0x67, 0x97, 0x38, + 0x3f, 0xff, 0x89, 0x2f, 0xdf, 0xce, 0x8c, 0x4a, + 0x61, 0xb6, 0x40, 0x66, 0x2d, 0x08, 0xe4, 0x17, + 0x63, 0x2f, 0x27, 0x16, 0xdc, 0xdf, 0xd1, 0x23, + 0x28, 0xc0, 0x3e, 0x98, 0xbc, 0x95, 0x16, 0xfc, + 0xf8, 0x7e, 0x17, 0xca, 0xb7, 0x71, 0xef, 0x91, + 0x84, 0xab, 0x80, 0xef, 0x7b, 0x8b, 0x43, 0xc8, + 0xfe, 0xec, 0xf0, 0xcd, 0x40, 0xc4, 0xac, 0x99, + 0x43, 0x6d, 0xc1, 0xe2, 0x0c, 0xa8, 0x98, 0xd3, + 0x3f, 0x57, 0x41, 0xc5, 0xbc, 0x9a, 0x21, 0x9f, + 0x01, 0xd3, 0x02, 0xeb, 0xc1, 0x53, 0xa8, 0x0a, + 0x94, 0x09, 0x2a, 0x62, 0xa6, 0x32, 0x84, 0xcd, + 0xe7, 0xf8, 0xda, 0x01, 0xc6, 0xe3, 0x31, 0x5c, + 0xd7, 0x05, 0x91, 0x87, 0xcf, 0x1f, 0xdf, 0x06, + 0xdf, 0xfc, 0xf9, 0x3d, 0xb0, 0xb8, 0x13, 0x18, + 0xaa, 0x82, 0x4e, 0xa7, 0x03, 0x00, 0x68, 0xb7, + 0xdb, 0xd7, 0x03, 0x90, 0x48, 0x24, 0xcc, 0xe2, + 0xf9, 0xbb, 0xdd, 0x5b, 0x02, 0xf0, 0x6a, 0x8f, + 0x9c, 0x07, 0x01, 0x84, 0x39, 0x6e, 0x36, 0x40, + 0xb1, 0x58, 0x5c, 0xf1, 0x5b, 0xad, 0x16, 0x32, + 0x99, 0xcc, 0x4a, 0x7c, 0x38, 0x1c, 0xae, 0xf9, + 0xf5, 0x7a, 0x1d, 0xdd, 0x6e, 0x17, 0xa5, 0x52, + 0x29, 0xc8, 0x5b, 0x28, 0x14, 0x90, 0xcb, 0xe5, + 0xb6, 0x03, 0x6c, 0xba, 0x42, 0xa3, 0xd1, 0x28, + 0x7a, 0xbd, 0x1e, 0x6a, 0xb5, 0x5a, 0x60, 0xd3, + 0xe9, 0x34, 0x2c, 0xcb, 0x82, 0x6d, 0xdb, 0x68, + 0x36, 0x9b, 0x10, 0x91, 0xc0, 0x5f, 0xce, 0x23, + 0x22, 0x88, 0xc5, 0x62, 0x41, 0x7c, 0x5b, 0x8d, + 0x9d, 0x2d, 0x98, 0xc7, 0x97, 0xad, 0xeb, 0xba, + 0x28, 0x97, 0xcb, 0x2b, 0xf1, 0x6a, 0xb5, 0x0a, + 0x66, 0xc6, 0x60, 0x30, 0xd8, 0xf8, 0xdc, 0xb6, + 0x71, 0x6b, 0xb9, 0xd0, 0xdf, 0x73, 0x1b, 0x80, + 0x65, 0x59, 0xe8, 0xf7, 0xfb, 0xb0, 0x2c, 0x2b, + 0x88, 0xf7, 0x7a, 0xbd, 0x15, 0x7f, 0xd9, 0x6e, + 0xcb, 0x7d, 0x65, 0x05, 0x36, 0x29, 0x52, 0xa9, + 0x54, 0xd6, 0xe2, 0xd3, 0xe9, 0x34, 0x88, 0xe7, + 0xf3, 0x79, 0x64, 0xb3, 0xd9, 0xb5, 0xfc, 0x11, + 0xdb, 0xb6, 0xb5, 0xd1, 0x68, 0x60, 0x34, 0x1a, + 0xfd, 0x53, 0xaa, 0xeb, 0x1e, 0xc9, 0x64, 0x72, + 0xf5, 0x9f, 0xd1, 0x8d, 0x7c, 0x0d, 0x8f, 0x0a, + 0x90, 0x4a, 0xa5, 0x4e, 0x07, 0xe0, 0x38, 0xce, + 0x49, 0x8a, 0x03, 0xc0, 0x1f, 0xc1, 0xb5, 0x94, + 0x6a, 0x3d, 0x48, 0x0b, 0xf7, 0x00, 0x00, 0x00, + 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, + 0x82 +}; /* End Of File */ /* door_magic_small.png - 552 bytes */ unsigned char door_magic_small_png[552] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x84, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, - 0xcd, 0x6a, 0x93, 0x51, 0x10, 0x86, 0x9f, 0xb4, - 0x69, 0x68, 0x5a, 0x28, 0x6d, 0x25, 0xa0, 0xa5, - 0x14, 0xdc, 0x8b, 0xe0, 0x52, 0x7a, 0x05, 0xae, - 0xb3, 0x71, 0x21, 0x78, 0x13, 0xde, 0x4c, 0x96, - 0x5e, 0x40, 0xb6, 0x82, 0x3b, 0x57, 0x42, 0x70, - 0xa3, 0x78, 0x05, 0x1a, 0x5a, 0x5a, 0x68, 0xa9, - 0x95, 0xa4, 0x5f, 0xce, 0x99, 0x79, 0xe7, 0xb8, - 0xf8, 0x92, 0xe8, 0x87, 0x21, 0x82, 0x9d, 0xcd, - 0x81, 0xc3, 0xbc, 0xcf, 0xbc, 0xf3, 0xd3, 0x1a, - 0x0c, 0x06, 0x85, 0x7b, 0x44, 0x1b, 0xa0, 0xdf, - 0xef, 0xff, 0x97, 0x78, 0x38, 0x1c, 0xd6, 0x80, - 0x88, 0xb8, 0x9f, 0x83, 0x05, 0xc0, 0x6f, 0xce, - 0xb9, 0xfd, 0xf8, 0x96, 0x56, 0x7b, 0x03, 0x49, - 0x48, 0x22, 0x42, 0x48, 0x86, 0xc2, 0x49, 0x77, - 0x13, 0x4e, 0x5e, 0xbc, 0xa1, 0xdb, 0x7b, 0xdc, - 0x04, 0x48, 0x02, 0xc0, 0x52, 0xc5, 0xd6, 0xc1, - 0x21, 0xfb, 0x4f, 0x9e, 0xe1, 0x93, 0x5b, 0x14, - 0x85, 0x12, 0x02, 0x19, 0x9b, 0xdb, 0xbb, 0x8c, - 0x3f, 0x7d, 0x20, 0x57, 0x53, 0x3a, 0xf3, 0xfc, - 0xbf, 0x1c, 0x84, 0x44, 0x28, 0xb0, 0xe9, 0x0f, - 0xaa, 0xeb, 0x31, 0xa5, 0x14, 0x42, 0x42, 0x36, - 0x63, 0x67, 0xff, 0x11, 0xf2, 0x85, 0xab, 0x58, - 0x0d, 0x50, 0x08, 0x97, 0xd5, 0xa0, 0x08, 0x4a, - 0x04, 0x45, 0x4e, 0x71, 0x27, 0x3c, 0x93, 0x6d, - 0xf6, 0x0f, 0x80, 0x84, 0x2c, 0x53, 0x2c, 0x23, - 0x4b, 0x73, 0xc0, 0xef, 0x3f, 0xb7, 0x8c, 0xa2, - 0x09, 0xd8, 0x58, 0x00, 0x22, 0xa2, 0x76, 0xe0, - 0x99, 0x70, 0x23, 0x2c, 0xa3, 0x6c, 0x84, 0xcd, - 0x38, 0x3e, 0x3a, 0xe3, 0xf8, 0xe8, 0x0c, 0x4b, - 0x09, 0x57, 0x2c, 0xf3, 0x57, 0x3a, 0xf0, 0xa5, - 0x38, 0x51, 0xa2, 0x00, 0x99, 0xe9, 0xcf, 0x16, - 0x49, 0x5d, 0xcc, 0x9d, 0x90, 0xaf, 0x6f, 0xc1, - 0x2d, 0x11, 0xca, 0xc8, 0x13, 0x45, 0x75, 0x0b, - 0xe3, 0x9b, 0x0e, 0x7b, 0x0f, 0x36, 0xa1, 0x64, - 0xf4, 0x47, 0xf5, 0x15, 0x43, 0x74, 0xdc, 0xeb, - 0xea, 0x5e, 0x4d, 0x28, 0x85, 0xf9, 0x10, 0x2b, - 0x88, 0x0a, 0xb9, 0x21, 0xad, 0x00, 0x2c, 0xee, - 0x40, 0x2e, 0x2c, 0xdd, 0xd1, 0xee, 0xec, 0xd2, - 0x3d, 0x38, 0xa9, 0xc5, 0x21, 0x8a, 0x9c, 0xad, - 0x9d, 0x3d, 0x2c, 0xcf, 0x88, 0x68, 0x2d, 0xf3, - 0x1b, 0x0e, 0xce, 0x2f, 0xaf, 0xa8, 0x2e, 0x2e, - 0xc9, 0xdf, 0xbe, 0x72, 0x7d, 0xf1, 0xbd, 0xbe, - 0x3e, 0x39, 0x92, 0x53, 0x8a, 0x23, 0x09, 0x9b, - 0x5c, 0xf1, 0xe5, 0xfd, 0x3b, 0xd2, 0xf6, 0x67, - 0x5e, 0xbf, 0x7a, 0xd9, 0x04, 0x3c, 0xec, 0x1d, - 0x42, 0xef, 0x14, 0x9e, 0x9e, 0xb2, 0x2e, 0x9e, - 0xcf, 0xdf, 0xc6, 0x16, 0x46, 0xa3, 0xd1, 0x5a, - 0xd1, 0xba, 0xf8, 0x05, 0x29, 0xdb, 0x71, 0xff, - 0xd6, 0x47, 0x96, 0x83, 0x00, 0x00, 0x00, 0x00, - 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x84, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, + 0xcd, 0x6a, 0x93, 0x51, 0x10, 0x86, 0x9f, 0xb4, + 0x69, 0x68, 0x5a, 0x28, 0x6d, 0x25, 0xa0, 0xa5, + 0x14, 0xdc, 0x8b, 0xe0, 0x52, 0x7a, 0x05, 0xae, + 0xb3, 0x71, 0x21, 0x78, 0x13, 0xde, 0x4c, 0x96, + 0x5e, 0x40, 0xb6, 0x82, 0x3b, 0x57, 0x42, 0x70, + 0xa3, 0x78, 0x05, 0x1a, 0x5a, 0x5a, 0x68, 0xa9, + 0x95, 0xa4, 0x5f, 0xce, 0x99, 0x79, 0xe7, 0xb8, + 0xf8, 0x92, 0xe8, 0x87, 0x21, 0x82, 0x9d, 0xcd, + 0x81, 0xc3, 0xbc, 0xcf, 0xbc, 0xf3, 0xd3, 0x1a, + 0x0c, 0x06, 0x85, 0x7b, 0x44, 0x1b, 0xa0, 0xdf, + 0xef, 0xff, 0x97, 0x78, 0x38, 0x1c, 0xd6, 0x80, + 0x88, 0xb8, 0x9f, 0x83, 0x05, 0xc0, 0x6f, 0xce, + 0xb9, 0xfd, 0xf8, 0x96, 0x56, 0x7b, 0x03, 0x49, + 0x48, 0x22, 0x42, 0x48, 0x86, 0xc2, 0x49, 0x77, + 0x13, 0x4e, 0x5e, 0xbc, 0xa1, 0xdb, 0x7b, 0xdc, + 0x04, 0x48, 0x02, 0xc0, 0x52, 0xc5, 0xd6, 0xc1, + 0x21, 0xfb, 0x4f, 0x9e, 0xe1, 0x93, 0x5b, 0x14, + 0x85, 0x12, 0x02, 0x19, 0x9b, 0xdb, 0xbb, 0x8c, + 0x3f, 0x7d, 0x20, 0x57, 0x53, 0x3a, 0xf3, 0xfc, + 0xbf, 0x1c, 0x84, 0x44, 0x28, 0xb0, 0xe9, 0x0f, + 0xaa, 0xeb, 0x31, 0xa5, 0x14, 0x42, 0x42, 0x36, + 0x63, 0x67, 0xff, 0x11, 0xf2, 0x85, 0xab, 0x58, + 0x0d, 0x50, 0x08, 0x97, 0xd5, 0xa0, 0x08, 0x4a, + 0x04, 0x45, 0x4e, 0x71, 0x27, 0x3c, 0x93, 0x6d, + 0xf6, 0x0f, 0x80, 0x84, 0x2c, 0x53, 0x2c, 0x23, + 0x4b, 0x73, 0xc0, 0xef, 0x3f, 0xb7, 0x8c, 0xa2, + 0x09, 0xd8, 0x58, 0x00, 0x22, 0xa2, 0x76, 0xe0, + 0x99, 0x70, 0x23, 0x2c, 0xa3, 0x6c, 0x84, 0xcd, + 0x38, 0x3e, 0x3a, 0xe3, 0xf8, 0xe8, 0x0c, 0x4b, + 0x09, 0x57, 0x2c, 0xf3, 0x57, 0x3a, 0xf0, 0xa5, + 0x38, 0x51, 0xa2, 0x00, 0x99, 0xe9, 0xcf, 0x16, + 0x49, 0x5d, 0xcc, 0x9d, 0x90, 0xaf, 0x6f, 0xc1, + 0x2d, 0x11, 0xca, 0xc8, 0x13, 0x45, 0x75, 0x0b, + 0xe3, 0x9b, 0x0e, 0x7b, 0x0f, 0x36, 0xa1, 0x64, + 0xf4, 0x47, 0xf5, 0x15, 0x43, 0x74, 0xdc, 0xeb, + 0xea, 0x5e, 0x4d, 0x28, 0x85, 0xf9, 0x10, 0x2b, + 0x88, 0x0a, 0xb9, 0x21, 0xad, 0x00, 0x2c, 0xee, + 0x40, 0x2e, 0x2c, 0xdd, 0xd1, 0xee, 0xec, 0xd2, + 0x3d, 0x38, 0xa9, 0xc5, 0x21, 0x8a, 0x9c, 0xad, + 0x9d, 0x3d, 0x2c, 0xcf, 0x88, 0x68, 0x2d, 0xf3, + 0x1b, 0x0e, 0xce, 0x2f, 0xaf, 0xa8, 0x2e, 0x2e, + 0xc9, 0xdf, 0xbe, 0x72, 0x7d, 0xf1, 0xbd, 0xbe, + 0x3e, 0x39, 0x92, 0x53, 0x8a, 0x23, 0x09, 0x9b, + 0x5c, 0xf1, 0xe5, 0xfd, 0x3b, 0xd2, 0xf6, 0x67, + 0x5e, 0xbf, 0x7a, 0xd9, 0x04, 0x3c, 0xec, 0x1d, + 0x42, 0xef, 0x14, 0x9e, 0x9e, 0xb2, 0x2e, 0x9e, + 0xcf, 0xdf, 0xc6, 0x16, 0x46, 0xa3, 0xd1, 0x5a, + 0xd1, 0xba, 0xf8, 0x05, 0x29, 0xdb, 0x71, 0xff, + 0xd6, 0x47, 0x96, 0x83, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; /* End Of File */ /* door_normal.png - 748 bytes */ unsigned char door_normal_png[748] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x48, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x97, - 0xbf, 0x8f, 0x12, 0x41, 0x14, 0xc7, 0xbf, 0xf8, - 0x23, 0x3a, 0x16, 0x5e, 0xf4, 0xb4, 0x30, 0x17, - 0x42, 0x43, 0x01, 0x85, 0x84, 0xda, 0xd6, 0xc6, - 0xff, 0x80, 0x86, 0x10, 0x2c, 0xa0, 0xa6, 0x27, - 0x94, 0xd6, 0xb4, 0xb2, 0xdb, 0x00, 0x21, 0x36, - 0x26, 0x56, 0x16, 0x16, 0xfe, 0x0b, 0x36, 0x94, - 0xd2, 0x40, 0xe1, 0x45, 0x13, 0xb9, 0xd8, 0x8d, - 0xee, 0xbe, 0x1f, 0x16, 0x03, 0xcb, 0x71, 0x70, - 0xb0, 0x98, 0xdb, 0xdb, 0x2b, 0x9c, 0x64, 0x32, - 0xf3, 0xb2, 0x6f, 0xe6, 0x7d, 0xe6, 0xfb, 0xde, - 0xee, 0x64, 0x33, 0xbd, 0x5e, 0x4f, 0x91, 0x62, - 0xbb, 0x03, 0x00, 0xcd, 0x66, 0x33, 0x95, 0xe0, - 0x9e, 0xe7, 0x39, 0x00, 0x00, 0x98, 0xcf, 0xe7, - 0xd7, 0x1a, 0xfc, 0xf8, 0xf8, 0x18, 0x00, 0x56, - 0x00, 0xaa, 0xe9, 0x64, 0xe2, 0x3f, 0xc0, 0x41, - 0x00, 0xf3, 0x8f, 0x6f, 0x20, 0x22, 0x50, 0x65, - 0x30, 0x33, 0x44, 0x5c, 0x67, 0x26, 0xf0, 0x72, - 0x64, 0x42, 0xf1, 0xf5, 0xdb, 0x64, 0x00, 0x44, - 0x18, 0x4f, 0x5f, 0xbc, 0x04, 0x94, 0xa1, 0xa2, - 0x0e, 0x46, 0x18, 0x10, 0x8e, 0xe6, 0x5f, 0x3f, - 0x7f, 0x38, 0x48, 0xcd, 0x08, 0x40, 0x44, 0xf6, - 0x3a, 0x33, 0x13, 0x94, 0x19, 0xbf, 0x7f, 0x7d, - 0x83, 0x2e, 0x4e, 0xaf, 0xcc, 0x50, 0x26, 0x88, - 0x30, 0xee, 0x3f, 0x7c, 0x06, 0xa2, 0x20, 0xd6, - 0x5e, 0x1b, 0x00, 0x71, 0xa8, 0x79, 0x11, 0x48, - 0x98, 0xa0, 0xe2, 0x60, 0x84, 0x09, 0xc2, 0x0c, - 0x15, 0x02, 0x73, 0x08, 0xa2, 0xe0, 0xdf, 0x14, - 0x88, 0xb3, 0x88, 0x28, 0x74, 0xa7, 0xa5, 0xd0, - 0x29, 0xc0, 0xe4, 0x6c, 0x66, 0x28, 0x87, 0x50, - 0x0a, 0x11, 0x86, 0x49, 0x02, 0xf0, 0x02, 0x20, - 0x1a, 0x57, 0x2a, 0x64, 0x34, 0x80, 0x30, 0x27, - 0xad, 0x40, 0x00, 0x21, 0x82, 0x84, 0x81, 0xcb, - 0x3f, 0x11, 0x44, 0x08, 0x8f, 0x8f, 0xce, 0x70, - 0x72, 0xf2, 0x13, 0xb3, 0xd3, 0x23, 0xa7, 0x52, - 0x92, 0x29, 0x90, 0x45, 0x0a, 0x22, 0xf9, 0xc5, - 0x8d, 0x67, 0x73, 0x03, 0xfb, 0xe7, 0xee, 0x35, - 0x28, 0xc0, 0x21, 0x98, 0x82, 0xb5, 0x14, 0xfc, - 0xf8, 0x7e, 0x0f, 0xca, 0xb7, 0xf1, 0xe0, 0x89, - 0x24, 0xab, 0x40, 0x18, 0x06, 0xab, 0x22, 0xe4, - 0x70, 0x51, 0x7c, 0x0b, 0x10, 0x71, 0x73, 0xe6, - 0x44, 0x53, 0xb0, 0xaa, 0x01, 0x15, 0x57, 0xfd, - 0x4b, 0x15, 0x54, 0xdc, 0xab, 0x99, 0x70, 0x0d, - 0xb8, 0x14, 0x98, 0x47, 0x59, 0xa8, 0x0a, 0x94, - 0x09, 0x2a, 0xe2, 0xba, 0x32, 0x84, 0xdd, 0xe7, - 0xf8, 0xca, 0x01, 0x26, 0x93, 0x09, 0xac, 0xb5, - 0x20, 0x0a, 0xf0, 0xe5, 0xd3, 0xbb, 0xe8, 0x9b, - 0xbf, 0xbc, 0x07, 0x56, 0x77, 0x02, 0x43, 0x55, - 0xd0, 0xed, 0x76, 0x01, 0x00, 0xad, 0x56, 0xeb, - 0x6a, 0x00, 0xf2, 0xf9, 0xbc, 0x9b, 0x3c, 0x7f, - 0xbf, 0xff, 0x48, 0x00, 0x5e, 0xc5, 0xd8, 0xf3, - 0x20, 0x80, 0x24, 0xdb, 0xcd, 0x04, 0xa8, 0x56, - 0xab, 0x00, 0x80, 0x62, 0xb1, 0x88, 0x76, 0xbb, - 0x1d, 0xd9, 0x00, 0x30, 0x1a, 0x8d, 0x76, 0xda, - 0xc6, 0x18, 0xf8, 0xbe, 0xbf, 0xe1, 0xd3, 0x68, - 0x34, 0xe0, 0xfb, 0xfe, 0x06, 0xc0, 0xad, 0xe5, - 0x44, 0x44, 0xa2, 0x6e, 0x8c, 0xc1, 0x70, 0x38, - 0xc4, 0x74, 0x3a, 0x5d, 0xb3, 0x8d, 0x31, 0x97, - 0xda, 0x95, 0x4a, 0x05, 0xd9, 0x6c, 0x16, 0xb9, - 0x5c, 0x0e, 0x83, 0xc1, 0x60, 0xc3, 0xe7, 0x62, - 0x8c, 0x9d, 0x0a, 0x9c, 0xb7, 0xb7, 0x8d, 0xd6, - 0x5a, 0xd4, 0x6a, 0x35, 0x14, 0x0a, 0x85, 0x8d, - 0xe7, 0x17, 0x7d, 0xb6, 0xed, 0xb1, 0x55, 0x01, - 0x55, 0x8d, 0xfa, 0x3e, 0x00, 0x63, 0x0c, 0xfa, - 0xfd, 0x3e, 0x66, 0xb3, 0xd9, 0xa5, 0xb5, 0xb3, - 0xf4, 0x31, 0xc6, 0xac, 0xad, 0x3d, 0x1f, 0x23, - 0x36, 0x80, 0xb5, 0x16, 0xf5, 0x7a, 0x1d, 0xd6, - 0xda, 0x58, 0x80, 0xbb, 0xf6, 0xe8, 0x74, 0x3a, - 0x6b, 0x00, 0x99, 0x5e, 0xaf, 0xa7, 0xcd, 0x66, - 0x13, 0xe3, 0xf1, 0x78, 0xeb, 0x49, 0x92, 0x6a, - 0xa5, 0x52, 0x69, 0xfd, 0xcf, 0xe8, 0x46, 0xbd, - 0x86, 0xa9, 0x00, 0x94, 0xcb, 0xe5, 0xf4, 0x00, - 0x3c, 0xcf, 0x4b, 0x25, 0x38, 0x00, 0xfc, 0x05, - 0xb9, 0xfe, 0xb3, 0xfb, 0x75, 0x69, 0xf0, 0x5c, - 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, - 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x48, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x97, + 0xbf, 0x8f, 0x12, 0x41, 0x14, 0xc7, 0xbf, 0xf8, + 0x23, 0x3a, 0x16, 0x5e, 0xf4, 0xb4, 0x30, 0x17, + 0x42, 0x43, 0x01, 0x85, 0x84, 0xda, 0xd6, 0xc6, + 0xff, 0x80, 0x86, 0x10, 0x2c, 0xa0, 0xa6, 0x27, + 0x94, 0xd6, 0xb4, 0xb2, 0xdb, 0x00, 0x21, 0x36, + 0x26, 0x56, 0x16, 0x16, 0xfe, 0x0b, 0x36, 0x94, + 0xd2, 0x40, 0xe1, 0x45, 0x13, 0xb9, 0xd8, 0x8d, + 0xee, 0xbe, 0x1f, 0x16, 0x03, 0xcb, 0x71, 0x70, + 0xb0, 0x98, 0xdb, 0xdb, 0x2b, 0x9c, 0x64, 0x32, + 0xf3, 0xb2, 0x6f, 0xe6, 0x7d, 0xe6, 0xfb, 0xde, + 0xee, 0x64, 0x33, 0xbd, 0x5e, 0x4f, 0x91, 0x62, + 0xbb, 0x03, 0x00, 0xcd, 0x66, 0x33, 0x95, 0xe0, + 0x9e, 0xe7, 0x39, 0x00, 0x00, 0x98, 0xcf, 0xe7, + 0xd7, 0x1a, 0xfc, 0xf8, 0xf8, 0x18, 0x00, 0x56, + 0x00, 0xaa, 0xe9, 0x64, 0xe2, 0x3f, 0xc0, 0x41, + 0x00, 0xf3, 0x8f, 0x6f, 0x20, 0x22, 0x50, 0x65, + 0x30, 0x33, 0x44, 0x5c, 0x67, 0x26, 0xf0, 0x72, + 0x64, 0x42, 0xf1, 0xf5, 0xdb, 0x64, 0x00, 0x44, + 0x18, 0x4f, 0x5f, 0xbc, 0x04, 0x94, 0xa1, 0xa2, + 0x0e, 0x46, 0x18, 0x10, 0x8e, 0xe6, 0x5f, 0x3f, + 0x7f, 0x38, 0x48, 0xcd, 0x08, 0x40, 0x44, 0xf6, + 0x3a, 0x33, 0x13, 0x94, 0x19, 0xbf, 0x7f, 0x7d, + 0x83, 0x2e, 0x4e, 0xaf, 0xcc, 0x50, 0x26, 0x88, + 0x30, 0xee, 0x3f, 0x7c, 0x06, 0xa2, 0x20, 0xd6, + 0x5e, 0x1b, 0x00, 0x71, 0xa8, 0x79, 0x11, 0x48, + 0x98, 0xa0, 0xe2, 0x60, 0x84, 0x09, 0xc2, 0x0c, + 0x15, 0x02, 0x73, 0x08, 0xa2, 0xe0, 0xdf, 0x14, + 0x88, 0xb3, 0x88, 0x28, 0x74, 0xa7, 0xa5, 0xd0, + 0x29, 0xc0, 0xe4, 0x6c, 0x66, 0x28, 0x87, 0x50, + 0x0a, 0x11, 0x86, 0x49, 0x02, 0xf0, 0x02, 0x20, + 0x1a, 0x57, 0x2a, 0x64, 0x34, 0x80, 0x30, 0x27, + 0xad, 0x40, 0x00, 0x21, 0x82, 0x84, 0x81, 0xcb, + 0x3f, 0x11, 0x44, 0x08, 0x8f, 0x8f, 0xce, 0x70, + 0x72, 0xf2, 0x13, 0xb3, 0xd3, 0x23, 0xa7, 0x52, + 0x92, 0x29, 0x90, 0x45, 0x0a, 0x22, 0xf9, 0xc5, + 0x8d, 0x67, 0x73, 0x03, 0xfb, 0xe7, 0xee, 0x35, + 0x28, 0xc0, 0x21, 0x98, 0x82, 0xb5, 0x14, 0xfc, + 0xf8, 0x7e, 0x0f, 0xca, 0xb7, 0xf1, 0xe0, 0x89, + 0x24, 0xab, 0x40, 0x18, 0x06, 0xab, 0x22, 0xe4, + 0x70, 0x51, 0x7c, 0x0b, 0x10, 0x71, 0x73, 0xe6, + 0x44, 0x53, 0xb0, 0xaa, 0x01, 0x15, 0x57, 0xfd, + 0x4b, 0x15, 0x54, 0xdc, 0xab, 0x99, 0x70, 0x0d, + 0xb8, 0x14, 0x98, 0x47, 0x59, 0xa8, 0x0a, 0x94, + 0x09, 0x2a, 0xe2, 0xba, 0x32, 0x84, 0xdd, 0xe7, + 0xf8, 0xca, 0x01, 0x26, 0x93, 0x09, 0xac, 0xb5, + 0x20, 0x0a, 0xf0, 0xe5, 0xd3, 0xbb, 0xe8, 0x9b, + 0xbf, 0xbc, 0x07, 0x56, 0x77, 0x02, 0x43, 0x55, + 0xd0, 0xed, 0x76, 0x01, 0x00, 0xad, 0x56, 0xeb, + 0x6a, 0x00, 0xf2, 0xf9, 0xbc, 0x9b, 0x3c, 0x7f, + 0xbf, 0xff, 0x48, 0x00, 0x5e, 0xc5, 0xd8, 0xf3, + 0x20, 0x80, 0x24, 0xdb, 0xcd, 0x04, 0xa8, 0x56, + 0xab, 0x00, 0x80, 0x62, 0xb1, 0x88, 0x76, 0xbb, + 0x1d, 0xd9, 0x00, 0x30, 0x1a, 0x8d, 0x76, 0xda, + 0xc6, 0x18, 0xf8, 0xbe, 0xbf, 0xe1, 0xd3, 0x68, + 0x34, 0xe0, 0xfb, 0xfe, 0x06, 0xc0, 0xad, 0xe5, + 0x44, 0x44, 0xa2, 0x6e, 0x8c, 0xc1, 0x70, 0x38, + 0xc4, 0x74, 0x3a, 0x5d, 0xb3, 0x8d, 0x31, 0x97, + 0xda, 0x95, 0x4a, 0x05, 0xd9, 0x6c, 0x16, 0xb9, + 0x5c, 0x0e, 0x83, 0xc1, 0x60, 0xc3, 0xe7, 0x62, + 0x8c, 0x9d, 0x0a, 0x9c, 0xb7, 0xb7, 0x8d, 0xd6, + 0x5a, 0xd4, 0x6a, 0x35, 0x14, 0x0a, 0x85, 0x8d, + 0xe7, 0x17, 0x7d, 0xb6, 0xed, 0xb1, 0x55, 0x01, + 0x55, 0x8d, 0xfa, 0x3e, 0x00, 0x63, 0x0c, 0xfa, + 0xfd, 0x3e, 0x66, 0xb3, 0xd9, 0xa5, 0xb5, 0xb3, + 0xf4, 0x31, 0xc6, 0xac, 0xad, 0x3d, 0x1f, 0x23, + 0x36, 0x80, 0xb5, 0x16, 0xf5, 0x7a, 0x1d, 0xd6, + 0xda, 0x58, 0x80, 0xbb, 0xf6, 0xe8, 0x74, 0x3a, + 0x6b, 0x00, 0x99, 0x5e, 0xaf, 0xa7, 0xcd, 0x66, + 0x13, 0xe3, 0xf1, 0x78, 0xeb, 0x49, 0x92, 0x6a, + 0xa5, 0x52, 0x69, 0xfd, 0xcf, 0xe8, 0x46, 0xbd, + 0x86, 0xa9, 0x00, 0x94, 0xcb, 0xe5, 0xf4, 0x00, + 0x3c, 0xcf, 0x4b, 0x25, 0x38, 0x00, 0xfc, 0x05, + 0xb9, 0xfe, 0xb3, 0xfb, 0x75, 0x69, 0xf0, 0x5c, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, + 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* door_normal_small.png - 552 bytes */ unsigned char door_normal_small_png[552] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x84, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, - 0xcd, 0x6a, 0x93, 0x51, 0x10, 0x86, 0x9f, 0xb4, - 0x69, 0x68, 0x5a, 0x28, 0x6d, 0x25, 0xa0, 0xa5, - 0x14, 0xdc, 0x8b, 0xe0, 0x52, 0x7a, 0x05, 0xae, - 0xb3, 0x71, 0x21, 0x78, 0x13, 0xde, 0x4c, 0x96, - 0x5e, 0x40, 0xb6, 0x82, 0x3b, 0x57, 0x42, 0x70, - 0xa3, 0x78, 0x05, 0x1a, 0x5a, 0x5a, 0x68, 0xa9, - 0x95, 0xa4, 0x5f, 0xce, 0x99, 0x79, 0xe7, 0xb8, - 0xf8, 0x92, 0xe8, 0x87, 0x21, 0x82, 0x9d, 0xcd, - 0x81, 0xc3, 0xbc, 0xcf, 0xbc, 0xf3, 0xd3, 0x1a, - 0x0c, 0x06, 0x85, 0x7b, 0x44, 0x1b, 0xa0, 0xdf, - 0xef, 0xff, 0x97, 0x78, 0x38, 0x1c, 0xd6, 0x80, - 0x88, 0xb8, 0x9f, 0x83, 0x05, 0xc0, 0x6f, 0xce, - 0xb9, 0xfd, 0xf8, 0x96, 0x56, 0x7b, 0x03, 0x49, - 0x48, 0x22, 0x42, 0x48, 0x86, 0xc2, 0x49, 0x77, - 0x13, 0x4e, 0x5e, 0xbc, 0xa1, 0xdb, 0x7b, 0xdc, - 0x04, 0x48, 0x02, 0xc0, 0x52, 0xc5, 0xd6, 0xc1, - 0x21, 0xfb, 0x4f, 0x9e, 0xe1, 0x93, 0x5b, 0x14, - 0x85, 0x12, 0x02, 0x19, 0x9b, 0xdb, 0xbb, 0x8c, - 0x3f, 0x7d, 0x20, 0x57, 0x53, 0x3a, 0xf3, 0xfc, - 0xbf, 0x1c, 0x84, 0x44, 0x28, 0xb0, 0xe9, 0x0f, - 0xaa, 0xeb, 0x31, 0xa5, 0x14, 0x42, 0x42, 0x36, - 0x63, 0x67, 0xff, 0x11, 0xf2, 0x85, 0xab, 0x58, - 0x0d, 0x50, 0x08, 0x97, 0xd5, 0xa0, 0x08, 0x4a, - 0x04, 0x45, 0x4e, 0x71, 0x27, 0x3c, 0x93, 0x6d, - 0xf6, 0x0f, 0x80, 0x84, 0x2c, 0x53, 0x2c, 0x23, - 0x4b, 0x73, 0xc0, 0xef, 0x3f, 0xb7, 0x8c, 0xa2, - 0x09, 0xd8, 0x58, 0x00, 0x22, 0xa2, 0x76, 0xe0, - 0x99, 0x70, 0x23, 0x2c, 0xa3, 0x6c, 0x84, 0xcd, - 0x38, 0x3e, 0x3a, 0xe3, 0xf8, 0xe8, 0x0c, 0x4b, - 0x09, 0x57, 0x2c, 0xf3, 0x57, 0x3a, 0xf0, 0xa5, - 0x38, 0x51, 0xa2, 0x00, 0x99, 0xe9, 0xcf, 0x16, - 0x49, 0x5d, 0xcc, 0x9d, 0x90, 0xaf, 0x6f, 0xc1, - 0x2d, 0x11, 0xca, 0xc8, 0x13, 0x45, 0x75, 0x0b, - 0xe3, 0x9b, 0x0e, 0x7b, 0x0f, 0x36, 0xa1, 0x64, - 0xf4, 0x47, 0xf5, 0x15, 0x43, 0x74, 0xdc, 0xeb, - 0xea, 0x5e, 0x4d, 0x28, 0x85, 0xf9, 0x10, 0x2b, - 0x88, 0x0a, 0xb9, 0x21, 0xad, 0x00, 0x2c, 0xee, - 0x40, 0x2e, 0x2c, 0xdd, 0xd1, 0xee, 0xec, 0xd2, - 0x3d, 0x38, 0xa9, 0xc5, 0x21, 0x8a, 0x9c, 0xad, - 0x9d, 0x3d, 0x2c, 0xcf, 0x88, 0x68, 0x2d, 0xf3, - 0x1b, 0x0e, 0xce, 0x2f, 0xaf, 0xa8, 0x2e, 0x2e, - 0xc9, 0xdf, 0xbe, 0x72, 0x7d, 0xf1, 0xbd, 0xbe, - 0x3e, 0x39, 0x92, 0x53, 0x8a, 0x23, 0x09, 0x9b, - 0x5c, 0xf1, 0xe5, 0xfd, 0x3b, 0xd2, 0xf6, 0x67, - 0x5e, 0xbf, 0x7a, 0xd9, 0x04, 0x3c, 0xec, 0x1d, - 0x42, 0xef, 0x14, 0x9e, 0x9e, 0xb2, 0x2e, 0x9e, - 0xcf, 0xdf, 0xc6, 0x16, 0x46, 0xa3, 0xd1, 0x5a, - 0xd1, 0xba, 0xf8, 0x05, 0x29, 0xdb, 0x71, 0xff, - 0xd6, 0x47, 0x96, 0x83, 0x00, 0x00, 0x00, 0x00, - 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x84, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, + 0xcd, 0x6a, 0x93, 0x51, 0x10, 0x86, 0x9f, 0xb4, + 0x69, 0x68, 0x5a, 0x28, 0x6d, 0x25, 0xa0, 0xa5, + 0x14, 0xdc, 0x8b, 0xe0, 0x52, 0x7a, 0x05, 0xae, + 0xb3, 0x71, 0x21, 0x78, 0x13, 0xde, 0x4c, 0x96, + 0x5e, 0x40, 0xb6, 0x82, 0x3b, 0x57, 0x42, 0x70, + 0xa3, 0x78, 0x05, 0x1a, 0x5a, 0x5a, 0x68, 0xa9, + 0x95, 0xa4, 0x5f, 0xce, 0x99, 0x79, 0xe7, 0xb8, + 0xf8, 0x92, 0xe8, 0x87, 0x21, 0x82, 0x9d, 0xcd, + 0x81, 0xc3, 0xbc, 0xcf, 0xbc, 0xf3, 0xd3, 0x1a, + 0x0c, 0x06, 0x85, 0x7b, 0x44, 0x1b, 0xa0, 0xdf, + 0xef, 0xff, 0x97, 0x78, 0x38, 0x1c, 0xd6, 0x80, + 0x88, 0xb8, 0x9f, 0x83, 0x05, 0xc0, 0x6f, 0xce, + 0xb9, 0xfd, 0xf8, 0x96, 0x56, 0x7b, 0x03, 0x49, + 0x48, 0x22, 0x42, 0x48, 0x86, 0xc2, 0x49, 0x77, + 0x13, 0x4e, 0x5e, 0xbc, 0xa1, 0xdb, 0x7b, 0xdc, + 0x04, 0x48, 0x02, 0xc0, 0x52, 0xc5, 0xd6, 0xc1, + 0x21, 0xfb, 0x4f, 0x9e, 0xe1, 0x93, 0x5b, 0x14, + 0x85, 0x12, 0x02, 0x19, 0x9b, 0xdb, 0xbb, 0x8c, + 0x3f, 0x7d, 0x20, 0x57, 0x53, 0x3a, 0xf3, 0xfc, + 0xbf, 0x1c, 0x84, 0x44, 0x28, 0xb0, 0xe9, 0x0f, + 0xaa, 0xeb, 0x31, 0xa5, 0x14, 0x42, 0x42, 0x36, + 0x63, 0x67, 0xff, 0x11, 0xf2, 0x85, 0xab, 0x58, + 0x0d, 0x50, 0x08, 0x97, 0xd5, 0xa0, 0x08, 0x4a, + 0x04, 0x45, 0x4e, 0x71, 0x27, 0x3c, 0x93, 0x6d, + 0xf6, 0x0f, 0x80, 0x84, 0x2c, 0x53, 0x2c, 0x23, + 0x4b, 0x73, 0xc0, 0xef, 0x3f, 0xb7, 0x8c, 0xa2, + 0x09, 0xd8, 0x58, 0x00, 0x22, 0xa2, 0x76, 0xe0, + 0x99, 0x70, 0x23, 0x2c, 0xa3, 0x6c, 0x84, 0xcd, + 0x38, 0x3e, 0x3a, 0xe3, 0xf8, 0xe8, 0x0c, 0x4b, + 0x09, 0x57, 0x2c, 0xf3, 0x57, 0x3a, 0xf0, 0xa5, + 0x38, 0x51, 0xa2, 0x00, 0x99, 0xe9, 0xcf, 0x16, + 0x49, 0x5d, 0xcc, 0x9d, 0x90, 0xaf, 0x6f, 0xc1, + 0x2d, 0x11, 0xca, 0xc8, 0x13, 0x45, 0x75, 0x0b, + 0xe3, 0x9b, 0x0e, 0x7b, 0x0f, 0x36, 0xa1, 0x64, + 0xf4, 0x47, 0xf5, 0x15, 0x43, 0x74, 0xdc, 0xeb, + 0xea, 0x5e, 0x4d, 0x28, 0x85, 0xf9, 0x10, 0x2b, + 0x88, 0x0a, 0xb9, 0x21, 0xad, 0x00, 0x2c, 0xee, + 0x40, 0x2e, 0x2c, 0xdd, 0xd1, 0xee, 0xec, 0xd2, + 0x3d, 0x38, 0xa9, 0xc5, 0x21, 0x8a, 0x9c, 0xad, + 0x9d, 0x3d, 0x2c, 0xcf, 0x88, 0x68, 0x2d, 0xf3, + 0x1b, 0x0e, 0xce, 0x2f, 0xaf, 0xa8, 0x2e, 0x2e, + 0xc9, 0xdf, 0xbe, 0x72, 0x7d, 0xf1, 0xbd, 0xbe, + 0x3e, 0x39, 0x92, 0x53, 0x8a, 0x23, 0x09, 0x9b, + 0x5c, 0xf1, 0xe5, 0xfd, 0x3b, 0xd2, 0xf6, 0x67, + 0x5e, 0xbf, 0x7a, 0xd9, 0x04, 0x3c, 0xec, 0x1d, + 0x42, 0xef, 0x14, 0x9e, 0x9e, 0xb2, 0x2e, 0x9e, + 0xcf, 0xdf, 0xc6, 0x16, 0x46, 0xa3, 0xd1, 0x5a, + 0xd1, 0xba, 0xf8, 0x05, 0x29, 0xdb, 0x71, 0xff, + 0xd6, 0x47, 0x96, 0x83, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; /* End Of File */ /* door_quest.png - 764 bytes */ unsigned char door_quest_png[764] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x58, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x97, - 0x3b, 0x8f, 0x12, 0x51, 0x14, 0xc7, 0xff, 0xf8, - 0x88, 0x8e, 0x85, 0x1b, 0x5d, 0x2c, 0xcc, 0x46, - 0x2a, 0x1a, 0x0b, 0x09, 0xb5, 0xad, 0x8d, 0x1f, - 0x82, 0x4c, 0xa0, 0x80, 0x84, 0x90, 0x10, 0x7a, - 0x6a, 0x6b, 0x1a, 0x08, 0x32, 0x53, 0x40, 0x26, - 0xc4, 0xc6, 0xc4, 0xca, 0xc2, 0xc2, 0xaf, 0x60, - 0x43, 0x29, 0x95, 0x85, 0x46, 0x13, 0xd9, 0xd8, - 0x8d, 0xce, 0x3d, 0x0f, 0x8b, 0xcb, 0x0c, 0x8b, - 0xb0, 0x3c, 0x36, 0x3b, 0xcb, 0x16, 0xde, 0xe4, - 0xe6, 0xde, 0x33, 0x8f, 0x73, 0x7e, 0xf7, 0x7f, - 0xce, 0xdc, 0x9b, 0xc9, 0x0c, 0x06, 0x03, 0xc5, - 0x01, 0xdb, 0x2d, 0x00, 0xa8, 0xd5, 0x6a, 0x07, - 0x09, 0xee, 0x79, 0x9e, 0x05, 0x00, 0x80, 0xd9, - 0x6c, 0x76, 0xa5, 0xc1, 0x8f, 0x8f, 0x8f, 0x01, - 0x60, 0x01, 0xa0, 0x7a, 0x98, 0x4c, 0xfc, 0x07, - 0xd8, 0x0b, 0x60, 0xf6, 0xfe, 0x15, 0x44, 0x04, - 0xaa, 0x0c, 0x66, 0x86, 0x88, 0xed, 0xcc, 0x04, - 0x8e, 0x47, 0x26, 0x3c, 0xad, 0xbc, 0x4e, 0x07, - 0x40, 0x84, 0xf1, 0xe8, 0xf9, 0x0b, 0x40, 0x19, - 0x2a, 0x6a, 0x61, 0x84, 0x01, 0xe1, 0x64, 0xfe, - 0xf9, 0xe3, 0xbb, 0xbd, 0xd4, 0x4c, 0x00, 0x44, - 0x64, 0xeb, 0xc3, 0xcc, 0x04, 0x65, 0xc6, 0xef, - 0x5f, 0x5f, 0xa1, 0xf3, 0xd5, 0x2b, 0x33, 0x94, - 0x09, 0x22, 0x8c, 0xbb, 0xf7, 0x1f, 0x83, 0x28, - 0xda, 0xc9, 0xd7, 0x0a, 0xc0, 0x2e, 0xd4, 0x3c, - 0x0f, 0x24, 0x4c, 0x50, 0xb1, 0x30, 0xc2, 0x04, - 0x61, 0x86, 0x0a, 0x81, 0xd9, 0x80, 0x28, 0xba, - 0x98, 0x02, 0xbb, 0xbc, 0x44, 0x64, 0xec, 0x6a, - 0xc9, 0x58, 0x05, 0x98, 0xac, 0xcd, 0x0c, 0x65, - 0x03, 0x25, 0x03, 0x63, 0xd2, 0x04, 0xe0, 0x39, - 0x40, 0x32, 0x2e, 0x54, 0xc8, 0x68, 0x04, 0x61, - 0x4e, 0x5b, 0x81, 0x08, 0x42, 0x04, 0x31, 0x91, - 0xcd, 0x3f, 0x11, 0x44, 0x08, 0x0f, 0x8f, 0x4e, - 0x71, 0x72, 0xf2, 0x13, 0x5f, 0xbe, 0x1d, 0x59, - 0x95, 0xd2, 0x4c, 0x81, 0xcc, 0x53, 0x90, 0xc8, - 0x2f, 0x76, 0x3c, 0x9d, 0x39, 0x08, 0xff, 0xdc, - 0xbe, 0x02, 0x05, 0xd8, 0x80, 0x29, 0x5a, 0x4a, - 0xc1, 0x8f, 0xef, 0x77, 0xa0, 0x7c, 0x13, 0xf7, - 0xb2, 0x92, 0xae, 0x02, 0xc6, 0x44, 0x8b, 0x22, - 0x64, 0x33, 0x2f, 0xbe, 0x39, 0x88, 0xd8, 0x39, - 0x73, 0xaa, 0x29, 0x58, 0xd4, 0x80, 0x8a, 0xad, - 0xfe, 0x58, 0x05, 0x15, 0xfb, 0x69, 0xa6, 0x5c, - 0x03, 0x36, 0x05, 0xce, 0x83, 0x27, 0x50, 0x15, - 0x28, 0x13, 0x54, 0xc4, 0x76, 0x65, 0x08, 0xdb, - 0xed, 0xf8, 0xd2, 0x01, 0xa6, 0xd3, 0x29, 0xc2, - 0x30, 0x04, 0x51, 0x84, 0x4f, 0x1f, 0xde, 0x24, - 0x7b, 0x7e, 0x7c, 0x0e, 0x2c, 0xce, 0x04, 0x86, - 0xaa, 0xa0, 0xd3, 0xe9, 0x00, 0x00, 0x5a, 0xad, - 0xd6, 0xe5, 0x00, 0xe4, 0xf3, 0x79, 0x3b, 0x79, - 0xf6, 0x76, 0xfb, 0x92, 0x00, 0xbc, 0xdc, 0xc1, - 0xe7, 0x5e, 0x00, 0x69, 0xb6, 0xeb, 0x0d, 0x50, - 0x2a, 0x95, 0x92, 0x79, 0xb3, 0xd9, 0x84, 0xef, - 0xfb, 0xf0, 0x7d, 0x1f, 0xd5, 0x6a, 0x15, 0xbe, - 0xef, 0x2f, 0xdd, 0x1f, 0x8f, 0xc7, 0x5b, 0xed, - 0x75, 0xed, 0x46, 0x3c, 0x11, 0x91, 0x95, 0xee, - 0x38, 0x0e, 0x82, 0x20, 0x40, 0x36, 0x9b, 0x4d, - 0x00, 0xe3, 0xa3, 0xf6, 0xec, 0xfd, 0x20, 0x08, - 0xd6, 0xda, 0x41, 0x10, 0x24, 0xd7, 0xfe, 0xf5, - 0xbd, 0x02, 0xa0, 0xaa, 0x2b, 0xfd, 0xac, 0x32, - 0xeb, 0xc6, 0x30, 0x0c, 0xe1, 0xba, 0x2e, 0xda, - 0xed, 0xf6, 0x92, 0xed, 0xba, 0xee, 0x8a, 0x8f, - 0x75, 0xbe, 0xb7, 0xa6, 0x60, 0x1b, 0x80, 0xe3, - 0x38, 0xe8, 0xf7, 0xfb, 0x89, 0x3d, 0x1a, 0x8d, - 0x00, 0x00, 0xf5, 0x7a, 0x7d, 0xc9, 0xdf, 0xa6, - 0xfa, 0xda, 0x08, 0x10, 0x86, 0x21, 0xca, 0xe5, - 0x72, 0x62, 0xe7, 0x72, 0xb9, 0xc4, 0x8e, 0x57, - 0x1c, 0xdb, 0xc3, 0xe1, 0x10, 0x95, 0x4a, 0x65, - 0x6d, 0xd0, 0x4d, 0x00, 0x99, 0xc1, 0x60, 0xa0, - 0xb5, 0x5a, 0x0d, 0x93, 0xc9, 0x64, 0xed, 0x03, - 0x8d, 0x46, 0x03, 0xbd, 0x5e, 0xef, 0x5c, 0x07, - 0x17, 0x6d, 0x85, 0x42, 0x61, 0xf9, 0xcf, 0xe8, - 0x3c, 0xca, 0x6e, 0xb7, 0x9b, 0xea, 0x27, 0x7a, - 0x7d, 0xf6, 0x81, 0x62, 0xb1, 0x78, 0x38, 0x00, - 0xcf, 0xf3, 0x0e, 0x12, 0x1c, 0x00, 0xfe, 0x02, - 0x61, 0xa9, 0xb2, 0x74, 0x08, 0x41, 0xaf, 0xf1, - 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, - 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x58, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x97, + 0x3b, 0x8f, 0x12, 0x51, 0x14, 0xc7, 0xff, 0xf8, + 0x88, 0x8e, 0x85, 0x1b, 0x5d, 0x2c, 0xcc, 0x46, + 0x2a, 0x1a, 0x0b, 0x09, 0xb5, 0xad, 0x8d, 0x1f, + 0x82, 0x4c, 0xa0, 0x80, 0x84, 0x90, 0x10, 0x7a, + 0x6a, 0x6b, 0x1a, 0x08, 0x32, 0x53, 0x40, 0x26, + 0xc4, 0xc6, 0xc4, 0xca, 0xc2, 0xc2, 0xaf, 0x60, + 0x43, 0x29, 0x95, 0x85, 0x46, 0x13, 0xd9, 0xd8, + 0x8d, 0xce, 0x3d, 0x0f, 0x8b, 0xcb, 0x0c, 0x8b, + 0xb0, 0x3c, 0x36, 0x3b, 0xcb, 0x16, 0xde, 0xe4, + 0xe6, 0xde, 0x33, 0x8f, 0x73, 0x7e, 0xf7, 0x7f, + 0xce, 0xdc, 0x9b, 0xc9, 0x0c, 0x06, 0x03, 0xc5, + 0x01, 0xdb, 0x2d, 0x00, 0xa8, 0xd5, 0x6a, 0x07, + 0x09, 0xee, 0x79, 0x9e, 0x05, 0x00, 0x80, 0xd9, + 0x6c, 0x76, 0xa5, 0xc1, 0x8f, 0x8f, 0x8f, 0x01, + 0x60, 0x01, 0xa0, 0x7a, 0x98, 0x4c, 0xfc, 0x07, + 0xd8, 0x0b, 0x60, 0xf6, 0xfe, 0x15, 0x44, 0x04, + 0xaa, 0x0c, 0x66, 0x86, 0x88, 0xed, 0xcc, 0x04, + 0x8e, 0x47, 0x26, 0x3c, 0xad, 0xbc, 0x4e, 0x07, + 0x40, 0x84, 0xf1, 0xe8, 0xf9, 0x0b, 0x40, 0x19, + 0x2a, 0x6a, 0x61, 0x84, 0x01, 0xe1, 0x64, 0xfe, + 0xf9, 0xe3, 0xbb, 0xbd, 0xd4, 0x4c, 0x00, 0x44, + 0x64, 0xeb, 0xc3, 0xcc, 0x04, 0x65, 0xc6, 0xef, + 0x5f, 0x5f, 0xa1, 0xf3, 0xd5, 0x2b, 0x33, 0x94, + 0x09, 0x22, 0x8c, 0xbb, 0xf7, 0x1f, 0x83, 0x28, + 0xda, 0xc9, 0xd7, 0x0a, 0xc0, 0x2e, 0xd4, 0x3c, + 0x0f, 0x24, 0x4c, 0x50, 0xb1, 0x30, 0xc2, 0x04, + 0x61, 0x86, 0x0a, 0x81, 0xd9, 0x80, 0x28, 0xba, + 0x98, 0x02, 0xbb, 0xbc, 0x44, 0x64, 0xec, 0x6a, + 0xc9, 0x58, 0x05, 0x98, 0xac, 0xcd, 0x0c, 0x65, + 0x03, 0x25, 0x03, 0x63, 0xd2, 0x04, 0xe0, 0x39, + 0x40, 0x32, 0x2e, 0x54, 0xc8, 0x68, 0x04, 0x61, + 0x4e, 0x5b, 0x81, 0x08, 0x42, 0x04, 0x31, 0x91, + 0xcd, 0x3f, 0x11, 0x44, 0x08, 0x0f, 0x8f, 0x4e, + 0x71, 0x72, 0xf2, 0x13, 0x5f, 0xbe, 0x1d, 0x59, + 0x95, 0xd2, 0x4c, 0x81, 0xcc, 0x53, 0x90, 0xc8, + 0x2f, 0x76, 0x3c, 0x9d, 0x39, 0x08, 0xff, 0xdc, + 0xbe, 0x02, 0x05, 0xd8, 0x80, 0x29, 0x5a, 0x4a, + 0xc1, 0x8f, 0xef, 0x77, 0xa0, 0x7c, 0x13, 0xf7, + 0xb2, 0x92, 0xae, 0x02, 0xc6, 0x44, 0x8b, 0x22, + 0x64, 0x33, 0x2f, 0xbe, 0x39, 0x88, 0xd8, 0x39, + 0x73, 0xaa, 0x29, 0x58, 0xd4, 0x80, 0x8a, 0xad, + 0xfe, 0x58, 0x05, 0x15, 0xfb, 0x69, 0xa6, 0x5c, + 0x03, 0x36, 0x05, 0xce, 0x83, 0x27, 0x50, 0x15, + 0x28, 0x13, 0x54, 0xc4, 0x76, 0x65, 0x08, 0xdb, + 0xed, 0xf8, 0xd2, 0x01, 0xa6, 0xd3, 0x29, 0xc2, + 0x30, 0x04, 0x51, 0x84, 0x4f, 0x1f, 0xde, 0x24, + 0x7b, 0x7e, 0x7c, 0x0e, 0x2c, 0xce, 0x04, 0x86, + 0xaa, 0xa0, 0xd3, 0xe9, 0x00, 0x00, 0x5a, 0xad, + 0xd6, 0xe5, 0x00, 0xe4, 0xf3, 0x79, 0x3b, 0x79, + 0xf6, 0x76, 0xfb, 0x92, 0x00, 0xbc, 0xdc, 0xc1, + 0xe7, 0x5e, 0x00, 0x69, 0xb6, 0xeb, 0x0d, 0x50, + 0x2a, 0x95, 0x92, 0x79, 0xb3, 0xd9, 0x84, 0xef, + 0xfb, 0xf0, 0x7d, 0x1f, 0xd5, 0x6a, 0x15, 0xbe, + 0xef, 0x2f, 0xdd, 0x1f, 0x8f, 0xc7, 0x5b, 0xed, + 0x75, 0xed, 0x46, 0x3c, 0x11, 0x91, 0x95, 0xee, + 0x38, 0x0e, 0x82, 0x20, 0x40, 0x36, 0x9b, 0x4d, + 0x00, 0xe3, 0xa3, 0xf6, 0xec, 0xfd, 0x20, 0x08, + 0xd6, 0xda, 0x41, 0x10, 0x24, 0xd7, 0xfe, 0xf5, + 0xbd, 0x02, 0xa0, 0xaa, 0x2b, 0xfd, 0xac, 0x32, + 0xeb, 0xc6, 0x30, 0x0c, 0xe1, 0xba, 0x2e, 0xda, + 0xed, 0xf6, 0x92, 0xed, 0xba, 0xee, 0x8a, 0x8f, + 0x75, 0xbe, 0xb7, 0xa6, 0x60, 0x1b, 0x80, 0xe3, + 0x38, 0xe8, 0xf7, 0xfb, 0x89, 0x3d, 0x1a, 0x8d, + 0x00, 0x00, 0xf5, 0x7a, 0x7d, 0xc9, 0xdf, 0xa6, + 0xfa, 0xda, 0x08, 0x10, 0x86, 0x21, 0xca, 0xe5, + 0x72, 0x62, 0xe7, 0x72, 0xb9, 0xc4, 0x8e, 0x57, + 0x1c, 0xdb, 0xc3, 0xe1, 0x10, 0x95, 0x4a, 0x65, + 0x6d, 0xd0, 0x4d, 0x00, 0x99, 0xc1, 0x60, 0xa0, + 0xb5, 0x5a, 0x0d, 0x93, 0xc9, 0x64, 0xed, 0x03, + 0x8d, 0x46, 0x03, 0xbd, 0x5e, 0xef, 0x5c, 0x07, + 0x17, 0x6d, 0x85, 0x42, 0x61, 0xf9, 0xcf, 0xe8, + 0x3c, 0xca, 0x6e, 0xb7, 0x9b, 0xea, 0x27, 0x7a, + 0x7d, 0xf6, 0x81, 0x62, 0xb1, 0x78, 0x38, 0x00, + 0xcf, 0xf3, 0x0e, 0x12, 0x1c, 0x00, 0xfe, 0x02, + 0x61, 0xa9, 0xb2, 0x74, 0x08, 0x41, 0xaf, 0xf1, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, + 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* door_quest_small.png - 552 bytes */ unsigned char door_quest_small_png[552] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x84, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, - 0xcd, 0x6a, 0x93, 0x51, 0x10, 0x86, 0x9f, 0xb4, - 0x69, 0x68, 0x5a, 0x28, 0x6d, 0x25, 0xa0, 0xa5, - 0x14, 0xdc, 0x8b, 0xe0, 0x52, 0x7a, 0x05, 0xae, - 0xb3, 0x71, 0x21, 0x78, 0x13, 0xde, 0x4c, 0x96, - 0x5e, 0x40, 0xb6, 0x82, 0x3b, 0x57, 0x42, 0x70, - 0xa3, 0x78, 0x05, 0x1a, 0x5a, 0x5a, 0x68, 0xa9, - 0x95, 0xa4, 0x5f, 0xce, 0x99, 0x79, 0xe7, 0xb8, - 0xf8, 0x92, 0xe8, 0x87, 0x21, 0x82, 0x9d, 0xcd, - 0x81, 0xc3, 0xbc, 0xcf, 0xbc, 0xf3, 0xd3, 0x1a, - 0x0c, 0x06, 0x85, 0x7b, 0x44, 0x1b, 0xa0, 0xdf, - 0xef, 0xff, 0x97, 0x78, 0x38, 0x1c, 0xd6, 0x80, - 0x88, 0xb8, 0x9f, 0x83, 0x05, 0xc0, 0x6f, 0xce, - 0xb9, 0xfd, 0xf8, 0x96, 0x56, 0x7b, 0x03, 0x49, - 0x48, 0x22, 0x42, 0x48, 0x86, 0xc2, 0x49, 0x77, - 0x13, 0x4e, 0x5e, 0xbc, 0xa1, 0xdb, 0x7b, 0xdc, - 0x04, 0x48, 0x02, 0xc0, 0x52, 0xc5, 0xd6, 0xc1, - 0x21, 0xfb, 0x4f, 0x9e, 0xe1, 0x93, 0x5b, 0x14, - 0x85, 0x12, 0x02, 0x19, 0x9b, 0xdb, 0xbb, 0x8c, - 0x3f, 0x7d, 0x20, 0x57, 0x53, 0x3a, 0xf3, 0xfc, - 0xbf, 0x1c, 0x84, 0x44, 0x28, 0xb0, 0xe9, 0x0f, - 0xaa, 0xeb, 0x31, 0xa5, 0x14, 0x42, 0x42, 0x36, - 0x63, 0x67, 0xff, 0x11, 0xf2, 0x85, 0xab, 0x58, - 0x0d, 0x50, 0x08, 0x97, 0xd5, 0xa0, 0x08, 0x4a, - 0x04, 0x45, 0x4e, 0x71, 0x27, 0x3c, 0x93, 0x6d, - 0xf6, 0x0f, 0x80, 0x84, 0x2c, 0x53, 0x2c, 0x23, - 0x4b, 0x73, 0xc0, 0xef, 0x3f, 0xb7, 0x8c, 0xa2, - 0x09, 0xd8, 0x58, 0x00, 0x22, 0xa2, 0x76, 0xe0, - 0x99, 0x70, 0x23, 0x2c, 0xa3, 0x6c, 0x84, 0xcd, - 0x38, 0x3e, 0x3a, 0xe3, 0xf8, 0xe8, 0x0c, 0x4b, - 0x09, 0x57, 0x2c, 0xf3, 0x57, 0x3a, 0xf0, 0xa5, - 0x38, 0x51, 0xa2, 0x00, 0x99, 0xe9, 0xcf, 0x16, - 0x49, 0x5d, 0xcc, 0x9d, 0x90, 0xaf, 0x6f, 0xc1, - 0x2d, 0x11, 0xca, 0xc8, 0x13, 0x45, 0x75, 0x0b, - 0xe3, 0x9b, 0x0e, 0x7b, 0x0f, 0x36, 0xa1, 0x64, - 0xf4, 0x47, 0xf5, 0x15, 0x43, 0x74, 0xdc, 0xeb, - 0xea, 0x5e, 0x4d, 0x28, 0x85, 0xf9, 0x10, 0x2b, - 0x88, 0x0a, 0xb9, 0x21, 0xad, 0x00, 0x2c, 0xee, - 0x40, 0x2e, 0x2c, 0xdd, 0xd1, 0xee, 0xec, 0xd2, - 0x3d, 0x38, 0xa9, 0xc5, 0x21, 0x8a, 0x9c, 0xad, - 0x9d, 0x3d, 0x2c, 0xcf, 0x88, 0x68, 0x2d, 0xf3, - 0x1b, 0x0e, 0xce, 0x2f, 0xaf, 0xa8, 0x2e, 0x2e, - 0xc9, 0xdf, 0xbe, 0x72, 0x7d, 0xf1, 0xbd, 0xbe, - 0x3e, 0x39, 0x92, 0x53, 0x8a, 0x23, 0x09, 0x9b, - 0x5c, 0xf1, 0xe5, 0xfd, 0x3b, 0xd2, 0xf6, 0x67, - 0x5e, 0xbf, 0x7a, 0xd9, 0x04, 0x3c, 0xec, 0x1d, - 0x42, 0xef, 0x14, 0x9e, 0x9e, 0xb2, 0x2e, 0x9e, - 0xcf, 0xdf, 0xc6, 0x16, 0x46, 0xa3, 0xd1, 0x5a, - 0xd1, 0xba, 0xf8, 0x05, 0x29, 0xdb, 0x71, 0xff, - 0xd6, 0x47, 0x96, 0x83, 0x00, 0x00, 0x00, 0x00, - 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x84, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, + 0xcd, 0x6a, 0x93, 0x51, 0x10, 0x86, 0x9f, 0xb4, + 0x69, 0x68, 0x5a, 0x28, 0x6d, 0x25, 0xa0, 0xa5, + 0x14, 0xdc, 0x8b, 0xe0, 0x52, 0x7a, 0x05, 0xae, + 0xb3, 0x71, 0x21, 0x78, 0x13, 0xde, 0x4c, 0x96, + 0x5e, 0x40, 0xb6, 0x82, 0x3b, 0x57, 0x42, 0x70, + 0xa3, 0x78, 0x05, 0x1a, 0x5a, 0x5a, 0x68, 0xa9, + 0x95, 0xa4, 0x5f, 0xce, 0x99, 0x79, 0xe7, 0xb8, + 0xf8, 0x92, 0xe8, 0x87, 0x21, 0x82, 0x9d, 0xcd, + 0x81, 0xc3, 0xbc, 0xcf, 0xbc, 0xf3, 0xd3, 0x1a, + 0x0c, 0x06, 0x85, 0x7b, 0x44, 0x1b, 0xa0, 0xdf, + 0xef, 0xff, 0x97, 0x78, 0x38, 0x1c, 0xd6, 0x80, + 0x88, 0xb8, 0x9f, 0x83, 0x05, 0xc0, 0x6f, 0xce, + 0xb9, 0xfd, 0xf8, 0x96, 0x56, 0x7b, 0x03, 0x49, + 0x48, 0x22, 0x42, 0x48, 0x86, 0xc2, 0x49, 0x77, + 0x13, 0x4e, 0x5e, 0xbc, 0xa1, 0xdb, 0x7b, 0xdc, + 0x04, 0x48, 0x02, 0xc0, 0x52, 0xc5, 0xd6, 0xc1, + 0x21, 0xfb, 0x4f, 0x9e, 0xe1, 0x93, 0x5b, 0x14, + 0x85, 0x12, 0x02, 0x19, 0x9b, 0xdb, 0xbb, 0x8c, + 0x3f, 0x7d, 0x20, 0x57, 0x53, 0x3a, 0xf3, 0xfc, + 0xbf, 0x1c, 0x84, 0x44, 0x28, 0xb0, 0xe9, 0x0f, + 0xaa, 0xeb, 0x31, 0xa5, 0x14, 0x42, 0x42, 0x36, + 0x63, 0x67, 0xff, 0x11, 0xf2, 0x85, 0xab, 0x58, + 0x0d, 0x50, 0x08, 0x97, 0xd5, 0xa0, 0x08, 0x4a, + 0x04, 0x45, 0x4e, 0x71, 0x27, 0x3c, 0x93, 0x6d, + 0xf6, 0x0f, 0x80, 0x84, 0x2c, 0x53, 0x2c, 0x23, + 0x4b, 0x73, 0xc0, 0xef, 0x3f, 0xb7, 0x8c, 0xa2, + 0x09, 0xd8, 0x58, 0x00, 0x22, 0xa2, 0x76, 0xe0, + 0x99, 0x70, 0x23, 0x2c, 0xa3, 0x6c, 0x84, 0xcd, + 0x38, 0x3e, 0x3a, 0xe3, 0xf8, 0xe8, 0x0c, 0x4b, + 0x09, 0x57, 0x2c, 0xf3, 0x57, 0x3a, 0xf0, 0xa5, + 0x38, 0x51, 0xa2, 0x00, 0x99, 0xe9, 0xcf, 0x16, + 0x49, 0x5d, 0xcc, 0x9d, 0x90, 0xaf, 0x6f, 0xc1, + 0x2d, 0x11, 0xca, 0xc8, 0x13, 0x45, 0x75, 0x0b, + 0xe3, 0x9b, 0x0e, 0x7b, 0x0f, 0x36, 0xa1, 0x64, + 0xf4, 0x47, 0xf5, 0x15, 0x43, 0x74, 0xdc, 0xeb, + 0xea, 0x5e, 0x4d, 0x28, 0x85, 0xf9, 0x10, 0x2b, + 0x88, 0x0a, 0xb9, 0x21, 0xad, 0x00, 0x2c, 0xee, + 0x40, 0x2e, 0x2c, 0xdd, 0xd1, 0xee, 0xec, 0xd2, + 0x3d, 0x38, 0xa9, 0xc5, 0x21, 0x8a, 0x9c, 0xad, + 0x9d, 0x3d, 0x2c, 0xcf, 0x88, 0x68, 0x2d, 0xf3, + 0x1b, 0x0e, 0xce, 0x2f, 0xaf, 0xa8, 0x2e, 0x2e, + 0xc9, 0xdf, 0xbe, 0x72, 0x7d, 0xf1, 0xbd, 0xbe, + 0x3e, 0x39, 0x92, 0x53, 0x8a, 0x23, 0x09, 0x9b, + 0x5c, 0xf1, 0xe5, 0xfd, 0x3b, 0xd2, 0xf6, 0x67, + 0x5e, 0xbf, 0x7a, 0xd9, 0x04, 0x3c, 0xec, 0x1d, + 0x42, 0xef, 0x14, 0x9e, 0x9e, 0xb2, 0x2e, 0x9e, + 0xcf, 0xdf, 0xc6, 0x16, 0x46, 0xa3, 0xd1, 0x5a, + 0xd1, 0xba, 0xf8, 0x05, 0x29, 0xdb, 0x71, 0xff, + 0xd6, 0x47, 0x96, 0x83, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; /* End Of File */ /* eraser.png - 878 bytes */ unsigned char eraser_png[878] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0xca, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xd5, 0x97, - 0xcf, 0x4b, 0xdb, 0x60, 0x18, 0xc7, 0x3f, 0x19, - 0x43, 0x2d, 0x78, 0xd8, 0x70, 0x58, 0x17, 0x41, - 0x99, 0x97, 0xc9, 0x0e, 0xd2, 0xa3, 0x82, 0x07, - 0x41, 0x50, 0xfa, 0x0f, 0x78, 0x18, 0xb6, 0x56, - 0x06, 0x75, 0xb2, 0x8b, 0xb0, 0x93, 0xd6, 0xe3, - 0xa6, 0x07, 0x65, 0x88, 0x20, 0x2e, 0xbd, 0x58, - 0x41, 0x3c, 0xf8, 0x1f, 0x78, 0x28, 0x78, 0x10, - 0xbc, 0x78, 0x50, 0xd9, 0xa1, 0x6a, 0x1b, 0x69, - 0xa1, 0x9d, 0x5a, 0xd4, 0x29, 0xb2, 0xa8, 0x31, - 0xe9, 0x0e, 0x35, 0xe9, 0xaa, 0xfd, 0x61, 0xb6, - 0x6a, 0xb7, 0x2f, 0x84, 0xbc, 0x4f, 0x9e, 0x1f, - 0xdf, 0x6f, 0x9e, 0xf7, 0xcd, 0x9b, 0x44, 0x90, - 0x24, 0x29, 0x45, 0x19, 0xf1, 0x14, 0xc0, 0xeb, - 0xf5, 0x96, 0x85, 0xdc, 0xef, 0xf7, 0xa7, 0x05, - 0x00, 0x1c, 0x1d, 0x1d, 0x3d, 0x2a, 0x79, 0x4d, - 0x4d, 0x0d, 0x40, 0x46, 0x40, 0x2a, 0x55, 0x9e, - 0x99, 0xf8, 0x3f, 0x05, 0xd4, 0xd6, 0xd6, 0xe6, - 0xf5, 0x1d, 0x1e, 0x1e, 0x3e, 0xac, 0x00, 0xbb, - 0xdd, 0x8e, 0xaf, 0xbb, 0x9b, 0x86, 0xae, 0x2e, - 0xf3, 0x9a, 0x1a, 0x8d, 0x02, 0xf0, 0x7d, 0x7b, - 0x9b, 0xcf, 0xcb, 0xcb, 0x1c, 0x1c, 0x1c, 0x3c, - 0x8c, 0x80, 0xba, 0xba, 0x3a, 0x26, 0x5d, 0x2e, - 0x3e, 0x4d, 0x4f, 0x23, 0x9c, 0x9e, 0xa6, 0xf3, - 0x22, 0x11, 0x74, 0x9b, 0x2d, 0x1d, 0xd0, 0xdc, - 0xcc, 0x98, 0xc3, 0xc1, 0xc8, 0xc6, 0x06, 0xfb, - 0xfb, 0xfb, 0xd6, 0x04, 0xe8, 0xba, 0x5e, 0x30, - 0x50, 0x14, 0x45, 0x26, 0x5d, 0x2e, 0x3e, 0x8e, - 0x8e, 0x72, 0x32, 0x37, 0x97, 0xce, 0xd1, 0x34, - 0x00, 0x34, 0x55, 0x4d, 0xdb, 0xaa, 0xca, 0x88, - 0xd3, 0x69, 0x8a, 0x48, 0x24, 0x12, 0x45, 0x05, - 0x3c, 0x31, 0x06, 0xa9, 0x54, 0x2a, 0xef, 0x21, - 0x8a, 0x22, 0xef, 0x3b, 0x3b, 0x8b, 0x92, 0x03, - 0xc4, 0x92, 0x49, 0x46, 0x9c, 0x4e, 0xde, 0xd6, - 0xd7, 0x23, 0x8a, 0x62, 0xde, 0x9a, 0x96, 0x04, - 0x18, 0xb8, 0x08, 0x87, 0xd1, 0x35, 0x0d, 0x5d, - 0xd3, 0x78, 0x31, 0x31, 0x61, 0x92, 0xff, 0x58, - 0x5f, 0xe7, 0xe5, 0xcc, 0x0c, 0xea, 0xe5, 0xa5, - 0x19, 0xfb, 0xbc, 0xa1, 0xa1, 0x60, 0x5d, 0x03, - 0x96, 0x17, 0xa1, 0x41, 0x7a, 0x30, 0x34, 0x84, - 0x7d, 0x6a, 0x8a, 0xed, 0xf6, 0x76, 0x5e, 0xaf, - 0xae, 0xc2, 0xf0, 0xb0, 0x19, 0x93, 0x3a, 0x3b, - 0xcb, 0x8c, 0x8b, 0xd4, 0xb5, 0x2c, 0xc0, 0x68, - 0x35, 0x90, 0x45, 0x1e, 0x4b, 0x26, 0x33, 0x02, - 0x2b, 0x2b, 0x39, 0x89, 0xc5, 0xee, 0x55, 0xd7, - 0xd2, 0x14, 0x18, 0x50, 0x2f, 0x2f, 0x39, 0xdb, - 0xdc, 0xcc, 0xdc, 0xf9, 0xf8, 0x38, 0x9a, 0xaa, - 0x9a, 0xdd, 0xf9, 0x1d, 0x25, 0x5d, 0x03, 0x06, - 0x39, 0x60, 0x92, 0xef, 0x25, 0x12, 0xec, 0xf5, - 0xf5, 0xf1, 0x6a, 0x7e, 0x3e, 0xe7, 0x1d, 0x96, - 0x74, 0x0d, 0x54, 0x44, 0xa3, 0xfc, 0xbc, 0x99, - 0xdf, 0x50, 0x4f, 0x4f, 0x96, 0x2f, 0xd4, 0xd3, - 0x83, 0x20, 0x08, 0x5c, 0x6b, 0x1a, 0x54, 0x57, - 0x67, 0x09, 0x28, 0x84, 0x7b, 0x75, 0x40, 0x96, - 0x65, 0xbe, 0x06, 0x83, 0xbc, 0x5b, 0x5a, 0xa2, - 0xb6, 0xa9, 0x09, 0x41, 0x10, 0xd0, 0x74, 0xfd, - 0xce, 0x71, 0xad, 0x69, 0xbc, 0xb1, 0xdb, 0xf1, - 0x05, 0x83, 0x2c, 0xc6, 0xe3, 0xc8, 0xb2, 0x5c, - 0xba, 0x0e, 0x44, 0x22, 0x11, 0x02, 0x2b, 0x2b, - 0x78, 0x3a, 0x3a, 0xf8, 0xd2, 0xda, 0xca, 0xb3, - 0xe3, 0x63, 0xce, 0xaf, 0xae, 0xb2, 0x62, 0xaa, - 0x2b, 0x2a, 0xf0, 0x05, 0x83, 0x8c, 0x85, 0x42, - 0xe8, 0xba, 0x7e, 0xaf, 0xae, 0x5a, 0x9a, 0x82, - 0x70, 0x38, 0x4c, 0x60, 0x65, 0x85, 0x0f, 0x6d, - 0x6d, 0xd4, 0x2b, 0x0a, 0xe7, 0x17, 0x17, 0x19, - 0xf2, 0xaa, 0x2a, 0xbe, 0x25, 0x93, 0x2c, 0xc6, - 0xe3, 0xe8, 0xba, 0x8e, 0x2c, 0xcb, 0x45, 0xeb, - 0x59, 0x16, 0x00, 0xb0, 0xbb, 0xbb, 0xcb, 0xcc, - 0xda, 0x5a, 0x41, 0xbf, 0x15, 0xfc, 0xd1, 0xeb, - 0x78, 0x67, 0x67, 0xc7, 0x12, 0x49, 0xc9, 0x05, - 0x94, 0x12, 0x05, 0x05, 0xf4, 0xf6, 0xf6, 0x9a, - 0xe3, 0x85, 0x85, 0x85, 0xbf, 0xb6, 0x0b, 0x0a, - 0xc8, 0xf5, 0x3a, 0xb6, 0xd9, 0x6c, 0x48, 0x92, - 0x64, 0xfa, 0x0d, 0x7b, 0x60, 0x60, 0xa0, 0xa0, - 0x7d, 0x3b, 0x3e, 0x5f, 0x7d, 0x28, 0xb2, 0x0f, - 0x28, 0x8a, 0x82, 0xdb, 0xed, 0xc6, 0xe7, 0xf3, - 0x65, 0xd9, 0x8d, 0x8d, 0x8d, 0x59, 0xb6, 0xa2, - 0x28, 0x59, 0xb6, 0xdb, 0xed, 0xce, 0x99, 0x6f, - 0x79, 0x1f, 0xb0, 0xd9, 0x6c, 0xcc, 0xce, 0xce, - 0x9a, 0x7e, 0xc3, 0x1e, 0x1c, 0x1c, 0xcc, 0x69, - 0x07, 0x02, 0x01, 0x80, 0x3b, 0xfe, 0x7c, 0xf5, - 0x8b, 0x0a, 0x50, 0x14, 0x05, 0x8f, 0xc7, 0x03, - 0xc0, 0xdc, 0xcd, 0x87, 0x88, 0x11, 0x97, 0xeb, - 0xdc, 0xdf, 0xdf, 0x6f, 0xe6, 0x1a, 0x1d, 0xb8, - 0x9d, 0x7f, 0x1b, 0x82, 0x24, 0x49, 0x29, 0xaf, - 0xd7, 0xcb, 0xd6, 0xd6, 0x56, 0xce, 0x80, 0x87, - 0x42, 0x4b, 0x4b, 0x4b, 0xf6, 0x9f, 0xd1, 0x3f, - 0xf9, 0x18, 0x3e, 0xaa, 0x00, 0x87, 0xc3, 0x51, - 0x3e, 0x01, 0x7e, 0xbf, 0xbf, 0x2c, 0xe4, 0x00, - 0xbf, 0x00, 0xb6, 0xaf, 0xad, 0xbd, 0xae, 0xa2, - 0x8d, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, - 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0xca, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xd5, 0x97, + 0xcf, 0x4b, 0xdb, 0x60, 0x18, 0xc7, 0x3f, 0x19, + 0x43, 0x2d, 0x78, 0xd8, 0x70, 0x58, 0x17, 0x41, + 0x99, 0x97, 0xc9, 0x0e, 0xd2, 0xa3, 0x82, 0x07, + 0x41, 0x50, 0xfa, 0x0f, 0x78, 0x18, 0xb6, 0x56, + 0x06, 0x75, 0xb2, 0x8b, 0xb0, 0x93, 0xd6, 0xe3, + 0xa6, 0x07, 0x65, 0x88, 0x20, 0x2e, 0xbd, 0x58, + 0x41, 0x3c, 0xf8, 0x1f, 0x78, 0x28, 0x78, 0x10, + 0xbc, 0x78, 0x50, 0xd9, 0xa1, 0x6a, 0x1b, 0x69, + 0xa1, 0x9d, 0x5a, 0xd4, 0x29, 0xb2, 0xa8, 0x31, + 0xe9, 0x0e, 0x35, 0xe9, 0xaa, 0xfd, 0x61, 0xb6, + 0x6a, 0xb7, 0x2f, 0x84, 0xbc, 0x4f, 0x9e, 0x1f, + 0xdf, 0x6f, 0x9e, 0xf7, 0xcd, 0x9b, 0x44, 0x90, + 0x24, 0x29, 0x45, 0x19, 0xf1, 0x14, 0xc0, 0xeb, + 0xf5, 0x96, 0x85, 0xdc, 0xef, 0xf7, 0xa7, 0x05, + 0x00, 0x1c, 0x1d, 0x1d, 0x3d, 0x2a, 0x79, 0x4d, + 0x4d, 0x0d, 0x40, 0x46, 0x40, 0x2a, 0x55, 0x9e, + 0x99, 0xf8, 0x3f, 0x05, 0xd4, 0xd6, 0xd6, 0xe6, + 0xf5, 0x1d, 0x1e, 0x1e, 0x3e, 0xac, 0x00, 0xbb, + 0xdd, 0x8e, 0xaf, 0xbb, 0x9b, 0x86, 0xae, 0x2e, + 0xf3, 0x9a, 0x1a, 0x8d, 0x02, 0xf0, 0x7d, 0x7b, + 0x9b, 0xcf, 0xcb, 0xcb, 0x1c, 0x1c, 0x1c, 0x3c, + 0x8c, 0x80, 0xba, 0xba, 0x3a, 0x26, 0x5d, 0x2e, + 0x3e, 0x4d, 0x4f, 0x23, 0x9c, 0x9e, 0xa6, 0xf3, + 0x22, 0x11, 0x74, 0x9b, 0x2d, 0x1d, 0xd0, 0xdc, + 0xcc, 0x98, 0xc3, 0xc1, 0xc8, 0xc6, 0x06, 0xfb, + 0xfb, 0xfb, 0xd6, 0x04, 0xe8, 0xba, 0x5e, 0x30, + 0x50, 0x14, 0x45, 0x26, 0x5d, 0x2e, 0x3e, 0x8e, + 0x8e, 0x72, 0x32, 0x37, 0x97, 0xce, 0xd1, 0x34, + 0x00, 0x34, 0x55, 0x4d, 0xdb, 0xaa, 0xca, 0x88, + 0xd3, 0x69, 0x8a, 0x48, 0x24, 0x12, 0x45, 0x05, + 0x3c, 0x31, 0x06, 0xa9, 0x54, 0x2a, 0xef, 0x21, + 0x8a, 0x22, 0xef, 0x3b, 0x3b, 0x8b, 0x92, 0x03, + 0xc4, 0x92, 0x49, 0x46, 0x9c, 0x4e, 0xde, 0xd6, + 0xd7, 0x23, 0x8a, 0x62, 0xde, 0x9a, 0x96, 0x04, + 0x18, 0xb8, 0x08, 0x87, 0xd1, 0x35, 0x0d, 0x5d, + 0xd3, 0x78, 0x31, 0x31, 0x61, 0x92, 0xff, 0x58, + 0x5f, 0xe7, 0xe5, 0xcc, 0x0c, 0xea, 0xe5, 0xa5, + 0x19, 0xfb, 0xbc, 0xa1, 0xa1, 0x60, 0x5d, 0x03, + 0x96, 0x17, 0xa1, 0x41, 0x7a, 0x30, 0x34, 0x84, + 0x7d, 0x6a, 0x8a, 0xed, 0xf6, 0x76, 0x5e, 0xaf, + 0xae, 0xc2, 0xf0, 0xb0, 0x19, 0x93, 0x3a, 0x3b, + 0xcb, 0x8c, 0x8b, 0xd4, 0xb5, 0x2c, 0xc0, 0x68, + 0x35, 0x90, 0x45, 0x1e, 0x4b, 0x26, 0x33, 0x02, + 0x2b, 0x2b, 0x39, 0x89, 0xc5, 0xee, 0x55, 0xd7, + 0xd2, 0x14, 0x18, 0x50, 0x2f, 0x2f, 0x39, 0xdb, + 0xdc, 0xcc, 0xdc, 0xf9, 0xf8, 0x38, 0x9a, 0xaa, + 0x9a, 0xdd, 0xf9, 0x1d, 0x25, 0x5d, 0x03, 0x06, + 0x39, 0x60, 0x92, 0xef, 0x25, 0x12, 0xec, 0xf5, + 0xf5, 0xf1, 0x6a, 0x7e, 0x3e, 0xe7, 0x1d, 0x96, + 0x74, 0x0d, 0x54, 0x44, 0xa3, 0xfc, 0xbc, 0x99, + 0xdf, 0x50, 0x4f, 0x4f, 0x96, 0x2f, 0xd4, 0xd3, + 0x83, 0x20, 0x08, 0x5c, 0x6b, 0x1a, 0x54, 0x57, + 0x67, 0x09, 0x28, 0x84, 0x7b, 0x75, 0x40, 0x96, + 0x65, 0xbe, 0x06, 0x83, 0xbc, 0x5b, 0x5a, 0xa2, + 0xb6, 0xa9, 0x09, 0x41, 0x10, 0xd0, 0x74, 0xfd, + 0xce, 0x71, 0xad, 0x69, 0xbc, 0xb1, 0xdb, 0xf1, + 0x05, 0x83, 0x2c, 0xc6, 0xe3, 0xc8, 0xb2, 0x5c, + 0xba, 0x0e, 0x44, 0x22, 0x11, 0x02, 0x2b, 0x2b, + 0x78, 0x3a, 0x3a, 0xf8, 0xd2, 0xda, 0xca, 0xb3, + 0xe3, 0x63, 0xce, 0xaf, 0xae, 0xb2, 0x62, 0xaa, + 0x2b, 0x2a, 0xf0, 0x05, 0x83, 0x8c, 0x85, 0x42, + 0xe8, 0xba, 0x7e, 0xaf, 0xae, 0x5a, 0x9a, 0x82, + 0x70, 0x38, 0x4c, 0x60, 0x65, 0x85, 0x0f, 0x6d, + 0x6d, 0xd4, 0x2b, 0x0a, 0xe7, 0x17, 0x17, 0x19, + 0xf2, 0xaa, 0x2a, 0xbe, 0x25, 0x93, 0x2c, 0xc6, + 0xe3, 0xe8, 0xba, 0x8e, 0x2c, 0xcb, 0x45, 0xeb, + 0x59, 0x16, 0x00, 0xb0, 0xbb, 0xbb, 0xcb, 0xcc, + 0xda, 0x5a, 0x41, 0xbf, 0x15, 0xfc, 0xd1, 0xeb, + 0x78, 0x67, 0x67, 0xc7, 0x12, 0x49, 0xc9, 0x05, + 0x94, 0x12, 0x05, 0x05, 0xf4, 0xf6, 0xf6, 0x9a, + 0xe3, 0x85, 0x85, 0x85, 0xbf, 0xb6, 0x0b, 0x0a, + 0xc8, 0xf5, 0x3a, 0xb6, 0xd9, 0x6c, 0x48, 0x92, + 0x64, 0xfa, 0x0d, 0x7b, 0x60, 0x60, 0xa0, 0xa0, + 0x7d, 0x3b, 0x3e, 0x5f, 0x7d, 0x28, 0xb2, 0x0f, + 0x28, 0x8a, 0x82, 0xdb, 0xed, 0xc6, 0xe7, 0xf3, + 0x65, 0xd9, 0x8d, 0x8d, 0x8d, 0x59, 0xb6, 0xa2, + 0x28, 0x59, 0xb6, 0xdb, 0xed, 0xce, 0x99, 0x6f, + 0x79, 0x1f, 0xb0, 0xd9, 0x6c, 0xcc, 0xce, 0xce, + 0x9a, 0x7e, 0xc3, 0x1e, 0x1c, 0x1c, 0xcc, 0x69, + 0x07, 0x02, 0x01, 0x80, 0x3b, 0xfe, 0x7c, 0xf5, + 0x8b, 0x0a, 0x50, 0x14, 0x05, 0x8f, 0xc7, 0x03, + 0xc0, 0xdc, 0xcd, 0x87, 0x88, 0x11, 0x97, 0xeb, + 0xdc, 0xdf, 0xdf, 0x6f, 0xe6, 0x1a, 0x1d, 0xb8, + 0x9d, 0x7f, 0x1b, 0x82, 0x24, 0x49, 0x29, 0xaf, + 0xd7, 0xcb, 0xd6, 0xd6, 0x56, 0xce, 0x80, 0x87, + 0x42, 0x4b, 0x4b, 0x4b, 0xf6, 0x9f, 0xd1, 0x3f, + 0xf9, 0x18, 0x3e, 0xaa, 0x00, 0x87, 0xc3, 0x51, + 0x3e, 0x01, 0x7e, 0xbf, 0xbf, 0x2c, 0xe4, 0x00, + 0xbf, 0x00, 0xb6, 0xaf, 0xad, 0xbd, 0xae, 0xa2, + 0x8d, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* eraser_small.png - 667 bytes */ unsigned char eraser_small_png[667] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xf7, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, - 0xbd, 0x4b, 0x5b, 0x51, 0x1c, 0x86, 0x9f, 0x73, - 0xee, 0xcd, 0x47, 0x6d, 0x88, 0xc1, 0x1a, 0x8b, - 0x34, 0x10, 0x42, 0x07, 0xf7, 0x2e, 0x8e, 0x15, - 0x4a, 0xbb, 0x94, 0x2e, 0x95, 0xee, 0x92, 0x49, - 0x70, 0x76, 0x09, 0x88, 0xe0, 0xe0, 0x22, 0xd9, - 0x5c, 0x9c, 0x82, 0x7f, 0xc0, 0x85, 0x0e, 0x52, - 0x1c, 0x6b, 0xb6, 0x80, 0x48, 0x5d, 0x75, 0xb0, - 0x83, 0x82, 0x26, 0x45, 0x82, 0xb7, 0xf7, 0xde, - 0x24, 0xe7, 0xab, 0x83, 0x69, 0xea, 0x17, 0x45, - 0xda, 0x77, 0x3d, 0xfc, 0x9e, 0xf3, 0xbc, 0xf0, - 0x8a, 0xad, 0xad, 0x2d, 0xc7, 0x7f, 0xc4, 0x07, - 0x98, 0x9f, 0x9f, 0xff, 0xa7, 0xe3, 0x20, 0x08, - 0xae, 0x01, 0xd6, 0xda, 0x5b, 0x0f, 0xd2, 0x5a, - 0x34, 0x20, 0xd3, 0x69, 0xb0, 0x16, 0xa3, 0x14, - 0xa9, 0x74, 0x1a, 0x6b, 0xcc, 0xc3, 0x06, 0x37, - 0x01, 0x3a, 0x49, 0x68, 0x05, 0x01, 0x7e, 0xb1, - 0x48, 0xc6, 0xf7, 0x31, 0x27, 0x27, 0xf4, 0x2f, - 0x2f, 0xb1, 0x9e, 0xc7, 0xec, 0xd2, 0x12, 0xa9, - 0x6c, 0xf6, 0x3e, 0xc0, 0x0c, 0xc9, 0xae, 0xd7, - 0xe3, 0xdb, 0xee, 0x2e, 0xef, 0xca, 0x65, 0x72, - 0xc6, 0x40, 0x18, 0xe2, 0xa4, 0x84, 0xa9, 0x29, - 0xae, 0xce, 0xce, 0xd8, 0x5b, 0x59, 0xe1, 0xd5, - 0xda, 0xda, 0xb5, 0xd9, 0x5d, 0x03, 0xab, 0x35, - 0xcd, 0x20, 0xe0, 0x43, 0xa5, 0x02, 0xfb, 0xfb, - 0x74, 0xe2, 0x18, 0xab, 0x14, 0xc6, 0x39, 0x9c, - 0x94, 0x64, 0xa4, 0xe4, 0x75, 0x2a, 0x45, 0x50, - 0xab, 0xf1, 0x66, 0x7d, 0x1d, 0xcf, 0xf7, 0xaf, - 0xeb, 0x8e, 0x2a, 0x38, 0x47, 0xfb, 0xf8, 0x98, - 0xf1, 0x38, 0x26, 0x4e, 0x12, 0xc6, 0x17, 0x17, - 0x91, 0x85, 0x02, 0xbd, 0x4e, 0x87, 0xc9, 0x85, - 0x05, 0x42, 0xa5, 0x18, 0x9f, 0x9c, 0x24, 0x69, - 0xb7, 0x11, 0x9e, 0x37, 0xaa, 0x3d, 0x32, 0x90, - 0x42, 0xe0, 0xfb, 0x3e, 0xb6, 0xdf, 0xc7, 0x44, - 0x11, 0xdd, 0xed, 0x6d, 0xdc, 0xcc, 0x0c, 0xcf, - 0xe7, 0xe6, 0x70, 0x3b, 0x3b, 0xd0, 0xeb, 0x41, - 0x14, 0xe1, 0x06, 0x03, 0x9c, 0x73, 0xb8, 0x21, - 0xe0, 0x8f, 0xc1, 0x30, 0xc2, 0x39, 0x54, 0x92, - 0x10, 0x1e, 0x1d, 0x91, 0x2f, 0x95, 0x78, 0x3a, - 0x3d, 0xcd, 0x45, 0xa7, 0x83, 0xd6, 0x1a, 0x84, - 0x20, 0xe9, 0x76, 0x31, 0x4a, 0x8d, 0x6e, 0x6e, - 0x01, 0xac, 0x52, 0x08, 0x6b, 0x51, 0x42, 0x50, - 0xaa, 0xd5, 0xa0, 0xd9, 0xe4, 0xfb, 0xe6, 0x26, - 0xcf, 0xaa, 0x55, 0x5c, 0x2a, 0x05, 0x52, 0x62, - 0x95, 0x02, 0x21, 0xee, 0x57, 0xb0, 0x42, 0x50, - 0x28, 0x16, 0x39, 0x3d, 0x3c, 0x44, 0x0e, 0x06, - 0x1c, 0xd7, 0xeb, 0xd0, 0xef, 0xe3, 0x9c, 0xe3, - 0x67, 0xbd, 0xce, 0x13, 0xcf, 0xe3, 0xc7, 0xe9, - 0x29, 0xb9, 0x4a, 0x85, 0x9b, 0x9f, 0x8e, 0x0c, - 0x7a, 0x49, 0xc2, 0x6c, 0xb5, 0xca, 0x67, 0x21, - 0xb0, 0x99, 0x0c, 0x2f, 0x73, 0x39, 0x5e, 0xe4, - 0xf3, 0x94, 0x0a, 0x05, 0xca, 0x63, 0x63, 0xe4, - 0xe3, 0x98, 0x2f, 0x51, 0xc4, 0xa7, 0x46, 0x03, - 0xad, 0xf5, 0x6d, 0x83, 0xdf, 0x3b, 0xc0, 0x18, - 0xde, 0x2e, 0x2f, 0xf3, 0x75, 0x63, 0x83, 0xec, - 0xc1, 0x01, 0x7d, 0x6b, 0x11, 0x42, 0x20, 0x8d, - 0x21, 0x9c, 0x98, 0xe0, 0x63, 0xa3, 0x81, 0x90, - 0x12, 0xad, 0x35, 0xce, 0xb9, 0x87, 0x97, 0xa8, - 0xa2, 0x88, 0xf7, 0xab, 0xab, 0x98, 0x24, 0x41, - 0x08, 0x01, 0x42, 0xe0, 0xac, 0x45, 0x7b, 0x1e, - 0x57, 0x61, 0x88, 0x52, 0xea, 0xef, 0x53, 0x06, - 0xb8, 0x38, 0x3f, 0xe7, 0xb1, 0xf1, 0x01, 0x5a, - 0xad, 0xd6, 0xa3, 0x0f, 0xee, 0xe6, 0x17, 0x66, - 0xd7, 0x14, 0x2d, 0x9e, 0x0a, 0x27, 0x93, 0x00, - 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, - 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xf7, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, + 0xbd, 0x4b, 0x5b, 0x51, 0x1c, 0x86, 0x9f, 0x73, + 0xee, 0xcd, 0x47, 0x6d, 0x88, 0xc1, 0x1a, 0x8b, + 0x34, 0x10, 0x42, 0x07, 0xf7, 0x2e, 0x8e, 0x15, + 0x4a, 0xbb, 0x94, 0x2e, 0x95, 0xee, 0x92, 0x49, + 0x70, 0x76, 0x09, 0x88, 0xe0, 0xe0, 0x22, 0xd9, + 0x5c, 0x9c, 0x82, 0x7f, 0xc0, 0x85, 0x0e, 0x52, + 0x1c, 0x6b, 0xb6, 0x80, 0x48, 0x5d, 0x75, 0xb0, + 0x83, 0x82, 0x26, 0x45, 0x82, 0xb7, 0xf7, 0xde, + 0x24, 0xe7, 0xab, 0x83, 0x69, 0xea, 0x17, 0x45, + 0xda, 0x77, 0x3d, 0xfc, 0x9e, 0xf3, 0xbc, 0xf0, + 0x8a, 0xad, 0xad, 0x2d, 0xc7, 0x7f, 0xc4, 0x07, + 0x98, 0x9f, 0x9f, 0xff, 0xa7, 0xe3, 0x20, 0x08, + 0xae, 0x01, 0xd6, 0xda, 0x5b, 0x0f, 0xd2, 0x5a, + 0x34, 0x20, 0xd3, 0x69, 0xb0, 0x16, 0xa3, 0x14, + 0xa9, 0x74, 0x1a, 0x6b, 0xcc, 0xc3, 0x06, 0x37, + 0x01, 0x3a, 0x49, 0x68, 0x05, 0x01, 0x7e, 0xb1, + 0x48, 0xc6, 0xf7, 0x31, 0x27, 0x27, 0xf4, 0x2f, + 0x2f, 0xb1, 0x9e, 0xc7, 0xec, 0xd2, 0x12, 0xa9, + 0x6c, 0xf6, 0x3e, 0xc0, 0x0c, 0xc9, 0xae, 0xd7, + 0xe3, 0xdb, 0xee, 0x2e, 0xef, 0xca, 0x65, 0x72, + 0xc6, 0x40, 0x18, 0xe2, 0xa4, 0x84, 0xa9, 0x29, + 0xae, 0xce, 0xce, 0xd8, 0x5b, 0x59, 0xe1, 0xd5, + 0xda, 0xda, 0xb5, 0xd9, 0x5d, 0x03, 0xab, 0x35, + 0xcd, 0x20, 0xe0, 0x43, 0xa5, 0x02, 0xfb, 0xfb, + 0x74, 0xe2, 0x18, 0xab, 0x14, 0xc6, 0x39, 0x9c, + 0x94, 0x64, 0xa4, 0xe4, 0x75, 0x2a, 0x45, 0x50, + 0xab, 0xf1, 0x66, 0x7d, 0x1d, 0xcf, 0xf7, 0xaf, + 0xeb, 0x8e, 0x2a, 0x38, 0x47, 0xfb, 0xf8, 0x98, + 0xf1, 0x38, 0x26, 0x4e, 0x12, 0xc6, 0x17, 0x17, + 0x91, 0x85, 0x02, 0xbd, 0x4e, 0x87, 0xc9, 0x85, + 0x05, 0x42, 0xa5, 0x18, 0x9f, 0x9c, 0x24, 0x69, + 0xb7, 0x11, 0x9e, 0x37, 0xaa, 0x3d, 0x32, 0x90, + 0x42, 0xe0, 0xfb, 0x3e, 0xb6, 0xdf, 0xc7, 0x44, + 0x11, 0xdd, 0xed, 0x6d, 0xdc, 0xcc, 0x0c, 0xcf, + 0xe7, 0xe6, 0x70, 0x3b, 0x3b, 0xd0, 0xeb, 0x41, + 0x14, 0xe1, 0x06, 0x03, 0x9c, 0x73, 0xb8, 0x21, + 0xe0, 0x8f, 0xc1, 0x30, 0xc2, 0x39, 0x54, 0x92, + 0x10, 0x1e, 0x1d, 0x91, 0x2f, 0x95, 0x78, 0x3a, + 0x3d, 0xcd, 0x45, 0xa7, 0x83, 0xd6, 0x1a, 0x84, + 0x20, 0xe9, 0x76, 0x31, 0x4a, 0x8d, 0x6e, 0x6e, + 0x01, 0xac, 0x52, 0x08, 0x6b, 0x51, 0x42, 0x50, + 0xaa, 0xd5, 0xa0, 0xd9, 0xe4, 0xfb, 0xe6, 0x26, + 0xcf, 0xaa, 0x55, 0x5c, 0x2a, 0x05, 0x52, 0x62, + 0x95, 0x02, 0x21, 0xee, 0x57, 0xb0, 0x42, 0x50, + 0x28, 0x16, 0x39, 0x3d, 0x3c, 0x44, 0x0e, 0x06, + 0x1c, 0xd7, 0xeb, 0xd0, 0xef, 0xe3, 0x9c, 0xe3, + 0x67, 0xbd, 0xce, 0x13, 0xcf, 0xe3, 0xc7, 0xe9, + 0x29, 0xb9, 0x4a, 0x85, 0x9b, 0x9f, 0x8e, 0x0c, + 0x7a, 0x49, 0xc2, 0x6c, 0xb5, 0xca, 0x67, 0x21, + 0xb0, 0x99, 0x0c, 0x2f, 0x73, 0x39, 0x5e, 0xe4, + 0xf3, 0x94, 0x0a, 0x05, 0xca, 0x63, 0x63, 0xe4, + 0xe3, 0x98, 0x2f, 0x51, 0xc4, 0xa7, 0x46, 0x03, + 0xad, 0xf5, 0x6d, 0x83, 0xdf, 0x3b, 0xc0, 0x18, + 0xde, 0x2e, 0x2f, 0xf3, 0x75, 0x63, 0x83, 0xec, + 0xc1, 0x01, 0x7d, 0x6b, 0x11, 0x42, 0x20, 0x8d, + 0x21, 0x9c, 0x98, 0xe0, 0x63, 0xa3, 0x81, 0x90, + 0x12, 0xad, 0x35, 0xce, 0xb9, 0x87, 0x97, 0xa8, + 0xa2, 0x88, 0xf7, 0xab, 0xab, 0x98, 0x24, 0x41, + 0x08, 0x01, 0x42, 0xe0, 0xac, 0x45, 0x7b, 0x1e, + 0x57, 0x61, 0x88, 0x52, 0xea, 0xef, 0x53, 0x06, + 0xb8, 0x38, 0x3f, 0xe7, 0xb1, 0xf1, 0x01, 0x5a, + 0xad, 0xd6, 0xa3, 0x0f, 0xee, 0xe6, 0x17, 0x66, + 0xd7, 0x14, 0x2d, 0x9e, 0x0a, 0x27, 0x93, 0x00, + 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, + 0x42, 0x60, 0x82 +}; /* End Of File */ /* gem_edit.png - 697 bytes */ unsigned char gem_edit_png[697] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x1e, 0x78, 0x00, 0x00, 0x1e, - 0x78, 0x01, 0xcb, 0xab, 0x03, 0x1f, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x15, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x93, - 0x3f, 0x4f, 0x93, 0x51, 0x14, 0xc6, 0x7f, 0xef, - 0x6d, 0x2b, 0xd8, 0x02, 0x0d, 0x69, 0x5a, 0x6a, - 0x6d, 0x52, 0x83, 0xa2, 0x89, 0xc4, 0x3f, 0x18, - 0x45, 0x1c, 0x1c, 0x54, 0x4c, 0x9c, 0x48, 0x4c, - 0x35, 0xd1, 0x98, 0x10, 0x3f, 0x80, 0x5f, 0xc2, - 0xd5, 0x4f, 0x20, 0x93, 0x31, 0x71, 0x53, 0x16, - 0x59, 0x84, 0x01, 0xe3, 0x22, 0xed, 0xe0, 0xa0, - 0x46, 0x71, 0x51, 0x02, 0x24, 0x44, 0x5b, 0x0b, - 0x2a, 0x29, 0x7d, 0x7d, 0xdf, 0x7b, 0xce, 0x75, - 0xa8, 0x36, 0xd4, 0x12, 0x06, 0x7d, 0x96, 0xbb, - 0x9c, 0xe7, 0x77, 0x9f, 0x3c, 0x39, 0xc7, 0x9b, - 0x9a, 0x9a, 0x72, 0xfc, 0x87, 0xa2, 0x00, 0xc5, - 0x62, 0xf1, 0x9f, 0xcc, 0xd3, 0xd3, 0xd3, 0x4d, - 0x80, 0xaa, 0xf2, 0xb0, 0x64, 0x31, 0xc6, 0x03, - 0x1c, 0xea, 0x40, 0xd5, 0xe1, 0xd4, 0xc3, 0xa9, - 0x22, 0xce, 0xa1, 0x02, 0xa1, 0x55, 0xae, 0x8f, - 0x76, 0x91, 0x4d, 0x9a, 0xf6, 0x04, 0xaa, 0x8a, - 0x31, 0x1e, 0xd9, 0x64, 0x0c, 0xe7, 0x9a, 0x00, - 0xe7, 0x1c, 0xaa, 0xcd, 0xd7, 0x29, 0x88, 0x89, - 0xb3, 0x54, 0xf1, 0x09, 0x3d, 0x50, 0x95, 0x76, - 0x80, 0x88, 0x20, 0xea, 0xfd, 0xfe, 0x15, 0x44, - 0x5d, 0x0b, 0xa4, 0x6a, 0x08, 0x5c, 0x94, 0x64, - 0xbd, 0xc4, 0x91, 0x46, 0x0d, 0xfb, 0x31, 0x20, - 0x1c, 0x3a, 0x86, 0xe9, 0xca, 0x00, 0x60, 0xfe, - 0x24, 0x50, 0xeb, 0x10, 0x05, 0x51, 0x45, 0xd4, - 0x21, 0xe2, 0xb0, 0xd6, 0xd1, 0xb0, 0x86, 0x54, - 0x63, 0x9e, 0xf3, 0xd1, 0xa7, 0x4c, 0x9e, 0x55, - 0xf2, 0x7b, 0x56, 0xa9, 0xbd, 0xbc, 0x8f, 0xaa, - 0xb6, 0x03, 0xac, 0x3a, 0x54, 0x14, 0x2b, 0x4d, - 0xb3, 0xa8, 0x12, 0x58, 0x8f, 0x8c, 0xbe, 0xe0, - 0xd2, 0xe0, 0x3b, 0xd2, 0xf9, 0x53, 0xf8, 0xb1, - 0x2c, 0xb9, 0xe1, 0x09, 0x22, 0x21, 0x2d, 0x40, - 0xab, 0x03, 0x09, 0xbd, 0x96, 0x59, 0x9d, 0x87, - 0x95, 0x08, 0x29, 0x5e, 0x71, 0xe1, 0xd0, 0x12, - 0xe9, 0xfc, 0x10, 0xf5, 0xb5, 0x05, 0xbe, 0x2e, - 0x96, 0xf0, 0xb7, 0x12, 0x74, 0x0f, 0x5f, 0xdd, - 0x21, 0x81, 0x75, 0x88, 0x28, 0xe2, 0x0c, 0x8d, - 0xc0, 0xd0, 0x17, 0x94, 0x19, 0x1f, 0x5c, 0x24, - 0x9d, 0xdb, 0x87, 0xff, 0x6d, 0x86, 0xee, 0xbd, - 0x3e, 0xf5, 0x4d, 0x1f, 0x3f, 0x3d, 0x8a, 0x49, - 0x0d, 0x75, 0x02, 0x42, 0x2b, 0x58, 0x8d, 0xd0, - 0x08, 0x63, 0xc4, 0x37, 0xe6, 0x19, 0x3f, 0xf0, - 0x9e, 0x81, 0x42, 0x9e, 0x70, 0x73, 0x86, 0x98, - 0x24, 0xa8, 0x2e, 0x7c, 0xe7, 0xc9, 0xca, 0x15, - 0x2a, 0xbd, 0x63, 0xcd, 0xce, 0x3a, 0x12, 0x88, - 0x87, 0x84, 0x4a, 0xbc, 0x3a, 0xc7, 0x48, 0xa2, - 0x44, 0x7f, 0x2e, 0x83, 0xfb, 0x39, 0x4b, 0x4c, - 0xfa, 0xf8, 0x52, 0xfe, 0xc1, 0x6c, 0xfd, 0x26, - 0x9f, 0x12, 0x17, 0x71, 0xa1, 0xdf, 0x06, 0x68, - 0x75, 0x50, 0x0f, 0x22, 0xac, 0x2d, 0xbf, 0xe5, - 0xc6, 0xc1, 0x37, 0x0c, 0x66, 0x4f, 0xf3, 0xfa, - 0xd1, 0x5d, 0xfa, 0x0f, 0x17, 0xa8, 0x7d, 0xce, - 0x32, 0x5b, 0xbb, 0xc6, 0x6a, 0x62, 0x14, 0xd9, - 0xaa, 0xa2, 0xea, 0xa1, 0xfa, 0xd7, 0x22, 0x89, - 0x08, 0xc5, 0x93, 0x75, 0x2a, 0xcb, 0x55, 0x2a, - 0xcb, 0x4b, 0x8c, 0x0c, 0x9f, 0xa1, 0xc7, 0x14, - 0xf8, 0x30, 0xb7, 0x42, 0xea, 0xf2, 0x2d, 0xc6, - 0x8e, 0x9e, 0xe0, 0x9c, 0xae, 0x13, 0x31, 0x8e, - 0x81, 0x64, 0x73, 0xbe, 0x63, 0x13, 0x33, 0x3d, - 0x8a, 0xf4, 0xf6, 0xf0, 0xf8, 0xc1, 0x73, 0x82, - 0x8d, 0x75, 0x32, 0xd9, 0xfd, 0xe4, 0x26, 0x6e, - 0x13, 0xcf, 0x1d, 0xa7, 0x1f, 0x7f, 0xdb, 0x05, - 0x34, 0x37, 0xb4, 0x03, 0x00, 0x30, 0x90, 0x2f, - 0x70, 0xe7, 0xde, 0xb3, 0xb6, 0x83, 0xd1, 0xed, - 0xd3, 0x3b, 0x28, 0x0a, 0x50, 0x2e, 0x97, 0x77, - 0x1d, 0xda, 0x4d, 0xbf, 0x00, 0x8a, 0xcd, 0x4a, - 0xbe, 0xe8, 0xed, 0x51, 0xc4, 0x00, 0x00, 0x00, - 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, - 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x1e, 0x78, 0x00, 0x00, 0x1e, + 0x78, 0x01, 0xcb, 0xab, 0x03, 0x1f, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x15, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x93, + 0x3f, 0x4f, 0x93, 0x51, 0x14, 0xc6, 0x7f, 0xef, + 0x6d, 0x2b, 0xd8, 0x02, 0x0d, 0x69, 0x5a, 0x6a, + 0x6d, 0x52, 0x83, 0xa2, 0x89, 0xc4, 0x3f, 0x18, + 0x45, 0x1c, 0x1c, 0x54, 0x4c, 0x9c, 0x48, 0x4c, + 0x35, 0xd1, 0x98, 0x10, 0x3f, 0x80, 0x5f, 0xc2, + 0xd5, 0x4f, 0x20, 0x93, 0x31, 0x71, 0x53, 0x16, + 0x59, 0x84, 0x01, 0xe3, 0x22, 0xed, 0xe0, 0xa0, + 0x46, 0x71, 0x51, 0x02, 0x24, 0x44, 0x5b, 0x0b, + 0x2a, 0x29, 0x7d, 0x7d, 0xdf, 0x7b, 0xce, 0x75, + 0xa8, 0x36, 0xd4, 0x12, 0x06, 0x7d, 0x96, 0xbb, + 0x9c, 0xe7, 0x77, 0x9f, 0x3c, 0x39, 0xc7, 0x9b, + 0x9a, 0x9a, 0x72, 0xfc, 0x87, 0xa2, 0x00, 0xc5, + 0x62, 0xf1, 0x9f, 0xcc, 0xd3, 0xd3, 0xd3, 0x4d, + 0x80, 0xaa, 0xf2, 0xb0, 0x64, 0x31, 0xc6, 0x03, + 0x1c, 0xea, 0x40, 0xd5, 0xe1, 0xd4, 0xc3, 0xa9, + 0x22, 0xce, 0xa1, 0x02, 0xa1, 0x55, 0xae, 0x8f, + 0x76, 0x91, 0x4d, 0x9a, 0xf6, 0x04, 0xaa, 0x8a, + 0x31, 0x1e, 0xd9, 0x64, 0x0c, 0xe7, 0x9a, 0x00, + 0xe7, 0x1c, 0xaa, 0xcd, 0xd7, 0x29, 0x88, 0x89, + 0xb3, 0x54, 0xf1, 0x09, 0x3d, 0x50, 0x95, 0x76, + 0x80, 0x88, 0x20, 0xea, 0xfd, 0xfe, 0x15, 0x44, + 0x5d, 0x0b, 0xa4, 0x6a, 0x08, 0x5c, 0x94, 0x64, + 0xbd, 0xc4, 0x91, 0x46, 0x0d, 0xfb, 0x31, 0x20, + 0x1c, 0x3a, 0x86, 0xe9, 0xca, 0x00, 0x60, 0xfe, + 0x24, 0x50, 0xeb, 0x10, 0x05, 0x51, 0x45, 0xd4, + 0x21, 0xe2, 0xb0, 0xd6, 0xd1, 0xb0, 0x86, 0x54, + 0x63, 0x9e, 0xf3, 0xd1, 0xa7, 0x4c, 0x9e, 0x55, + 0xf2, 0x7b, 0x56, 0xa9, 0xbd, 0xbc, 0x8f, 0xaa, + 0xb6, 0x03, 0xac, 0x3a, 0x54, 0x14, 0x2b, 0x4d, + 0xb3, 0xa8, 0x12, 0x58, 0x8f, 0x8c, 0xbe, 0xe0, + 0xd2, 0xe0, 0x3b, 0xd2, 0xf9, 0x53, 0xf8, 0xb1, + 0x2c, 0xb9, 0xe1, 0x09, 0x22, 0x21, 0x2d, 0x40, + 0xab, 0x03, 0x09, 0xbd, 0x96, 0x59, 0x9d, 0x87, + 0x95, 0x08, 0x29, 0x5e, 0x71, 0xe1, 0xd0, 0x12, + 0xe9, 0xfc, 0x10, 0xf5, 0xb5, 0x05, 0xbe, 0x2e, + 0x96, 0xf0, 0xb7, 0x12, 0x74, 0x0f, 0x5f, 0xdd, + 0x21, 0x81, 0x75, 0x88, 0x28, 0xe2, 0x0c, 0x8d, + 0xc0, 0xd0, 0x17, 0x94, 0x19, 0x1f, 0x5c, 0x24, + 0x9d, 0xdb, 0x87, 0xff, 0x6d, 0x86, 0xee, 0xbd, + 0x3e, 0xf5, 0x4d, 0x1f, 0x3f, 0x3d, 0x8a, 0x49, + 0x0d, 0x75, 0x02, 0x42, 0x2b, 0x58, 0x8d, 0xd0, + 0x08, 0x63, 0xc4, 0x37, 0xe6, 0x19, 0x3f, 0xf0, + 0x9e, 0x81, 0x42, 0x9e, 0x70, 0x73, 0x86, 0x98, + 0x24, 0xa8, 0x2e, 0x7c, 0xe7, 0xc9, 0xca, 0x15, + 0x2a, 0xbd, 0x63, 0xcd, 0xce, 0x3a, 0x12, 0x88, + 0x87, 0x84, 0x4a, 0xbc, 0x3a, 0xc7, 0x48, 0xa2, + 0x44, 0x7f, 0x2e, 0x83, 0xfb, 0x39, 0x4b, 0x4c, + 0xfa, 0xf8, 0x52, 0xfe, 0xc1, 0x6c, 0xfd, 0x26, + 0x9f, 0x12, 0x17, 0x71, 0xa1, 0xdf, 0x06, 0x68, + 0x75, 0x50, 0x0f, 0x22, 0xac, 0x2d, 0xbf, 0xe5, + 0xc6, 0xc1, 0x37, 0x0c, 0x66, 0x4f, 0xf3, 0xfa, + 0xd1, 0x5d, 0xfa, 0x0f, 0x17, 0xa8, 0x7d, 0xce, + 0x32, 0x5b, 0xbb, 0xc6, 0x6a, 0x62, 0x14, 0xd9, + 0xaa, 0xa2, 0xea, 0xa1, 0xfa, 0xd7, 0x22, 0x89, + 0x08, 0xc5, 0x93, 0x75, 0x2a, 0xcb, 0x55, 0x2a, + 0xcb, 0x4b, 0x8c, 0x0c, 0x9f, 0xa1, 0xc7, 0x14, + 0xf8, 0x30, 0xb7, 0x42, 0xea, 0xf2, 0x2d, 0xc6, + 0x8e, 0x9e, 0xe0, 0x9c, 0xae, 0x13, 0x31, 0x8e, + 0x81, 0x64, 0x73, 0xbe, 0x63, 0x13, 0x33, 0x3d, + 0x8a, 0xf4, 0xf6, 0xf0, 0xf8, 0xc1, 0x73, 0x82, + 0x8d, 0x75, 0x32, 0xd9, 0xfd, 0xe4, 0x26, 0x6e, + 0x13, 0xcf, 0x1d, 0xa7, 0x1f, 0x7f, 0xdb, 0x05, + 0x34, 0x37, 0xb4, 0x03, 0x00, 0x30, 0x90, 0x2f, + 0x70, 0xe7, 0xde, 0xb3, 0xb6, 0x83, 0xd1, 0xed, + 0xd3, 0x3b, 0x28, 0x0a, 0x50, 0x2e, 0x97, 0x77, + 0x1d, 0xda, 0x4d, 0xbf, 0x00, 0x8a, 0xcd, 0x4a, + 0xbe, 0xe8, 0xed, 0x51, 0xc4, 0x00, 0x00, 0x00, + 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, + 0x82 +}; /* End Of File */ /* gem_move.png - 662 bytes */ unsigned char gem_move_png[662] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x1e, 0x78, 0x00, 0x00, 0x1e, - 0x78, 0x01, 0xcb, 0xab, 0x03, 0x1f, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xf2, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x93, - 0xb9, 0x4f, 0x54, 0x51, 0x14, 0x87, 0xbf, 0xfb, - 0xe6, 0x0d, 0xcc, 0x30, 0x10, 0xdc, 0xa0, 0x20, - 0x71, 0x63, 0x29, 0x5c, 0x02, 0x06, 0x8a, 0xd1, - 0x10, 0xe3, 0xda, 0x6a, 0x33, 0x89, 0x7f, 0x89, - 0x05, 0x7f, 0x83, 0x31, 0x5a, 0x4f, 0xa5, 0x85, - 0x22, 0x26, 0x4e, 0x48, 0x88, 0x95, 0x71, 0x89, - 0xa8, 0xe8, 0x23, 0x2e, 0xb4, 0xc2, 0x40, 0x34, - 0x13, 0x2a, 0x69, 0x20, 0xf2, 0x26, 0xf0, 0xee, - 0x39, 0xc7, 0xe2, 0xcd, 0x40, 0xc6, 0xa5, 0xc1, - 0x9b, 0xdc, 0x5b, 0x9c, 0xe4, 0x7c, 0xf7, 0xcb, - 0xc9, 0xef, 0xb8, 0x72, 0xb9, 0x6c, 0xfc, 0xc7, - 0x09, 0x01, 0x4a, 0xa5, 0xd2, 0x9e, 0x9a, 0x2b, - 0x95, 0x4a, 0x0a, 0x50, 0x55, 0xa6, 0xa6, 0xa6, - 0x50, 0x15, 0x8e, 0xf7, 0x0f, 0x31, 0x32, 0x56, - 0x04, 0x53, 0x0c, 0x70, 0x80, 0x19, 0xe0, 0x02, - 0xe6, 0xe7, 0x5e, 0xf3, 0xe1, 0xfd, 0x5b, 0x9c, - 0x0b, 0x98, 0x98, 0x98, 0xd8, 0x35, 0x50, 0x55, - 0x54, 0x84, 0x81, 0x23, 0x3d, 0x7c, 0xaa, 0xae, - 0xf1, 0xbd, 0x23, 0x8f, 0xdf, 0xda, 0x40, 0x04, - 0x30, 0x30, 0x55, 0x5c, 0xee, 0x00, 0x8b, 0xf3, - 0xcb, 0x8c, 0x1e, 0xed, 0x25, 0x5a, 0xf8, 0x8a, - 0xaa, 0xee, 0x02, 0x44, 0x84, 0x63, 0xfd, 0x83, - 0x7c, 0xac, 0xfe, 0xe0, 0xf0, 0xe0, 0x08, 0x5d, - 0x9d, 0x4a, 0xd2, 0x96, 0x05, 0x05, 0x31, 0xc3, - 0xcc, 0xc8, 0x84, 0x09, 0x6e, 0x78, 0x9c, 0xd9, - 0x77, 0xcf, 0x38, 0x5f, 0x1c, 0x47, 0x44, 0x5a, - 0x0d, 0xc6, 0x46, 0xcf, 0xb0, 0xd2, 0xb1, 0x9f, - 0xce, 0x2e, 0xa5, 0x1e, 0xd7, 0x51, 0x4b, 0xd5, - 0x55, 0x53, 0x03, 0x5f, 0xff, 0xc9, 0xbe, 0xbe, - 0x53, 0x0c, 0x5d, 0x19, 0xe6, 0xda, 0xb9, 0xf5, - 0x56, 0x03, 0x55, 0x25, 0xde, 0x06, 0xbf, 0xb9, - 0x4e, 0xd2, 0xd6, 0x86, 0x1a, 0x88, 0x58, 0x03, - 0xa0, 0x88, 0x80, 0x61, 0x6c, 0xd5, 0x63, 0x36, - 0xd7, 0xeb, 0x6c, 0xc4, 0x21, 0x9d, 0x39, 0xf7, - 0xdb, 0x0c, 0x34, 0x6d, 0xf2, 0x5e, 0xf1, 0xde, - 0x50, 0x6d, 0x5e, 0x30, 0x4b, 0x21, 0x81, 0x33, - 0xd4, 0x1b, 0xa2, 0x8a, 0xea, 0xdf, 0x00, 0xde, - 0x10, 0x35, 0x44, 0x14, 0x51, 0xb0, 0x06, 0xc4, - 0x1a, 0xb3, 0x50, 0x47, 0x0a, 0x97, 0x7f, 0x00, - 0x12, 0xdf, 0x30, 0x90, 0xdd, 0x5a, 0x13, 0x22, - 0x6a, 0x04, 0x0e, 0x12, 0x49, 0xeb, 0x4d, 0x40, - 0xd0, 0x04, 0xe4, 0x42, 0x25, 0xcc, 0x1f, 0x24, - 0x93, 0x2d, 0xe0, 0xb7, 0x93, 0xd4, 0x46, 0x14, - 0x2f, 0x86, 0x17, 0x23, 0x49, 0x3c, 0x61, 0xb6, - 0x40, 0xbe, 0xab, 0x8f, 0x42, 0xbb, 0xed, 0x0c, - 0x71, 0x07, 0x30, 0xf9, 0xe8, 0x31, 0xb3, 0x0f, - 0x6f, 0xb2, 0xbc, 0xf0, 0x8a, 0xf6, 0x7c, 0x77, - 0x1a, 0x35, 0x6b, 0xa6, 0x08, 0x3a, 0x0a, 0xdd, - 0x2c, 0x7e, 0x79, 0x49, 0xe5, 0xee, 0x0d, 0x6e, - 0xdd, 0xbe, 0xd3, 0x0a, 0x10, 0x11, 0xe6, 0xa3, - 0x39, 0xce, 0x0e, 0x04, 0xcc, 0x3e, 0x9f, 0x61, - 0x65, 0xcd, 0xb1, 0xb4, 0x1a, 0x53, 0xad, 0x6d, - 0x52, 0x5d, 0x8d, 0x59, 0xaa, 0xc5, 0x7c, 0x5b, - 0xcb, 0xf2, 0x74, 0xfa, 0x1e, 0x17, 0x4f, 0x67, - 0x98, 0x99, 0x7e, 0xf2, 0x67, 0x0e, 0x32, 0x99, - 0x90, 0x17, 0x6f, 0x3e, 0x73, 0xe1, 0xd2, 0x55, - 0xae, 0x9f, 0xac, 0x61, 0x8d, 0x1f, 0xac, 0xf1, - 0xb8, 0xa0, 0x06, 0x97, 0x4f, 0x30, 0xf9, 0xe0, - 0x3e, 0x87, 0x7a, 0x7a, 0x77, 0x0c, 0x5c, 0xb9, - 0x5c, 0xb6, 0x62, 0xb1, 0xb8, 0xa7, 0x65, 0x8a, - 0xa2, 0x28, 0x35, 0x88, 0xa2, 0x68, 0x4f, 0x00, - 0x80, 0x5f, 0x92, 0xf7, 0x55, 0x5a, 0x92, 0xb7, - 0x87, 0xcd, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, - 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x1e, 0x78, 0x00, 0x00, 0x1e, + 0x78, 0x01, 0xcb, 0xab, 0x03, 0x1f, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xf2, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x93, + 0xb9, 0x4f, 0x54, 0x51, 0x14, 0x87, 0xbf, 0xfb, + 0xe6, 0x0d, 0xcc, 0x30, 0x10, 0xdc, 0xa0, 0x20, + 0x71, 0x63, 0x29, 0x5c, 0x02, 0x06, 0x8a, 0xd1, + 0x10, 0xe3, 0xda, 0x6a, 0x33, 0x89, 0x7f, 0x89, + 0x05, 0x7f, 0x83, 0x31, 0x5a, 0x4f, 0xa5, 0x85, + 0x22, 0x26, 0x4e, 0x48, 0x88, 0x95, 0x71, 0x89, + 0xa8, 0xe8, 0x23, 0x2e, 0xb4, 0xc2, 0x40, 0x34, + 0x13, 0x2a, 0x69, 0x20, 0xf2, 0x26, 0xf0, 0xee, + 0x39, 0xc7, 0xe2, 0xcd, 0x40, 0xc6, 0xa5, 0xc1, + 0x9b, 0xdc, 0x5b, 0x9c, 0xe4, 0x7c, 0xf7, 0xcb, + 0xc9, 0xef, 0xb8, 0x72, 0xb9, 0x6c, 0xfc, 0xc7, + 0x09, 0x01, 0x4a, 0xa5, 0xd2, 0x9e, 0x9a, 0x2b, + 0x95, 0x4a, 0x0a, 0x50, 0x55, 0xa6, 0xa6, 0xa6, + 0x50, 0x15, 0x8e, 0xf7, 0x0f, 0x31, 0x32, 0x56, + 0x04, 0x53, 0x0c, 0x70, 0x80, 0x19, 0xe0, 0x02, + 0xe6, 0xe7, 0x5e, 0xf3, 0xe1, 0xfd, 0x5b, 0x9c, + 0x0b, 0x98, 0x98, 0x98, 0xd8, 0x35, 0x50, 0x55, + 0x54, 0x84, 0x81, 0x23, 0x3d, 0x7c, 0xaa, 0xae, + 0xf1, 0xbd, 0x23, 0x8f, 0xdf, 0xda, 0x40, 0x04, + 0x30, 0x30, 0x55, 0x5c, 0xee, 0x00, 0x8b, 0xf3, + 0xcb, 0x8c, 0x1e, 0xed, 0x25, 0x5a, 0xf8, 0x8a, + 0xaa, 0xee, 0x02, 0x44, 0x84, 0x63, 0xfd, 0x83, + 0x7c, 0xac, 0xfe, 0xe0, 0xf0, 0xe0, 0x08, 0x5d, + 0x9d, 0x4a, 0xd2, 0x96, 0x05, 0x05, 0x31, 0xc3, + 0xcc, 0xc8, 0x84, 0x09, 0x6e, 0x78, 0x9c, 0xd9, + 0x77, 0xcf, 0x38, 0x5f, 0x1c, 0x47, 0x44, 0x5a, + 0x0d, 0xc6, 0x46, 0xcf, 0xb0, 0xd2, 0xb1, 0x9f, + 0xce, 0x2e, 0xa5, 0x1e, 0xd7, 0x51, 0x4b, 0xd5, + 0x55, 0x53, 0x03, 0x5f, 0xff, 0xc9, 0xbe, 0xbe, + 0x53, 0x0c, 0x5d, 0x19, 0xe6, 0xda, 0xb9, 0xf5, + 0x56, 0x03, 0x55, 0x25, 0xde, 0x06, 0xbf, 0xb9, + 0x4e, 0xd2, 0xd6, 0x86, 0x1a, 0x88, 0x58, 0x03, + 0xa0, 0x88, 0x80, 0x61, 0x6c, 0xd5, 0x63, 0x36, + 0xd7, 0xeb, 0x6c, 0xc4, 0x21, 0x9d, 0x39, 0xf7, + 0xdb, 0x0c, 0x34, 0x6d, 0xf2, 0x5e, 0xf1, 0xde, + 0x50, 0x6d, 0x5e, 0x30, 0x4b, 0x21, 0x81, 0x33, + 0xd4, 0x1b, 0xa2, 0x8a, 0xea, 0xdf, 0x00, 0xde, + 0x10, 0x35, 0x44, 0x14, 0x51, 0xb0, 0x06, 0xc4, + 0x1a, 0xb3, 0x50, 0x47, 0x0a, 0x97, 0x7f, 0x00, + 0x12, 0xdf, 0x30, 0x90, 0xdd, 0x5a, 0x13, 0x22, + 0x6a, 0x04, 0x0e, 0x12, 0x49, 0xeb, 0x4d, 0x40, + 0xd0, 0x04, 0xe4, 0x42, 0x25, 0xcc, 0x1f, 0x24, + 0x93, 0x2d, 0xe0, 0xb7, 0x93, 0xd4, 0x46, 0x14, + 0x2f, 0x86, 0x17, 0x23, 0x49, 0x3c, 0x61, 0xb6, + 0x40, 0xbe, 0xab, 0x8f, 0x42, 0xbb, 0xed, 0x0c, + 0x71, 0x07, 0x30, 0xf9, 0xe8, 0x31, 0xb3, 0x0f, + 0x6f, 0xb2, 0xbc, 0xf0, 0x8a, 0xf6, 0x7c, 0x77, + 0x1a, 0x35, 0x6b, 0xa6, 0x08, 0x3a, 0x0a, 0xdd, + 0x2c, 0x7e, 0x79, 0x49, 0xe5, 0xee, 0x0d, 0x6e, + 0xdd, 0xbe, 0xd3, 0x0a, 0x10, 0x11, 0xe6, 0xa3, + 0x39, 0xce, 0x0e, 0x04, 0xcc, 0x3e, 0x9f, 0x61, + 0x65, 0xcd, 0xb1, 0xb4, 0x1a, 0x53, 0xad, 0x6d, + 0x52, 0x5d, 0x8d, 0x59, 0xaa, 0xc5, 0x7c, 0x5b, + 0xcb, 0xf2, 0x74, 0xfa, 0x1e, 0x17, 0x4f, 0x67, + 0x98, 0x99, 0x7e, 0xf2, 0x67, 0x0e, 0x32, 0x99, + 0x90, 0x17, 0x6f, 0x3e, 0x73, 0xe1, 0xd2, 0x55, + 0xae, 0x9f, 0xac, 0x61, 0x8d, 0x1f, 0xac, 0xf1, + 0xb8, 0xa0, 0x06, 0x97, 0x4f, 0x30, 0xf9, 0xe0, + 0x3e, 0x87, 0x7a, 0x7a, 0x77, 0x0c, 0x5c, 0xb9, + 0x5c, 0xb6, 0x62, 0xb1, 0xb8, 0xa7, 0x65, 0x8a, + 0xa2, 0x28, 0x35, 0x88, 0xa2, 0x68, 0x4f, 0x00, + 0x80, 0x5f, 0x92, 0xf7, 0x55, 0x5a, 0x92, 0xb7, + 0x87, 0xcd, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* no_logout.png - 782 bytes */ unsigned char no_logout_png[782] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x6a, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xcd, 0x97, - 0xbf, 0x6f, 0x12, 0x61, 0x18, 0xc7, 0x3f, 0x6d, - 0xda, 0xe8, 0xd5, 0x91, 0x00, 0x0d, 0x42, 0x87, - 0x2e, 0x1a, 0x4d, 0xb0, 0x8b, 0x8b, 0x83, 0x0e, - 0x9a, 0xb8, 0x74, 0x30, 0xef, 0x68, 0x88, 0xc2, - 0x00, 0xff, 0x81, 0xfe, 0x05, 0x6e, 0xd5, 0xc1, - 0x11, 0x1a, 0x4c, 0x20, 0x4d, 0xdc, 0x6e, 0x6a, - 0x63, 0x62, 0x1b, 0x5c, 0xb4, 0xee, 0x0c, 0xb4, - 0x25, 0x1a, 0x87, 0xd2, 0xa4, 0x80, 0x28, 0xd2, - 0xb4, 0x94, 0x72, 0xf7, 0x9e, 0x03, 0xb9, 0x93, - 0x1f, 0x47, 0x39, 0x0c, 0x94, 0x3e, 0xc9, 0xe5, - 0xbd, 0xf7, 0xf9, 0xf1, 0x7d, 0x3e, 0xe1, 0xe5, - 0xde, 0xf7, 0x6e, 0x2a, 0x1e, 0x8f, 0x1b, 0x4c, - 0xd0, 0x66, 0x00, 0x62, 0xb1, 0xd8, 0x44, 0x9a, - 0x27, 0x12, 0x89, 0x16, 0x00, 0x40, 0xa5, 0x52, - 0xb9, 0xd0, 0xe6, 0x2e, 0x97, 0x0b, 0xe0, 0x1f, - 0x80, 0x61, 0x4c, 0x66, 0x25, 0xfe, 0x0b, 0xc0, - 0xed, 0x76, 0xdb, 0xfa, 0xcb, 0xe5, 0xf2, 0xf8, - 0x01, 0x3c, 0x1e, 0x0f, 0xaa, 0xaa, 0xda, 0xc6, - 0x84, 0x10, 0x94, 0x4a, 0xa5, 0xf1, 0x01, 0x78, - 0xbd, 0x5e, 0x54, 0x55, 0x45, 0x08, 0x41, 0x2e, - 0x97, 0xb3, 0xfc, 0xb5, 0x5a, 0x0d, 0x29, 0xa5, - 0x15, 0x2b, 0x16, 0x8b, 0xa3, 0x07, 0x98, 0x9f, - 0x9f, 0xb7, 0x1a, 0x54, 0xab, 0x55, 0x76, 0x77, - 0x77, 0x7b, 0x72, 0x7c, 0x3e, 0x9f, 0x95, 0x73, - 0x78, 0x78, 0x38, 0x1c, 0x80, 0x94, 0xd2, 0x51, - 0x41, 0xb5, 0x5a, 0x25, 0x93, 0xc9, 0x20, 0x84, - 0xe8, 0xf0, 0xab, 0xaa, 0xda, 0xa1, 0xe1, 0x54, - 0x6f, 0x6c, 0x4f, 0x81, 0x53, 0x3d, 0x47, 0x00, - 0x7e, 0xbf, 0x9f, 0xef, 0x1f, 0x02, 0xc0, 0x5b, - 0x34, 0x4d, 0x03, 0x60, 0x6f, 0x63, 0x91, 0x99, - 0xe9, 0x26, 0x00, 0x9a, 0x9c, 0x05, 0x5e, 0x5b, - 0xf9, 0x7b, 0xea, 0x75, 0x6e, 0x88, 0x03, 0x0a, - 0x85, 0xc2, 0x68, 0x00, 0x4c, 0x13, 0x42, 0x20, - 0xb5, 0x5f, 0x3c, 0x59, 0xbe, 0x0b, 0xf2, 0x23, - 0x86, 0xac, 0xb7, 0x6a, 0xe5, 0x31, 0x8b, 0x7a, - 0x0d, 0x43, 0xdb, 0x67, 0xca, 0x5f, 0x64, 0x67, - 0xab, 0xe9, 0x58, 0x73, 0x28, 0x00, 0x79, 0xb6, - 0x8f, 0x76, 0xb4, 0xcd, 0xbd, 0xc7, 0x2b, 0x00, - 0xdc, 0xb9, 0xe5, 0xe2, 0xcd, 0xcb, 0x9b, 0x3c, - 0x0a, 0x7f, 0xb1, 0x72, 0xbe, 0xaa, 0xcf, 0x38, - 0xfd, 0xad, 0x39, 0xd6, 0x9c, 0x6e, 0x07, 0xe8, - 0x77, 0x75, 0xdb, 0xb5, 0xb9, 0x59, 0x3e, 0xaf, - 0x3f, 0xe7, 0xdb, 0x8f, 0x3f, 0x00, 0xcc, 0x5d, - 0x9d, 0x66, 0x7d, 0xc5, 0xcb, 0xdc, 0x95, 0x56, - 0xbc, 0x79, 0xa2, 0x3b, 0xd6, 0x1c, 0xee, 0x4f, - 0x28, 0x1b, 0x03, 0x53, 0x8c, 0xc6, 0x01, 0x86, - 0x6e, 0x38, 0xd6, 0x1c, 0x0a, 0xc0, 0x5c, 0x73, - 0xa7, 0x36, 0x72, 0x80, 0x7e, 0x76, 0x72, 0x2a, - 0x59, 0x7e, 0xd1, 0xbb, 0xfb, 0x8d, 0x14, 0x40, - 0xab, 0x4b, 0xe4, 0xcf, 0x4f, 0xd0, 0x38, 0x60, - 0x33, 0x79, 0x1f, 0x8e, 0x0a, 0x6c, 0xbe, 0x7b, - 0x00, 0xc0, 0xf6, 0xfb, 0x87, 0xb6, 0x35, 0xa3, - 0x05, 0x38, 0xd5, 0xd9, 0xd9, 0x7a, 0x45, 0xf3, - 0x58, 0x47, 0x3f, 0x33, 0x68, 0x9e, 0xe8, 0xd6, - 0x5a, 0xf7, 0xb3, 0x91, 0x02, 0xdc, 0x7e, 0xea, - 0x6c, 0x6f, 0x1f, 0x0b, 0x40, 0x3e, 0x9f, 0x1f, - 0xba, 0xb9, 0x53, 0xbb, 0xbc, 0x6f, 0x44, 0xd1, - 0x68, 0x94, 0xd5, 0xd5, 0x55, 0x00, 0x42, 0xa1, - 0x90, 0xe5, 0x5f, 0x5b, 0x5b, 0x1b, 0x38, 0x37, - 0x6b, 0xcd, 0xb1, 0x3b, 0xde, 0x6e, 0xd6, 0x4e, - 0x28, 0xa5, 0xec, 0xb8, 0xda, 0x7d, 0x8a, 0xa2, - 0x90, 0x4e, 0xa7, 0x51, 0x14, 0xa5, 0x63, 0x9e, - 0x4e, 0xa7, 0x6d, 0xe3, 0x66, 0xad, 0x39, 0x9a, - 0x31, 0x33, 0xbf, 0xfd, 0xa8, 0x3e, 0x77, 0x09, - 0xda, 0x7d, 0xe6, 0xbd, 0x39, 0x46, 0x22, 0x11, - 0x74, 0x5d, 0x27, 0x95, 0x4a, 0xd9, 0xc6, 0xbb, - 0xc7, 0x7e, 0x3d, 0xfa, 0x9e, 0x05, 0xed, 0x3e, - 0x3b, 0xc1, 0x64, 0x32, 0x89, 0xa2, 0x28, 0x03, - 0x1b, 0xdb, 0xe9, 0x39, 0x3a, 0x0b, 0xea, 0xf5, - 0x3a, 0xe1, 0x70, 0x98, 0x40, 0x20, 0x60, 0xdd, - 0x9b, 0x79, 0x83, 0xe6, 0x0b, 0x0b, 0x0b, 0x1d, - 0xf3, 0xf3, 0x7e, 0x81, 0xa9, 0x78, 0x3c, 0x6e, - 0xc4, 0x62, 0x31, 0xb2, 0xd9, 0x6c, 0x4f, 0x70, - 0x9c, 0x16, 0x0c, 0x06, 0x3b, 0xbf, 0x8c, 0x2e, - 0xdd, 0x63, 0x78, 0xe1, 0x00, 0x4b, 0x4b, 0x4b, - 0x93, 0x03, 0x48, 0x24, 0x12, 0x13, 0x69, 0x0e, - 0xf0, 0x17, 0x0f, 0xb8, 0xff, 0x00, 0x00, 0x9b, - 0x1c, 0x54, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, - 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x6a, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xcd, 0x97, + 0xbf, 0x6f, 0x12, 0x61, 0x18, 0xc7, 0x3f, 0x6d, + 0xda, 0xe8, 0xd5, 0x91, 0x00, 0x0d, 0x42, 0x87, + 0x2e, 0x1a, 0x4d, 0xb0, 0x8b, 0x8b, 0x83, 0x0e, + 0x9a, 0xb8, 0x74, 0x30, 0xef, 0x68, 0x88, 0xc2, + 0x00, 0xff, 0x81, 0xfe, 0x05, 0x6e, 0xd5, 0xc1, + 0x11, 0x1a, 0x4c, 0x20, 0x4d, 0xdc, 0x6e, 0x6a, + 0x63, 0x62, 0x1b, 0x5c, 0xb4, 0xee, 0x0c, 0xb4, + 0x25, 0x1a, 0x87, 0xd2, 0xa4, 0x80, 0x28, 0xd2, + 0xb4, 0x94, 0x72, 0xf7, 0x9e, 0x03, 0xb9, 0x93, + 0x1f, 0x47, 0x39, 0x0c, 0x94, 0x3e, 0xc9, 0xe5, + 0xbd, 0xf7, 0xf9, 0xf1, 0x7d, 0x3e, 0xe1, 0xe5, + 0xde, 0xf7, 0x6e, 0x2a, 0x1e, 0x8f, 0x1b, 0x4c, + 0xd0, 0x66, 0x00, 0x62, 0xb1, 0xd8, 0x44, 0x9a, + 0x27, 0x12, 0x89, 0x16, 0x00, 0x40, 0xa5, 0x52, + 0xb9, 0xd0, 0xe6, 0x2e, 0x97, 0x0b, 0xe0, 0x1f, + 0x80, 0x61, 0x4c, 0x66, 0x25, 0xfe, 0x0b, 0xc0, + 0xed, 0x76, 0xdb, 0xfa, 0xcb, 0xe5, 0xf2, 0xf8, + 0x01, 0x3c, 0x1e, 0x0f, 0xaa, 0xaa, 0xda, 0xc6, + 0x84, 0x10, 0x94, 0x4a, 0xa5, 0xf1, 0x01, 0x78, + 0xbd, 0x5e, 0x54, 0x55, 0x45, 0x08, 0x41, 0x2e, + 0x97, 0xb3, 0xfc, 0xb5, 0x5a, 0x0d, 0x29, 0xa5, + 0x15, 0x2b, 0x16, 0x8b, 0xa3, 0x07, 0x98, 0x9f, + 0x9f, 0xb7, 0x1a, 0x54, 0xab, 0x55, 0x76, 0x77, + 0x77, 0x7b, 0x72, 0x7c, 0x3e, 0x9f, 0x95, 0x73, + 0x78, 0x78, 0x38, 0x1c, 0x80, 0x94, 0xd2, 0x51, + 0x41, 0xb5, 0x5a, 0x25, 0x93, 0xc9, 0x20, 0x84, + 0xe8, 0xf0, 0xab, 0xaa, 0xda, 0xa1, 0xe1, 0x54, + 0x6f, 0x6c, 0x4f, 0x81, 0x53, 0x3d, 0x47, 0x00, + 0x7e, 0xbf, 0x9f, 0xef, 0x1f, 0x02, 0xc0, 0x5b, + 0x34, 0x4d, 0x03, 0x60, 0x6f, 0x63, 0x91, 0x99, + 0xe9, 0x26, 0x00, 0x9a, 0x9c, 0x05, 0x5e, 0x5b, + 0xf9, 0x7b, 0xea, 0x75, 0x6e, 0x88, 0x03, 0x0a, + 0x85, 0xc2, 0x68, 0x00, 0x4c, 0x13, 0x42, 0x20, + 0xb5, 0x5f, 0x3c, 0x59, 0xbe, 0x0b, 0xf2, 0x23, + 0x86, 0xac, 0xb7, 0x6a, 0xe5, 0x31, 0x8b, 0x7a, + 0x0d, 0x43, 0xdb, 0x67, 0xca, 0x5f, 0x64, 0x67, + 0xab, 0xe9, 0x58, 0x73, 0x28, 0x00, 0x79, 0xb6, + 0x8f, 0x76, 0xb4, 0xcd, 0xbd, 0xc7, 0x2b, 0x00, + 0xdc, 0xb9, 0xe5, 0xe2, 0xcd, 0xcb, 0x9b, 0x3c, + 0x0a, 0x7f, 0xb1, 0x72, 0xbe, 0xaa, 0xcf, 0x38, + 0xfd, 0xad, 0x39, 0xd6, 0x9c, 0x6e, 0x07, 0xe8, + 0x77, 0x75, 0xdb, 0xb5, 0xb9, 0x59, 0x3e, 0xaf, + 0x3f, 0xe7, 0xdb, 0x8f, 0x3f, 0x00, 0xcc, 0x5d, + 0x9d, 0x66, 0x7d, 0xc5, 0xcb, 0xdc, 0x95, 0x56, + 0xbc, 0x79, 0xa2, 0x3b, 0xd6, 0x1c, 0xee, 0x4f, + 0x28, 0x1b, 0x03, 0x53, 0x8c, 0xc6, 0x01, 0x86, + 0x6e, 0x38, 0xd6, 0x1c, 0x0a, 0xc0, 0x5c, 0x73, + 0xa7, 0x36, 0x72, 0x80, 0x7e, 0x76, 0x72, 0x2a, + 0x59, 0x7e, 0xd1, 0xbb, 0xfb, 0x8d, 0x14, 0x40, + 0xab, 0x4b, 0xe4, 0xcf, 0x4f, 0xd0, 0x38, 0x60, + 0x33, 0x79, 0x1f, 0x8e, 0x0a, 0x6c, 0xbe, 0x7b, + 0x00, 0xc0, 0xf6, 0xfb, 0x87, 0xb6, 0x35, 0xa3, + 0x05, 0x38, 0xd5, 0xd9, 0xd9, 0x7a, 0x45, 0xf3, + 0x58, 0x47, 0x3f, 0x33, 0x68, 0x9e, 0xe8, 0xd6, + 0x5a, 0xf7, 0xb3, 0x91, 0x02, 0xdc, 0x7e, 0xea, + 0x6c, 0x6f, 0x1f, 0x0b, 0x40, 0x3e, 0x9f, 0x1f, + 0xba, 0xb9, 0x53, 0xbb, 0xbc, 0x6f, 0x44, 0xd1, + 0x68, 0x94, 0xd5, 0xd5, 0x55, 0x00, 0x42, 0xa1, + 0x90, 0xe5, 0x5f, 0x5b, 0x5b, 0x1b, 0x38, 0x37, + 0x6b, 0xcd, 0xb1, 0x3b, 0xde, 0x6e, 0xd6, 0x4e, + 0x28, 0xa5, 0xec, 0xb8, 0xda, 0x7d, 0x8a, 0xa2, + 0x90, 0x4e, 0xa7, 0x51, 0x14, 0xa5, 0x63, 0x9e, + 0x4e, 0xa7, 0x6d, 0xe3, 0x66, 0xad, 0x39, 0x9a, + 0x31, 0x33, 0xbf, 0xfd, 0xa8, 0x3e, 0x77, 0x09, + 0xda, 0x7d, 0xe6, 0xbd, 0x39, 0x46, 0x22, 0x11, + 0x74, 0x5d, 0x27, 0x95, 0x4a, 0xd9, 0xc6, 0xbb, + 0xc7, 0x7e, 0x3d, 0xfa, 0x9e, 0x05, 0xed, 0x3e, + 0x3b, 0xc1, 0x64, 0x32, 0x89, 0xa2, 0x28, 0x03, + 0x1b, 0xdb, 0xe9, 0x39, 0x3a, 0x0b, 0xea, 0xf5, + 0x3a, 0xe1, 0x70, 0x98, 0x40, 0x20, 0x60, 0xdd, + 0x9b, 0x79, 0x83, 0xe6, 0x0b, 0x0b, 0x0b, 0x1d, + 0xf3, 0xf3, 0x7e, 0x81, 0xa9, 0x78, 0x3c, 0x6e, + 0xc4, 0x62, 0x31, 0xb2, 0xd9, 0x6c, 0x4f, 0x70, + 0x9c, 0x16, 0x0c, 0x06, 0x3b, 0xbf, 0x8c, 0x2e, + 0xdd, 0x63, 0x78, 0xe1, 0x00, 0x4b, 0x4b, 0x4b, + 0x93, 0x03, 0x48, 0x24, 0x12, 0x13, 0x69, 0x0e, + 0xf0, 0x17, 0x0f, 0xb8, 0xff, 0x00, 0x00, 0x9b, + 0x1c, 0x54, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* no_logout_small.png - 670 bytes */ unsigned char no_logout_small_png[670] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xfa, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x93, - 0xbf, 0x6e, 0x13, 0x41, 0x10, 0x87, 0xbf, 0xdd, - 0xf5, 0x5e, 0x2e, 0x71, 0x4e, 0x21, 0xc4, 0x86, - 0x48, 0x16, 0x95, 0x93, 0x08, 0x6a, 0x0a, 0x78, - 0x01, 0x1e, 0x00, 0xa5, 0xa5, 0x00, 0x89, 0x8a, - 0x8a, 0x82, 0x07, 0xc8, 0x6b, 0xe4, 0x21, 0x5c, - 0x20, 0x5a, 0xa4, 0xd0, 0x45, 0xd4, 0xfc, 0x33, - 0x22, 0x4a, 0x0e, 0x9b, 0x22, 0x76, 0x48, 0x30, - 0xc2, 0xb1, 0xcf, 0xb9, 0xdb, 0x19, 0x8a, 0x03, - 0x47, 0x96, 0xd3, 0x65, 0xca, 0xd1, 0xea, 0xd3, - 0x37, 0xbf, 0x99, 0x35, 0xbb, 0xbb, 0xbb, 0xca, - 0x35, 0xaa, 0x02, 0xb0, 0xbd, 0xbd, 0x3d, 0xd3, - 0x8c, 0xe3, 0x18, 0x00, 0xe7, 0x1c, 0xaa, 0x25, - 0x5f, 0x55, 0x19, 0x8f, 0xc7, 0x33, 0xef, 0x5a, - 0xad, 0x56, 0x09, 0x10, 0x91, 0x69, 0xd3, 0x7b, - 0x4f, 0x9a, 0xa6, 0xa4, 0x69, 0x3a, 0x05, 0x8c, - 0x46, 0x23, 0x9a, 0xcd, 0x26, 0xcd, 0x66, 0x93, - 0x2c, 0xcb, 0xe6, 0x0d, 0x44, 0x04, 0x63, 0x0c, - 0xd6, 0x5a, 0xba, 0xdd, 0x2e, 0xf5, 0x7a, 0x9d, - 0x6a, 0xb5, 0xca, 0xd1, 0xd1, 0x11, 0xce, 0x39, - 0xbc, 0xf7, 0x74, 0x3a, 0x1d, 0x9c, 0x73, 0x34, - 0x1a, 0x0d, 0x8a, 0xa2, 0x98, 0x9a, 0x59, 0x80, - 0x10, 0x02, 0xaa, 0x4a, 0x9e, 0xe7, 0x0c, 0x06, - 0x03, 0xbc, 0xf7, 0xf4, 0x7a, 0x3d, 0x92, 0x24, - 0x21, 0x49, 0x12, 0xa2, 0x28, 0x22, 0x8e, 0x63, - 0xda, 0xed, 0x36, 0x22, 0x82, 0xaa, 0x12, 0x42, - 0x98, 0x35, 0x10, 0x11, 0x16, 0x97, 0x1b, 0x38, - 0x7b, 0xc0, 0x97, 0xcf, 0x1f, 0xd9, 0xbc, 0xf7, - 0x80, 0xdb, 0xb5, 0x32, 0x8b, 0xdf, 0x43, 0xd8, - 0x7b, 0xdb, 0xc2, 0x7b, 0x87, 0x5f, 0xac, 0x91, - 0xfd, 0xfa, 0x31, 0x3f, 0xc2, 0xad, 0x35, 0xcb, - 0xb7, 0xfd, 0x67, 0x48, 0xf5, 0x15, 0xd1, 0xe2, - 0x12, 0xe9, 0xfb, 0x17, 0x84, 0xd5, 0x0e, 0x00, - 0xc7, 0xc3, 0x0d, 0x6c, 0xf4, 0x14, 0xd1, 0x40, - 0x77, 0xff, 0x39, 0x1b, 0x0f, 0x77, 0xe8, 0x9f, - 0xc9, 0x2c, 0xa0, 0x62, 0x84, 0xe5, 0xca, 0x21, - 0x5b, 0xf7, 0xef, 0xa2, 0x45, 0x9f, 0x70, 0xe7, - 0x09, 0x56, 0x4e, 0x01, 0x21, 0x09, 0x4a, 0xd3, - 0x9e, 0x52, 0x91, 0x73, 0xbe, 0xbf, 0xdb, 0xc3, - 0xb1, 0x33, 0x0d, 0x7e, 0x0a, 0x50, 0x2c, 0xd1, - 0x42, 0xc2, 0x42, 0xe5, 0x84, 0xc9, 0xe0, 0x35, - 0x1e, 0x43, 0x91, 0xfd, 0x21, 0x1f, 0xf6, 0x29, - 0xce, 0xfb, 0x64, 0x3f, 0xbf, 0x52, 0xdb, 0x7c, - 0x04, 0xf9, 0x0d, 0x42, 0xd0, 0x79, 0x00, 0xd8, - 0x32, 0x59, 0x0d, 0xa8, 0x0a, 0xaa, 0x01, 0x95, - 0x09, 0x2a, 0x13, 0x24, 0x5c, 0x20, 0x41, 0x50, - 0xb9, 0xa0, 0x18, 0xe7, 0x20, 0x97, 0xab, 0xb7, - 0x97, 0x00, 0x03, 0x12, 0x20, 0x64, 0xff, 0xdb, - 0xb3, 0x65, 0x2c, 0x9a, 0x0f, 0xd0, 0x22, 0x03, - 0xcc, 0x55, 0x06, 0x60, 0x0c, 0xa8, 0xf3, 0x18, - 0x1b, 0xa1, 0xaa, 0xa8, 0x29, 0xad, 0x24, 0x14, - 0x84, 0x3c, 0x2b, 0x0d, 0x4d, 0x09, 0x9f, 0x01, - 0x94, 0x3b, 0x35, 0x84, 0xc9, 0x39, 0x66, 0xf4, - 0x09, 0x9f, 0x9f, 0x80, 0x31, 0x78, 0xaf, 0xc4, - 0x2b, 0xab, 0x48, 0x75, 0x89, 0x95, 0xb5, 0x75, - 0xe2, 0x9b, 0xeb, 0x80, 0x00, 0x57, 0xdc, 0x81, - 0xb1, 0x31, 0xc3, 0xe3, 0x03, 0xda, 0x6f, 0x5e, - 0x92, 0x8f, 0x26, 0x14, 0x63, 0xd0, 0x50, 0x6a, - 0x19, 0x63, 0xc1, 0x38, 0x40, 0x19, 0x9d, 0xf5, - 0xb0, 0x95, 0x68, 0x7e, 0x84, 0xca, 0x42, 0x9d, - 0xad, 0xc7, 0x1f, 0x90, 0x50, 0x80, 0x9a, 0x7f, - 0x81, 0xce, 0xc6, 0xa0, 0x80, 0x75, 0x8e, 0xa8, - 0x5a, 0x43, 0xe4, 0xb8, 0x1c, 0xfb, 0xba, 0xdf, - 0xf9, 0x2f, 0x3a, 0x55, 0x2a, 0x94, 0x2f, 0xb5, - 0x3d, 0x36, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, - 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xfa, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x93, + 0xbf, 0x6e, 0x13, 0x41, 0x10, 0x87, 0xbf, 0xdd, + 0xf5, 0x5e, 0x2e, 0x71, 0x4e, 0x21, 0xc4, 0x86, + 0x48, 0x16, 0x95, 0x93, 0x08, 0x6a, 0x0a, 0x78, + 0x01, 0x1e, 0x00, 0xa5, 0xa5, 0x00, 0x89, 0x8a, + 0x8a, 0x82, 0x07, 0xc8, 0x6b, 0xe4, 0x21, 0x5c, + 0x20, 0x5a, 0xa4, 0xd0, 0x45, 0xd4, 0xfc, 0x33, + 0x22, 0x4a, 0x0e, 0x9b, 0x22, 0x76, 0x48, 0x30, + 0xc2, 0xb1, 0xcf, 0xb9, 0xdb, 0x19, 0x8a, 0x03, + 0x47, 0x96, 0xd3, 0x65, 0xca, 0xd1, 0xea, 0xd3, + 0x37, 0xbf, 0x99, 0x35, 0xbb, 0xbb, 0xbb, 0xca, + 0x35, 0xaa, 0x02, 0xb0, 0xbd, 0xbd, 0x3d, 0xd3, + 0x8c, 0xe3, 0x18, 0x00, 0xe7, 0x1c, 0xaa, 0x25, + 0x5f, 0x55, 0x19, 0x8f, 0xc7, 0x33, 0xef, 0x5a, + 0xad, 0x56, 0x09, 0x10, 0x91, 0x69, 0xd3, 0x7b, + 0x4f, 0x9a, 0xa6, 0xa4, 0x69, 0x3a, 0x05, 0x8c, + 0x46, 0x23, 0x9a, 0xcd, 0x26, 0xcd, 0x66, 0x93, + 0x2c, 0xcb, 0xe6, 0x0d, 0x44, 0x04, 0x63, 0x0c, + 0xd6, 0x5a, 0xba, 0xdd, 0x2e, 0xf5, 0x7a, 0x9d, + 0x6a, 0xb5, 0xca, 0xd1, 0xd1, 0x11, 0xce, 0x39, + 0xbc, 0xf7, 0x74, 0x3a, 0x1d, 0x9c, 0x73, 0x34, + 0x1a, 0x0d, 0x8a, 0xa2, 0x98, 0x9a, 0x59, 0x80, + 0x10, 0x02, 0xaa, 0x4a, 0x9e, 0xe7, 0x0c, 0x06, + 0x03, 0xbc, 0xf7, 0xf4, 0x7a, 0x3d, 0x92, 0x24, + 0x21, 0x49, 0x12, 0xa2, 0x28, 0x22, 0x8e, 0x63, + 0xda, 0xed, 0x36, 0x22, 0x82, 0xaa, 0x12, 0x42, + 0x98, 0x35, 0x10, 0x11, 0x16, 0x97, 0x1b, 0x38, + 0x7b, 0xc0, 0x97, 0xcf, 0x1f, 0xd9, 0xbc, 0xf7, + 0x80, 0xdb, 0xb5, 0x32, 0x8b, 0xdf, 0x43, 0xd8, + 0x7b, 0xdb, 0xc2, 0x7b, 0x87, 0x5f, 0xac, 0x91, + 0xfd, 0xfa, 0x31, 0x3f, 0xc2, 0xad, 0x35, 0xcb, + 0xb7, 0xfd, 0x67, 0x48, 0xf5, 0x15, 0xd1, 0xe2, + 0x12, 0xe9, 0xfb, 0x17, 0x84, 0xd5, 0x0e, 0x00, + 0xc7, 0xc3, 0x0d, 0x6c, 0xf4, 0x14, 0xd1, 0x40, + 0x77, 0xff, 0x39, 0x1b, 0x0f, 0x77, 0xe8, 0x9f, + 0xc9, 0x2c, 0xa0, 0x62, 0x84, 0xe5, 0xca, 0x21, + 0x5b, 0xf7, 0xef, 0xa2, 0x45, 0x9f, 0x70, 0xe7, + 0x09, 0x56, 0x4e, 0x01, 0x21, 0x09, 0x4a, 0xd3, + 0x9e, 0x52, 0x91, 0x73, 0xbe, 0xbf, 0xdb, 0xc3, + 0xb1, 0x33, 0x0d, 0x7e, 0x0a, 0x50, 0x2c, 0xd1, + 0x42, 0xc2, 0x42, 0xe5, 0x84, 0xc9, 0xe0, 0x35, + 0x1e, 0x43, 0x91, 0xfd, 0x21, 0x1f, 0xf6, 0x29, + 0xce, 0xfb, 0x64, 0x3f, 0xbf, 0x52, 0xdb, 0x7c, + 0x04, 0xf9, 0x0d, 0x42, 0xd0, 0x79, 0x00, 0xd8, + 0x32, 0x59, 0x0d, 0xa8, 0x0a, 0xaa, 0x01, 0x95, + 0x09, 0x2a, 0x13, 0x24, 0x5c, 0x20, 0x41, 0x50, + 0xb9, 0xa0, 0x18, 0xe7, 0x20, 0x97, 0xab, 0xb7, + 0x97, 0x00, 0x03, 0x12, 0x20, 0x64, 0xff, 0xdb, + 0xb3, 0x65, 0x2c, 0x9a, 0x0f, 0xd0, 0x22, 0x03, + 0xcc, 0x55, 0x06, 0x60, 0x0c, 0xa8, 0xf3, 0x18, + 0x1b, 0xa1, 0xaa, 0xa8, 0x29, 0xad, 0x24, 0x14, + 0x84, 0x3c, 0x2b, 0x0d, 0x4d, 0x09, 0x9f, 0x01, + 0x94, 0x3b, 0x35, 0x84, 0xc9, 0x39, 0x66, 0xf4, + 0x09, 0x9f, 0x9f, 0x80, 0x31, 0x78, 0xaf, 0xc4, + 0x2b, 0xab, 0x48, 0x75, 0x89, 0x95, 0xb5, 0x75, + 0xe2, 0x9b, 0xeb, 0x80, 0x00, 0x57, 0xdc, 0x81, + 0xb1, 0x31, 0xc3, 0xe3, 0x03, 0xda, 0x6f, 0x5e, + 0x92, 0x8f, 0x26, 0x14, 0x63, 0xd0, 0x50, 0x6a, + 0x19, 0x63, 0xc1, 0x38, 0x40, 0x19, 0x9d, 0xf5, + 0xb0, 0x95, 0x68, 0x7e, 0x84, 0xca, 0x42, 0x9d, + 0xad, 0xc7, 0x1f, 0x90, 0x50, 0x80, 0x9a, 0x7f, + 0x81, 0xce, 0xc6, 0xa0, 0x80, 0x75, 0x8e, 0xa8, + 0x5a, 0x43, 0xe4, 0xb8, 0x1c, 0xfb, 0xba, 0xdf, + 0xf9, 0x2f, 0x3a, 0x55, 0x2a, 0x94, 0x2f, 0xb5, + 0x3d, 0x36, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* no_pvp.png - 726 bytes */ unsigned char no_pvp_png[726] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x32, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xd5, 0x97, - 0x4d, 0x8b, 0xda, 0x50, 0x14, 0x86, 0x9f, 0x4c, - 0xed, 0x47, 0x16, 0x5d, 0x49, 0x85, 0x76, 0x61, - 0xad, 0x1b, 0xeb, 0x46, 0x84, 0xee, 0xfb, 0x17, - 0xba, 0x2d, 0x45, 0x34, 0x5d, 0x18, 0xf0, 0x37, - 0xd8, 0x55, 0xff, 0x84, 0x18, 0xa1, 0x88, 0xc8, - 0xd0, 0xfe, 0x80, 0x59, 0x74, 0x51, 0x28, 0xdd, - 0xcd, 0xae, 0x48, 0x3b, 0x0b, 0x0b, 0x62, 0xdb, - 0x41, 0xa8, 0xa3, 0x32, 0x58, 0x1d, 0x3f, 0x92, - 0xdc, 0x74, 0xa1, 0x49, 0x0d, 0xc6, 0x2a, 0xa2, - 0x66, 0x7a, 0x20, 0xdc, 0x9c, 0x93, 0xf7, 0x9e, - 0xf7, 0xe1, 0xde, 0x24, 0x24, 0x52, 0xb1, 0x58, - 0xb4, 0xf0, 0x31, 0x02, 0x00, 0xaa, 0xaa, 0xfa, - 0x62, 0xae, 0x69, 0xda, 0x0c, 0x00, 0xa0, 0xdb, - 0xed, 0x1e, 0xd4, 0x3c, 0x18, 0x0c, 0x02, 0xfc, - 0x05, 0xb0, 0x2c, 0x7f, 0x76, 0xe2, 0xff, 0x00, - 0x08, 0x85, 0x42, 0x5b, 0x35, 0x6f, 0xb7, 0xdb, - 0xbb, 0x01, 0x00, 0x28, 0xfc, 0x7a, 0x45, 0x9f, - 0x0e, 0x00, 0xbd, 0xc9, 0x25, 0x03, 0x31, 0x80, - 0xdb, 0x63, 0x74, 0x49, 0x67, 0xca, 0x10, 0x80, - 0xe9, 0xb3, 0x96, 0xa3, 0x3f, 0x3e, 0x6d, 0x6d, - 0xb4, 0xaa, 0x1b, 0x03, 0xf4, 0xe9, 0xf0, 0xf2, - 0x5e, 0x9e, 0xde, 0xf8, 0x02, 0xee, 0xe2, 0xc0, - 0x34, 0xa8, 0x01, 0x30, 0x34, 0xfb, 0x7c, 0xa8, - 0x9c, 0xf0, 0xfc, 0x4d, 0x90, 0xb7, 0x1f, 0xbf, - 0x6c, 0xd4, 0xd3, 0x05, 0x20, 0x84, 0xf8, 0xa7, - 0xb0, 0x37, 0xb9, 0xa4, 0x37, 0xbe, 0xe0, 0xf5, - 0xcf, 0x2c, 0x13, 0xcb, 0x98, 0x15, 0x8f, 0x04, - 0x42, 0xd2, 0x1d, 0x8d, 0x74, 0x36, 0x00, 0x82, - 0x4e, 0xbe, 0xae, 0xa7, 0x0b, 0x60, 0x1d, 0xed, - 0x40, 0x0c, 0xe8, 0xd3, 0x61, 0x62, 0x19, 0xe8, - 0xe6, 0xdc, 0xd4, 0x04, 0x2b, 0x60, 0xce, 0x1a, - 0x1d, 0xdd, 0xe0, 0xfb, 0xd7, 0x80, 0x6b, 0xce, - 0x4e, 0xb7, 0xe0, 0x4a, 0x1f, 0xd0, 0xa0, 0xe6, - 0x98, 0x1b, 0xd6, 0x1c, 0x42, 0x07, 0x21, 0x19, - 0x0b, 0x9d, 0xf6, 0x04, 0x30, 0x11, 0xbf, 0x19, - 0x9a, 0x7d, 0xb7, 0x39, 0x73, 0x73, 0x40, 0x37, - 0x8c, 0x3d, 0x03, 0x48, 0xd3, 0x95, 0xe6, 0x4e, - 0x6e, 0xb8, 0xf7, 0x7c, 0xa7, 0x00, 0x42, 0xd2, - 0xe9, 0x5c, 0xb5, 0x79, 0x14, 0x7c, 0x08, 0x80, - 0xbe, 0x70, 0xf3, 0xd9, 0x11, 0x79, 0xff, 0x09, - 0x9e, 0x3e, 0xde, 0x0f, 0xc0, 0xad, 0x9b, 0x26, - 0x9f, 0xcf, 0x4f, 0x00, 0x98, 0xfc, 0xf0, 0xd0, - 0x9e, 0xc3, 0x1d, 0x71, 0xdf, 0x55, 0xda, 0x29, - 0xc0, 0xbb, 0xc8, 0x37, 0x88, 0xcc, 0x93, 0x27, - 0xde, 0x9a, 0x17, 0xd5, 0x07, 0xfb, 0x01, 0x68, - 0x34, 0x1a, 0x6b, 0x1b, 0x45, 0xa3, 0xd1, 0xa5, - 0xda, 0x4e, 0x57, 0x60, 0x9b, 0xf0, 0x05, 0xc0, - 0x7e, 0x0d, 0xfb, 0x02, 0x70, 0x7c, 0xda, 0x72, - 0xe5, 0x07, 0x05, 0xa8, 0xd7, 0xeb, 0x5b, 0xcd, - 0xbb, 0xbe, 0x1f, 0x24, 0xa9, 0x54, 0x0a, 0x80, - 0x78, 0x3c, 0x4e, 0x3e, 0x9f, 0x77, 0x72, 0x80, - 0x6a, 0xb5, 0xba, 0xa4, 0xb3, 0xeb, 0xd9, 0x6c, - 0x96, 0x52, 0xa9, 0xe4, 0x8c, 0xab, 0xe6, 0xd9, - 0x71, 0x64, 0x9f, 0x08, 0x21, 0x5c, 0x87, 0x2c, - 0xcb, 0x54, 0x2a, 0x15, 0x9a, 0xcd, 0xa6, 0x2b, - 0x97, 0x65, 0xd9, 0x53, 0x67, 0xd7, 0xed, 0x5e, - 0xf6, 0xb8, 0x6a, 0xde, 0xda, 0x15, 0x58, 0xac, - 0x79, 0x8d, 0x99, 0x4c, 0x06, 0x49, 0x92, 0xb0, - 0x2c, 0x8b, 0x74, 0x3a, 0xbd, 0x52, 0x37, 0x1a, - 0x8d, 0x96, 0xae, 0x2f, 0xc6, 0xd6, 0x00, 0xe5, - 0x72, 0x19, 0x80, 0x5c, 0x2e, 0x47, 0xa1, 0x50, - 0x58, 0xa9, 0x93, 0x65, 0x79, 0xe9, 0xfa, 0x56, - 0x00, 0xa3, 0xd1, 0x08, 0x45, 0x51, 0x3c, 0xb5, - 0x8b, 0x79, 0x38, 0x1c, 0x46, 0x51, 0x14, 0x62, - 0xb1, 0xd8, 0x12, 0x90, 0x57, 0x48, 0xc5, 0x62, - 0xd1, 0x52, 0x55, 0x95, 0x5a, 0xad, 0xb6, 0x52, - 0xb4, 0x8f, 0x48, 0x24, 0x12, 0xee, 0x3f, 0xa3, - 0x6b, 0xf7, 0x18, 0x1e, 0x1c, 0x20, 0x99, 0x4c, - 0xfa, 0x07, 0xa0, 0x69, 0x9a, 0x2f, 0xe6, 0x00, - 0x7f, 0x00, 0xd2, 0xb3, 0xb0, 0xfd, 0xb0, 0x5a, - 0x36, 0x94, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, - 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x32, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xd5, 0x97, + 0x4d, 0x8b, 0xda, 0x50, 0x14, 0x86, 0x9f, 0x4c, + 0xed, 0x47, 0x16, 0x5d, 0x49, 0x85, 0x76, 0x61, + 0xad, 0x1b, 0xeb, 0x46, 0x84, 0xee, 0xfb, 0x17, + 0xba, 0x2d, 0x45, 0x34, 0x5d, 0x18, 0xf0, 0x37, + 0xd8, 0x55, 0xff, 0x84, 0x18, 0xa1, 0x88, 0xc8, + 0xd0, 0xfe, 0x80, 0x59, 0x74, 0x51, 0x28, 0xdd, + 0xcd, 0xae, 0x48, 0x3b, 0x0b, 0x0b, 0x62, 0xdb, + 0x41, 0xa8, 0xa3, 0x32, 0x58, 0x1d, 0x3f, 0x92, + 0xdc, 0x74, 0xa1, 0x49, 0x0d, 0xc6, 0x2a, 0xa2, + 0x66, 0x7a, 0x20, 0xdc, 0x9c, 0x93, 0xf7, 0x9e, + 0xf7, 0xe1, 0xde, 0x24, 0x24, 0x52, 0xb1, 0x58, + 0xb4, 0xf0, 0x31, 0x02, 0x00, 0xaa, 0xaa, 0xfa, + 0x62, 0xae, 0x69, 0xda, 0x0c, 0x00, 0xa0, 0xdb, + 0xed, 0x1e, 0xd4, 0x3c, 0x18, 0x0c, 0x02, 0xfc, + 0x05, 0xb0, 0x2c, 0x7f, 0x76, 0xe2, 0xff, 0x00, + 0x08, 0x85, 0x42, 0x5b, 0x35, 0x6f, 0xb7, 0xdb, + 0xbb, 0x01, 0x00, 0x28, 0xfc, 0x7a, 0x45, 0x9f, + 0x0e, 0x00, 0xbd, 0xc9, 0x25, 0x03, 0x31, 0x80, + 0xdb, 0x63, 0x74, 0x49, 0x67, 0xca, 0x10, 0x80, + 0xe9, 0xb3, 0x96, 0xa3, 0x3f, 0x3e, 0x6d, 0x6d, + 0xb4, 0xaa, 0x1b, 0x03, 0xf4, 0xe9, 0xf0, 0xf2, + 0x5e, 0x9e, 0xde, 0xf8, 0x02, 0xee, 0xe2, 0xc0, + 0x34, 0xa8, 0x01, 0x30, 0x34, 0xfb, 0x7c, 0xa8, + 0x9c, 0xf0, 0xfc, 0x4d, 0x90, 0xb7, 0x1f, 0xbf, + 0x6c, 0xd4, 0xd3, 0x05, 0x20, 0x84, 0xf8, 0xa7, + 0xb0, 0x37, 0xb9, 0xa4, 0x37, 0xbe, 0xe0, 0xf5, + 0xcf, 0x2c, 0x13, 0xcb, 0x98, 0x15, 0x8f, 0x04, + 0x42, 0xd2, 0x1d, 0x8d, 0x74, 0x36, 0x00, 0x82, + 0x4e, 0xbe, 0xae, 0xa7, 0x0b, 0x60, 0x1d, 0xed, + 0x40, 0x0c, 0xe8, 0xd3, 0x61, 0x62, 0x19, 0xe8, + 0xe6, 0xdc, 0xd4, 0x04, 0x2b, 0x60, 0xce, 0x1a, + 0x1d, 0xdd, 0xe0, 0xfb, 0xd7, 0x80, 0x6b, 0xce, + 0x4e, 0xb7, 0xe0, 0x4a, 0x1f, 0xd0, 0xa0, 0xe6, + 0x98, 0x1b, 0xd6, 0x1c, 0x42, 0x07, 0x21, 0x19, + 0x0b, 0x9d, 0xf6, 0x04, 0x30, 0x11, 0xbf, 0x19, + 0x9a, 0x7d, 0xb7, 0x39, 0x73, 0x73, 0x40, 0x37, + 0x8c, 0x3d, 0x03, 0x48, 0xd3, 0x95, 0xe6, 0x4e, + 0x6e, 0xb8, 0xf7, 0x7c, 0xa7, 0x00, 0x42, 0xd2, + 0xe9, 0x5c, 0xb5, 0x79, 0x14, 0x7c, 0x08, 0x80, + 0xbe, 0x70, 0xf3, 0xd9, 0x11, 0x79, 0xff, 0x09, + 0x9e, 0x3e, 0xde, 0x0f, 0xc0, 0xad, 0x9b, 0x26, + 0x9f, 0xcf, 0x4f, 0x00, 0x98, 0xfc, 0xf0, 0xd0, + 0x9e, 0xc3, 0x1d, 0x71, 0xdf, 0x55, 0xda, 0x29, + 0xc0, 0xbb, 0xc8, 0x37, 0x88, 0xcc, 0x93, 0x27, + 0xde, 0x9a, 0x17, 0xd5, 0x07, 0xfb, 0x01, 0x68, + 0x34, 0x1a, 0x6b, 0x1b, 0x45, 0xa3, 0xd1, 0xa5, + 0xda, 0x4e, 0x57, 0x60, 0x9b, 0xf0, 0x05, 0xc0, + 0x7e, 0x0d, 0xfb, 0x02, 0x70, 0x7c, 0xda, 0x72, + 0xe5, 0x07, 0x05, 0xa8, 0xd7, 0xeb, 0x5b, 0xcd, + 0xbb, 0xbe, 0x1f, 0x24, 0xa9, 0x54, 0x0a, 0x80, + 0x78, 0x3c, 0x4e, 0x3e, 0x9f, 0x77, 0x72, 0x80, + 0x6a, 0xb5, 0xba, 0xa4, 0xb3, 0xeb, 0xd9, 0x6c, + 0x96, 0x52, 0xa9, 0xe4, 0x8c, 0xab, 0xe6, 0xd9, + 0x71, 0x64, 0x9f, 0x08, 0x21, 0x5c, 0x87, 0x2c, + 0xcb, 0x54, 0x2a, 0x15, 0x9a, 0xcd, 0xa6, 0x2b, + 0x97, 0x65, 0xd9, 0x53, 0x67, 0xd7, 0xed, 0x5e, + 0xf6, 0xb8, 0x6a, 0xde, 0xda, 0x15, 0x58, 0xac, + 0x79, 0x8d, 0x99, 0x4c, 0x06, 0x49, 0x92, 0xb0, + 0x2c, 0x8b, 0x74, 0x3a, 0xbd, 0x52, 0x37, 0x1a, + 0x8d, 0x96, 0xae, 0x2f, 0xc6, 0xd6, 0x00, 0xe5, + 0x72, 0x19, 0x80, 0x5c, 0x2e, 0x47, 0xa1, 0x50, + 0x58, 0xa9, 0x93, 0x65, 0x79, 0xe9, 0xfa, 0x56, + 0x00, 0xa3, 0xd1, 0x08, 0x45, 0x51, 0x3c, 0xb5, + 0x8b, 0x79, 0x38, 0x1c, 0x46, 0x51, 0x14, 0x62, + 0xb1, 0xd8, 0x12, 0x90, 0x57, 0x48, 0xc5, 0x62, + 0xd1, 0x52, 0x55, 0x95, 0x5a, 0xad, 0xb6, 0x52, + 0xb4, 0x8f, 0x48, 0x24, 0x12, 0xee, 0x3f, 0xa3, + 0x6b, 0xf7, 0x18, 0x1e, 0x1c, 0x20, 0x99, 0x4c, + 0xfa, 0x07, 0xa0, 0x69, 0x9a, 0x2f, 0xe6, 0x00, + 0x7f, 0x00, 0xd2, 0xb3, 0xb0, 0xfd, 0xb0, 0x5a, + 0x36, 0x94, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* no_pvp_small.png - 630 bytes */ unsigned char no_pvp_small_png[630] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xd2, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0xd2, - 0xbd, 0x6b, 0x53, 0x51, 0x18, 0xc7, 0xf1, 0xef, - 0x73, 0xce, 0xcd, 0xed, 0x4d, 0x1b, 0x6c, 0xd3, - 0x10, 0xeb, 0x28, 0x38, 0xba, 0x39, 0x38, 0x16, - 0x04, 0x41, 0x97, 0x0e, 0xd2, 0xa5, 0x83, 0xff, - 0x83, 0xe8, 0xff, 0xa0, 0x9b, 0x93, 0x2e, 0x99, - 0xc4, 0x3f, 0xa0, 0xa3, 0x28, 0x2e, 0x2e, 0x0a, - 0x06, 0x27, 0x5f, 0x40, 0x50, 0x90, 0x8a, 0xda, - 0x36, 0x36, 0xd1, 0x9a, 0x97, 0xdb, 0x24, 0xf7, - 0x9c, 0xe7, 0x71, 0xc8, 0x10, 0xac, 0x69, 0x06, - 0xfd, 0xc1, 0xe1, 0x4c, 0xe7, 0xc3, 0xf3, 0x72, - 0xa4, 0xd1, 0x68, 0x18, 0xff, 0x91, 0x04, 0x60, - 0x73, 0x73, 0xf3, 0x9f, 0x1e, 0x6f, 0x6f, 0x6f, - 0x4f, 0x00, 0x55, 0xa5, 0x5e, 0xaf, 0x93, 0x6b, - 0x8f, 0xc2, 0xc6, 0x00, 0x44, 0x53, 0x10, 0x43, - 0x10, 0xcc, 0x1b, 0xbe, 0x2b, 0x68, 0xdf, 0x90, - 0x4c, 0x58, 0x5e, 0xa9, 0xd1, 0xee, 0x74, 0xa6, - 0x15, 0xa8, 0x2a, 0xb9, 0xf6, 0x78, 0xd0, 0xbe, - 0x4d, 0xa5, 0x74, 0x8a, 0x10, 0x94, 0x83, 0xe2, - 0x80, 0x58, 0xca, 0xe9, 0xbb, 0x9f, 0x84, 0x95, - 0x82, 0x1f, 0x4f, 0x77, 0xb1, 0xbb, 0x7b, 0x8c, - 0x8b, 0xc0, 0xfd, 0x27, 0x6f, 0x50, 0xb5, 0x29, - 0x10, 0x63, 0x64, 0x64, 0x47, 0x94, 0xfd, 0x12, - 0x97, 0x17, 0xb7, 0x68, 0xf6, 0x9e, 0x51, 0xcd, - 0x4e, 0x13, 0x64, 0x44, 0xcb, 0x76, 0x90, 0xae, - 0xe7, 0xd7, 0x95, 0x11, 0x17, 0x43, 0xc6, 0x87, - 0x7b, 0xfb, 0x04, 0x55, 0x62, 0xd4, 0x3f, 0x2b, - 0x50, 0x83, 0x6e, 0x31, 0xe0, 0x45, 0xef, 0x31, - 0x77, 0xbe, 0xdc, 0x60, 0x39, 0xa9, 0xe3, 0x45, - 0x70, 0xde, 0x70, 0x99, 0xe3, 0xf0, 0x53, 0xe0, - 0xfc, 0xfb, 0x73, 0x58, 0x32, 0xe9, 0x5f, 0xf5, - 0x18, 0x20, 0x06, 0xed, 0xb0, 0x47, 0x9a, 0x3a, - 0x56, 0xdd, 0x19, 0xca, 0xb2, 0x08, 0x80, 0xa9, - 0x92, 0x78, 0x18, 0x0f, 0x0a, 0xf2, 0xdc, 0x21, - 0xce, 0x66, 0x03, 0x86, 0xd1, 0x8b, 0xdf, 0x39, - 0x8c, 0x0b, 0x18, 0x60, 0xe8, 0xe4, 0xb6, 0x48, - 0x08, 0x86, 0x4a, 0xc4, 0x25, 0xd3, 0x0d, 0xcc, - 0x04, 0x46, 0x52, 0x20, 0x38, 0x9c, 0x77, 0xf8, - 0xa4, 0x84, 0x4a, 0x04, 0x04, 0x9f, 0x0a, 0x49, - 0x18, 0x23, 0xe3, 0x08, 0x72, 0x02, 0x80, 0xc0, - 0xee, 0xf0, 0x23, 0x25, 0x0d, 0xd4, 0x4a, 0x19, - 0x1a, 0x22, 0x88, 0x81, 0x80, 0xb9, 0x12, 0x67, - 0x5f, 0xf7, 0x59, 0xdb, 0xc9, 0xd9, 0x4f, 0xfd, - 0x6c, 0x60, 0xc9, 0x57, 0xd8, 0xa8, 0x5e, 0x87, - 0x7c, 0x84, 0x05, 0x4f, 0xec, 0x83, 0x38, 0xc0, - 0x41, 0xe8, 0x16, 0xbc, 0x6b, 0xbf, 0xa2, 0xeb, - 0x07, 0x08, 0x3a, 0x1b, 0x18, 0x74, 0x86, 0x5c, - 0x93, 0x9b, 0xb0, 0xc4, 0xe4, 0xac, 0x4d, 0xfb, - 0x4d, 0xd3, 0x94, 0x97, 0xeb, 0x8f, 0x68, 0x3e, - 0xbc, 0x05, 0x54, 0xfe, 0x06, 0x62, 0x8c, 0xb4, - 0x5a, 0xad, 0x13, 0xbf, 0x6c, 0x96, 0x65, 0x0c, - 0xf5, 0x88, 0xf2, 0xc2, 0x02, 0xbd, 0xe1, 0x64, - 0x08, 0x31, 0xc6, 0x63, 0x33, 0x98, 0x13, 0xef, - 0x3d, 0x59, 0xe2, 0x78, 0xfe, 0xf6, 0x2b, 0x95, - 0xd5, 0x3a, 0x89, 0x73, 0x33, 0x86, 0x38, 0x27, - 0xaa, 0xca, 0xa5, 0x8d, 0x2d, 0x2e, 0xac, 0x5f, - 0x25, 0xf1, 0x9e, 0xe5, 0x6a, 0x8d, 0xcf, 0xdf, - 0xf6, 0xa6, 0x40, 0xb3, 0xd9, 0x9c, 0x0b, 0xcc, - 0xcb, 0x6f, 0x46, 0x94, 0x02, 0xb6, 0xec, 0xfa, - 0x9a, 0xa9, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, - 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xd2, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0xd2, + 0xbd, 0x6b, 0x53, 0x51, 0x18, 0xc7, 0xf1, 0xef, + 0x73, 0xce, 0xcd, 0xed, 0x4d, 0x1b, 0x6c, 0xd3, + 0x10, 0xeb, 0x28, 0x38, 0xba, 0x39, 0x38, 0x16, + 0x04, 0x41, 0x97, 0x0e, 0xd2, 0xa5, 0x83, 0xff, + 0x83, 0xe8, 0xff, 0xa0, 0x9b, 0x93, 0x2e, 0x99, + 0xc4, 0x3f, 0xa0, 0xa3, 0x28, 0x2e, 0x2e, 0x0a, + 0x06, 0x27, 0x5f, 0x40, 0x50, 0x90, 0x8a, 0xda, + 0x36, 0x36, 0xd1, 0x9a, 0x97, 0xdb, 0x24, 0xf7, + 0x9c, 0xe7, 0x71, 0xc8, 0x10, 0xac, 0x69, 0x06, + 0xfd, 0xc1, 0xe1, 0x4c, 0xe7, 0xc3, 0xf3, 0x72, + 0xa4, 0xd1, 0x68, 0x18, 0xff, 0x91, 0x04, 0x60, + 0x73, 0x73, 0xf3, 0x9f, 0x1e, 0x6f, 0x6f, 0x6f, + 0x4f, 0x00, 0x55, 0xa5, 0x5e, 0xaf, 0x93, 0x6b, + 0x8f, 0xc2, 0xc6, 0x00, 0x44, 0x53, 0x10, 0x43, + 0x10, 0xcc, 0x1b, 0xbe, 0x2b, 0x68, 0xdf, 0x90, + 0x4c, 0x58, 0x5e, 0xa9, 0xd1, 0xee, 0x74, 0xa6, + 0x15, 0xa8, 0x2a, 0xb9, 0xf6, 0x78, 0xd0, 0xbe, + 0x4d, 0xa5, 0x74, 0x8a, 0x10, 0x94, 0x83, 0xe2, + 0x80, 0x58, 0xca, 0xe9, 0xbb, 0x9f, 0x84, 0x95, + 0x82, 0x1f, 0x4f, 0x77, 0xb1, 0xbb, 0x7b, 0x8c, + 0x8b, 0xc0, 0xfd, 0x27, 0x6f, 0x50, 0xb5, 0x29, + 0x10, 0x63, 0x64, 0x64, 0x47, 0x94, 0xfd, 0x12, + 0x97, 0x17, 0xb7, 0x68, 0xf6, 0x9e, 0x51, 0xcd, + 0x4e, 0x13, 0x64, 0x44, 0xcb, 0x76, 0x90, 0xae, + 0xe7, 0xd7, 0x95, 0x11, 0x17, 0x43, 0xc6, 0x87, + 0x7b, 0xfb, 0x04, 0x55, 0x62, 0xd4, 0x3f, 0x2b, + 0x50, 0x83, 0x6e, 0x31, 0xe0, 0x45, 0xef, 0x31, + 0x77, 0xbe, 0xdc, 0x60, 0x39, 0xa9, 0xe3, 0x45, + 0x70, 0xde, 0x70, 0x99, 0xe3, 0xf0, 0x53, 0xe0, + 0xfc, 0xfb, 0x73, 0x58, 0x32, 0xe9, 0x5f, 0xf5, + 0x18, 0x20, 0x06, 0xed, 0xb0, 0x47, 0x9a, 0x3a, + 0x56, 0xdd, 0x19, 0xca, 0xb2, 0x08, 0x80, 0xa9, + 0x92, 0x78, 0x18, 0x0f, 0x0a, 0xf2, 0xdc, 0x21, + 0xce, 0x66, 0x03, 0x86, 0xd1, 0x8b, 0xdf, 0x39, + 0x8c, 0x0b, 0x18, 0x60, 0xe8, 0xe4, 0xb6, 0x48, + 0x08, 0x86, 0x4a, 0xc4, 0x25, 0xd3, 0x0d, 0xcc, + 0x04, 0x46, 0x52, 0x20, 0x38, 0x9c, 0x77, 0xf8, + 0xa4, 0x84, 0x4a, 0x04, 0x04, 0x9f, 0x0a, 0x49, + 0x18, 0x23, 0xe3, 0x08, 0x72, 0x02, 0x80, 0xc0, + 0xee, 0xf0, 0x23, 0x25, 0x0d, 0xd4, 0x4a, 0x19, + 0x1a, 0x22, 0x88, 0x81, 0x80, 0xb9, 0x12, 0x67, + 0x5f, 0xf7, 0x59, 0xdb, 0xc9, 0xd9, 0x4f, 0xfd, + 0x6c, 0x60, 0xc9, 0x57, 0xd8, 0xa8, 0x5e, 0x87, + 0x7c, 0x84, 0x05, 0x4f, 0xec, 0x83, 0x38, 0xc0, + 0x41, 0xe8, 0x16, 0xbc, 0x6b, 0xbf, 0xa2, 0xeb, + 0x07, 0x08, 0x3a, 0x1b, 0x18, 0x74, 0x86, 0x5c, + 0x93, 0x9b, 0xb0, 0xc4, 0xe4, 0xac, 0x4d, 0xfb, + 0x4d, 0xd3, 0x94, 0x97, 0xeb, 0x8f, 0x68, 0x3e, + 0xbc, 0x05, 0x54, 0xfe, 0x06, 0x62, 0x8c, 0xb4, + 0x5a, 0xad, 0x13, 0xbf, 0x6c, 0x96, 0x65, 0x0c, + 0xf5, 0x88, 0xf2, 0xc2, 0x02, 0xbd, 0xe1, 0x64, + 0x08, 0x31, 0xc6, 0x63, 0x33, 0x98, 0x13, 0xef, + 0x3d, 0x59, 0xe2, 0x78, 0xfe, 0xf6, 0x2b, 0x95, + 0xd5, 0x3a, 0x89, 0x73, 0x33, 0x86, 0x38, 0x27, + 0xaa, 0xca, 0xa5, 0x8d, 0x2d, 0x2e, 0xac, 0x5f, + 0x25, 0xf1, 0x9e, 0xe5, 0x6a, 0x8d, 0xcf, 0xdf, + 0xf6, 0xa6, 0x40, 0xb3, 0xd9, 0x9c, 0x0b, 0xcc, + 0xcb, 0x6f, 0x46, 0x94, 0x02, 0xb6, 0xec, 0xfa, + 0x9a, 0xa9, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* optional_border.png - 768 bytes */ unsigned char optional_border_png[768] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x5c, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xd5, 0x97, - 0xbf, 0x6e, 0x13, 0x41, 0x10, 0x87, 0xbf, 0x59, - 0x3b, 0xc4, 0x07, 0x05, 0x91, 0x5c, 0x50, 0x44, - 0xc8, 0x81, 0x02, 0x2b, 0x02, 0x45, 0xe9, 0xe0, - 0x0d, 0xe8, 0x91, 0xe8, 0x22, 0xcb, 0x95, 0x5f, - 0x80, 0xd2, 0x65, 0x9e, 0xc2, 0x6e, 0x6c, 0x9d, - 0xf2, 0x04, 0xd4, 0x14, 0x50, 0xd2, 0xa6, 0xa2, - 0x42, 0x31, 0x50, 0x81, 0x02, 0x42, 0x22, 0x3a, - 0x92, 0xdc, 0xcd, 0x50, 0xec, 0xfd, 0x0b, 0x3e, - 0x88, 0x2d, 0x1d, 0x71, 0x18, 0xf9, 0x74, 0x3b, - 0xda, 0xb9, 0xfd, 0x7d, 0x33, 0xb3, 0xab, 0x95, - 0x65, 0x34, 0x1a, 0x19, 0x2b, 0xb4, 0x26, 0xc0, - 0x60, 0x30, 0x58, 0x89, 0xf8, 0x78, 0x3c, 0xf6, - 0x00, 0x00, 0xc7, 0xc7, 0xc7, 0x57, 0x2a, 0xde, - 0x6e, 0xb7, 0x01, 0x0a, 0x00, 0xb3, 0xd5, 0x74, - 0xe2, 0xff, 0x00, 0x78, 0xf7, 0xe1, 0x3b, 0x9f, - 0x3e, 0x47, 0xfc, 0x38, 0x55, 0x4e, 0xe3, 0x8a, - 0x80, 0xdf, 0x3e, 0x5d, 0x6b, 0xc2, 0x83, 0xcd, - 0x9b, 0x3c, 0xba, 0xb7, 0x51, 0x0f, 0xc0, 0xc7, - 0x2f, 0x11, 0x4f, 0x1f, 0x6f, 0xd2, 0x6a, 0xb5, - 0x10, 0x69, 0x60, 0xa9, 0xa6, 0x02, 0x20, 0x98, - 0x81, 0x59, 0xe6, 0x1b, 0x49, 0x7c, 0xce, 0xcb, - 0x37, 0xef, 0x79, 0xb8, 0x75, 0xbb, 0x1e, 0x80, - 0x93, 0x9f, 0xca, 0xfa, 0x7a, 0x8b, 0xf0, 0xf5, - 0x37, 0x92, 0xc4, 0x88, 0x55, 0xfd, 0x3b, 0x51, - 0xe2, 0xc4, 0x48, 0x52, 0x3f, 0x51, 0x43, 0xd5, - 0x78, 0xf1, 0x7c, 0x8b, 0x44, 0x17, 0x6b, 0x6b, - 0x0e, 0xa0, 0xaa, 0x7f, 0x0c, 0x3a, 0x8b, 0x0d, - 0xe7, 0x1a, 0x08, 0x02, 0x62, 0xfe, 0x9d, 0xd6, - 0x5d, 0x24, 0x0d, 0x12, 0x3f, 0x16, 0x01, 0x55, - 0x3f, 0xfd, 0xb7, 0x35, 0xe7, 0x00, 0x2e, 0xa3, - 0xcd, 0x96, 0xca, 0xf5, 0x04, 0x44, 0x04, 0xc1, - 0x70, 0x22, 0x98, 0x80, 0x09, 0x38, 0x07, 0x96, - 0x36, 0x69, 0xa9, 0x0a, 0x2c, 0x02, 0x90, 0x8b, - 0x8a, 0x21, 0x22, 0x38, 0x31, 0xd4, 0x09, 0x62, - 0xe0, 0x04, 0x70, 0xa0, 0x56, 0xac, 0x55, 0x2b, - 0x80, 0x59, 0x21, 0x5e, 0x64, 0x2c, 0x34, 0x52, - 0x61, 0x00, 0x31, 0xff, 0x60, 0x52, 0x33, 0x80, - 0x65, 0x00, 0x1e, 0xc2, 0x39, 0x1f, 0x6f, 0x4e, - 0x8a, 0x13, 0x28, 0x60, 0x0a, 0x2e, 0x6f, 0x52, - 0x8d, 0x00, 0x86, 0x07, 0x28, 0x32, 0x37, 0x5c, - 0x49, 0x5c, 0xf0, 0x99, 0xab, 0x88, 0x07, 0xab, - 0x1b, 0x00, 0x8a, 0x0a, 0xf8, 0x5e, 0x17, 0x59, - 0x0a, 0x69, 0x6b, 0xcc, 0x70, 0x66, 0x58, 0x56, - 0xfe, 0x3a, 0x01, 0xcc, 0x2c, 0x17, 0x72, 0x0e, - 0xbf, 0x23, 0xb3, 0xbe, 0x8b, 0x20, 0x6a, 0x88, - 0x91, 0x8b, 0x67, 0x2d, 0xab, 0x0d, 0x20, 0xcb, - 0xc9, 0x09, 0x28, 0x65, 0x08, 0x41, 0xcd, 0x7c, - 0x65, 0xac, 0x5c, 0xfe, 0x9a, 0x37, 0xe1, 0xad, - 0x96, 0x03, 0x3d, 0xe7, 0xd9, 0x93, 0x0d, 0x90, - 0xac, 0xf7, 0x96, 0xfd, 0xe6, 0x70, 0xe3, 0xf8, - 0x8c, 0x66, 0x43, 0xea, 0x03, 0xd8, 0x6c, 0xaf, - 0xf1, 0xea, 0xed, 0x8c, 0xaf, 0x27, 0x09, 0x8b, - 0x5c, 0x9a, 0xcd, 0x06, 0xdc, 0x6d, 0xaf, 0xd5, - 0x07, 0x70, 0xff, 0xce, 0x8d, 0xcb, 0x55, 0x2b, - 0xac, 0xd6, 0x53, 0xf0, 0xaf, 0xec, 0x7a, 0x02, - 0xec, 0xed, 0xed, 0xe5, 0xe3, 0x83, 0x83, 0x83, - 0x85, 0xfd, 0xed, 0xed, 0x6d, 0x86, 0xc3, 0xe1, - 0xa5, 0xf1, 0x65, 0x73, 0xd9, 0x40, 0x55, 0xf3, - 0x27, 0x08, 0x02, 0xc2, 0x30, 0x24, 0x08, 0x82, - 0xa5, 0xfc, 0xa3, 0xa3, 0xa3, 0x0b, 0x7e, 0x18, - 0x86, 0x95, 0xf1, 0xe5, 0x6b, 0x3a, 0x07, 0x30, - 0xb3, 0xfc, 0x89, 0xa2, 0x88, 0x5e, 0xaf, 0x47, - 0xa7, 0xd3, 0x99, 0xbb, 0xd9, 0x96, 0x99, 0x1f, - 0x0e, 0x87, 0x95, 0xf1, 0xe5, 0x6a, 0x57, 0x02, - 0x04, 0x41, 0xc0, 0x74, 0x3a, 0x65, 0x36, 0x9b, - 0x55, 0x0a, 0x2c, 0x3a, 0xbf, 0xbf, 0xbf, 0x5f, - 0x19, 0x5f, 0x06, 0xa8, 0xdc, 0x03, 0x51, 0x14, - 0xd1, 0xef, 0xf7, 0x2f, 0x64, 0x54, 0xf6, 0xab, - 0x32, 0xee, 0xf7, 0xfb, 0x74, 0xbb, 0xdd, 0xb9, - 0xf8, 0xc9, 0x64, 0x52, 0xf9, 0x5d, 0x66, 0x32, - 0x1a, 0x8d, 0x6c, 0x30, 0x18, 0x70, 0x78, 0x78, - 0xc8, 0x55, 0xda, 0xce, 0xce, 0xce, 0xc5, 0x7f, - 0x46, 0xd7, 0xea, 0x18, 0xae, 0x04, 0x60, 0x77, - 0x77, 0x77, 0x75, 0x00, 0xe3, 0xf1, 0x78, 0x25, - 0xe2, 0x00, 0xbf, 0x00, 0xfa, 0xf6, 0xfe, 0x76, - 0xa8, 0x3c, 0x91, 0x36, 0x00, 0x00, 0x00, 0x00, - 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x5c, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xd5, 0x97, + 0xbf, 0x6e, 0x13, 0x41, 0x10, 0x87, 0xbf, 0x59, + 0x3b, 0xc4, 0x07, 0x05, 0x91, 0x5c, 0x50, 0x44, + 0xc8, 0x81, 0x02, 0x2b, 0x02, 0x45, 0xe9, 0xe0, + 0x0d, 0xe8, 0x91, 0xe8, 0x22, 0xcb, 0x95, 0x5f, + 0x80, 0xd2, 0x65, 0x9e, 0xc2, 0x6e, 0x6c, 0x9d, + 0xf2, 0x04, 0xd4, 0x14, 0x50, 0xd2, 0xa6, 0xa2, + 0x42, 0x31, 0x50, 0x81, 0x02, 0x42, 0x22, 0x3a, + 0x92, 0xdc, 0xcd, 0x50, 0xec, 0xfd, 0x0b, 0x3e, + 0x88, 0x2d, 0x1d, 0x71, 0x18, 0xf9, 0x74, 0x3b, + 0xda, 0xb9, 0xfd, 0x7d, 0x33, 0xb3, 0xab, 0x95, + 0x65, 0x34, 0x1a, 0x19, 0x2b, 0xb4, 0x26, 0xc0, + 0x60, 0x30, 0x58, 0x89, 0xf8, 0x78, 0x3c, 0xf6, + 0x00, 0x00, 0xc7, 0xc7, 0xc7, 0x57, 0x2a, 0xde, + 0x6e, 0xb7, 0x01, 0x0a, 0x00, 0xb3, 0xd5, 0x74, + 0xe2, 0xff, 0x00, 0x78, 0xf7, 0xe1, 0x3b, 0x9f, + 0x3e, 0x47, 0xfc, 0x38, 0x55, 0x4e, 0xe3, 0x8a, + 0x80, 0xdf, 0x3e, 0x5d, 0x6b, 0xc2, 0x83, 0xcd, + 0x9b, 0x3c, 0xba, 0xb7, 0x51, 0x0f, 0xc0, 0xc7, + 0x2f, 0x11, 0x4f, 0x1f, 0x6f, 0xd2, 0x6a, 0xb5, + 0x10, 0x69, 0x60, 0xa9, 0xa6, 0x02, 0x20, 0x98, + 0x81, 0x59, 0xe6, 0x1b, 0x49, 0x7c, 0xce, 0xcb, + 0x37, 0xef, 0x79, 0xb8, 0x75, 0xbb, 0x1e, 0x80, + 0x93, 0x9f, 0xca, 0xfa, 0x7a, 0x8b, 0xf0, 0xf5, + 0x37, 0x92, 0xc4, 0x88, 0x55, 0xfd, 0x3b, 0x51, + 0xe2, 0xc4, 0x48, 0x52, 0x3f, 0x51, 0x43, 0xd5, + 0x78, 0xf1, 0x7c, 0x8b, 0x44, 0x17, 0x6b, 0x6b, + 0x0e, 0xa0, 0xaa, 0x7f, 0x0c, 0x3a, 0x8b, 0x0d, + 0xe7, 0x1a, 0x08, 0x02, 0x62, 0xfe, 0x9d, 0xd6, + 0x5d, 0x24, 0x0d, 0x12, 0x3f, 0x16, 0x01, 0x55, + 0x3f, 0xfd, 0xb7, 0x35, 0xe7, 0x00, 0x2e, 0xa3, + 0xcd, 0x96, 0xca, 0xf5, 0x04, 0x44, 0x04, 0xc1, + 0x70, 0x22, 0x98, 0x80, 0x09, 0x38, 0x07, 0x96, + 0x36, 0x69, 0xa9, 0x0a, 0x2c, 0x02, 0x90, 0x8b, + 0x8a, 0x21, 0x22, 0x38, 0x31, 0xd4, 0x09, 0x62, + 0xe0, 0x04, 0x70, 0xa0, 0x56, 0xac, 0x55, 0x2b, + 0x80, 0x59, 0x21, 0x5e, 0x64, 0x2c, 0x34, 0x52, + 0x61, 0x00, 0x31, 0xff, 0x60, 0x52, 0x33, 0x80, + 0x65, 0x00, 0x1e, 0xc2, 0x39, 0x1f, 0x6f, 0x4e, + 0x8a, 0x13, 0x28, 0x60, 0x0a, 0x2e, 0x6f, 0x52, + 0x8d, 0x00, 0x86, 0x07, 0x28, 0x32, 0x37, 0x5c, + 0x49, 0x5c, 0xf0, 0x99, 0xab, 0x88, 0x07, 0xab, + 0x1b, 0x00, 0x8a, 0x0a, 0xf8, 0x5e, 0x17, 0x59, + 0x0a, 0x69, 0x6b, 0xcc, 0x70, 0x66, 0x58, 0x56, + 0xfe, 0x3a, 0x01, 0xcc, 0x2c, 0x17, 0x72, 0x0e, + 0xbf, 0x23, 0xb3, 0xbe, 0x8b, 0x20, 0x6a, 0x88, + 0x91, 0x8b, 0x67, 0x2d, 0xab, 0x0d, 0x20, 0xcb, + 0xc9, 0x09, 0x28, 0x65, 0x08, 0x41, 0xcd, 0x7c, + 0x65, 0xac, 0x5c, 0xfe, 0x9a, 0x37, 0xe1, 0xad, + 0x96, 0x03, 0x3d, 0xe7, 0xd9, 0x93, 0x0d, 0x90, + 0xac, 0xf7, 0x96, 0xfd, 0xe6, 0x70, 0xe3, 0xf8, + 0x8c, 0x66, 0x43, 0xea, 0x03, 0xd8, 0x6c, 0xaf, + 0xf1, 0xea, 0xed, 0x8c, 0xaf, 0x27, 0x09, 0x8b, + 0x5c, 0x9a, 0xcd, 0x06, 0xdc, 0x6d, 0xaf, 0xd5, + 0x07, 0x70, 0xff, 0xce, 0x8d, 0xcb, 0x55, 0x2b, + 0xac, 0xd6, 0x53, 0xf0, 0xaf, 0xec, 0x7a, 0x02, + 0xec, 0xed, 0xed, 0xe5, 0xe3, 0x83, 0x83, 0x83, + 0x85, 0xfd, 0xed, 0xed, 0x6d, 0x86, 0xc3, 0xe1, + 0xa5, 0xf1, 0x65, 0x73, 0xd9, 0x40, 0x55, 0xf3, + 0x27, 0x08, 0x02, 0xc2, 0x30, 0x24, 0x08, 0x82, + 0xa5, 0xfc, 0xa3, 0xa3, 0xa3, 0x0b, 0x7e, 0x18, + 0x86, 0x95, 0xf1, 0xe5, 0x6b, 0x3a, 0x07, 0x30, + 0xb3, 0xfc, 0x89, 0xa2, 0x88, 0x5e, 0xaf, 0x47, + 0xa7, 0xd3, 0x99, 0xbb, 0xd9, 0x96, 0x99, 0x1f, + 0x0e, 0x87, 0x95, 0xf1, 0xe5, 0x6a, 0x57, 0x02, + 0x04, 0x41, 0xc0, 0x74, 0x3a, 0x65, 0x36, 0x9b, + 0x55, 0x0a, 0x2c, 0x3a, 0xbf, 0xbf, 0xbf, 0x5f, + 0x19, 0x5f, 0x06, 0xa8, 0xdc, 0x03, 0x51, 0x14, + 0xd1, 0xef, 0xf7, 0x2f, 0x64, 0x54, 0xf6, 0xab, + 0x32, 0xee, 0xf7, 0xfb, 0x74, 0xbb, 0xdd, 0xb9, + 0xf8, 0xc9, 0x64, 0x52, 0xf9, 0x5d, 0x66, 0x32, + 0x1a, 0x8d, 0x6c, 0x30, 0x18, 0x70, 0x78, 0x78, + 0xc8, 0x55, 0xda, 0xce, 0xce, 0xce, 0xc5, 0x7f, + 0x46, 0xd7, 0xea, 0x18, 0xae, 0x04, 0x60, 0x77, + 0x77, 0x77, 0x75, 0x00, 0xe3, 0xf1, 0x78, 0x25, + 0xe2, 0x00, 0xbf, 0x00, 0xfa, 0xf6, 0xfe, 0x76, + 0xa8, 0x3c, 0x91, 0x36, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; /* End Of File */ /* optional_border_small.png - 544 bytes */ unsigned char optional_border_small_png[544] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x7c, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, - 0x31, 0x6e, 0x93, 0x41, 0x10, 0x85, 0xbf, 0x37, - 0xfb, 0xc7, 0x10, 0x90, 0x02, 0xb1, 0x28, 0x28, - 0xa0, 0xa0, 0xe0, 0x04, 0xe9, 0xe8, 0x38, 0x83, - 0x39, 0x08, 0xd7, 0x71, 0xc9, 0x01, 0x7c, 0x04, - 0x94, 0x12, 0x59, 0xb4, 0xd4, 0x28, 0x07, 0x08, - 0x02, 0x85, 0x48, 0x20, 0xff, 0xff, 0xcc, 0xa3, - 0x58, 0x3b, 0x21, 0xd8, 0x05, 0x82, 0x57, 0x6c, - 0xb1, 0x9a, 0x79, 0xef, 0x9b, 0xd9, 0xd5, 0x72, - 0xb9, 0x34, 0xff, 0xa1, 0x01, 0x60, 0xb1, 0x58, - 0xfc, 0x53, 0xf3, 0x6a, 0xb5, 0xea, 0x06, 0x55, - 0xc5, 0xa7, 0xcf, 0x5f, 0xb9, 0xbc, 0x1a, 0xd9, - 0xa4, 0x99, 0x0a, 0x04, 0xec, 0x4e, 0x76, 0x8c, - 0xea, 0xb5, 0x4f, 0xe7, 0x33, 0xce, 0x5e, 0xce, - 0x6f, 0x09, 0xaa, 0x8a, 0xcb, 0xab, 0x0d, 0xaf, - 0xcf, 0x9e, 0x71, 0xbd, 0x69, 0x08, 0x91, 0x98, - 0x32, 0xd8, 0x50, 0x86, 0x2a, 0x98, 0xca, 0x3c, - 0x79, 0x14, 0xbc, 0xff, 0x70, 0x41, 0x55, 0xdd, - 0x1a, 0x64, 0x26, 0x9b, 0x09, 0xae, 0x37, 0x8d, - 0x77, 0xe7, 0x5f, 0x98, 0x35, 0x18, 0xb3, 0x18, - 0xc7, 0x64, 0x4a, 0x33, 0x4e, 0x45, 0x96, 0xf9, - 0xf6, 0x7d, 0xc3, 0xdb, 0xc5, 0x0b, 0x5a, 0x6b, - 0x64, 0xe6, 0x5d, 0x82, 0x29, 0x21, 0xd4, 0x78, - 0x78, 0x2f, 0x38, 0x6a, 0x30, 0xa5, 0x18, 0x9b, - 0xa8, 0x2a, 0xc6, 0x14, 0x53, 0x19, 0x7b, 0x20, - 0xb4, 0xa5, 0xfa, 0x9d, 0xa0, 0xaa, 0x90, 0x20, - 0x29, 0x42, 0x22, 0x04, 0x21, 0x13, 0x01, 0xb6, - 0x08, 0x05, 0x4d, 0xa6, 0x45, 0x60, 0x0a, 0x5c, - 0xfb, 0x06, 0xde, 0x6e, 0x49, 0x12, 0x92, 0x09, - 0x89, 0x26, 0x41, 0xf4, 0x44, 0x80, 0x61, 0x10, - 0x42, 0x98, 0x03, 0x04, 0x6c, 0x17, 0x26, 0x41, - 0x44, 0x60, 0x17, 0xe1, 0x5e, 0xdc, 0x00, 0x64, - 0x86, 0x08, 0xa4, 0xfe, 0x32, 0x07, 0x08, 0x7a, - 0x4c, 0x8b, 0x3e, 0x82, 0x03, 0x9a, 0x85, 0xa0, - 0x8f, 0x15, 0x30, 0x0c, 0xbd, 0xc6, 0xf6, 0xbe, - 0x41, 0x95, 0xb1, 0x21, 0x04, 0x2d, 0xe8, 0x28, - 0xd0, 0x13, 0x0d, 0x14, 0xcc, 0x86, 0x7e, 0x7f, - 0x70, 0x89, 0x5b, 0x6b, 0x7e, 0x8e, 0x60, 0x09, - 0xa7, 0x99, 0x4a, 0x3d, 0xcd, 0xa6, 0x12, 0xc6, - 0x34, 0xae, 0x03, 0x23, 0x64, 0x26, 0x47, 0xcd, - 0x3c, 0x3e, 0x86, 0x37, 0xaf, 0x4e, 0xb1, 0xba, - 0x19, 0x86, 0xdd, 0x7a, 0xd9, 0x7e, 0xa8, 0x93, - 0xe3, 0x6e, 0xba, 0xf7, 0x0f, 0x4e, 0x1f, 0xc0, - 0xf9, 0xc7, 0x0b, 0x7e, 0x4c, 0x37, 0xf4, 0x7b, - 0x12, 0x50, 0x36, 0x27, 0xf7, 0x8b, 0x1d, 0xf4, - 0x8d, 0xc1, 0xf3, 0x39, 0x40, 0x1e, 0xee, 0x3c, - 0xa0, 0x3b, 0x23, 0xac, 0xd7, 0xeb, 0xbf, 0x6e, - 0xfc, 0x53, 0xbf, 0x00, 0xda, 0x66, 0xf7, 0x1a, - 0x90, 0x45, 0x16, 0xc5, 0x00, 0x00, 0x00, 0x00, - 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x7c, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, + 0x31, 0x6e, 0x93, 0x41, 0x10, 0x85, 0xbf, 0x37, + 0xfb, 0xc7, 0x10, 0x90, 0x02, 0xb1, 0x28, 0x28, + 0xa0, 0xa0, 0xe0, 0x04, 0xe9, 0xe8, 0x38, 0x83, + 0x39, 0x08, 0xd7, 0x71, 0xc9, 0x01, 0x7c, 0x04, + 0x94, 0x12, 0x59, 0xb4, 0xd4, 0x28, 0x07, 0x08, + 0x02, 0x85, 0x48, 0x20, 0xff, 0xff, 0xcc, 0xa3, + 0x58, 0x3b, 0x21, 0xd8, 0x05, 0x82, 0x57, 0x6c, + 0xb1, 0x9a, 0x79, 0xef, 0x9b, 0xd9, 0xd5, 0x72, + 0xb9, 0x34, 0xff, 0xa1, 0x01, 0x60, 0xb1, 0x58, + 0xfc, 0x53, 0xf3, 0x6a, 0xb5, 0xea, 0x06, 0x55, + 0xc5, 0xa7, 0xcf, 0x5f, 0xb9, 0xbc, 0x1a, 0xd9, + 0xa4, 0x99, 0x0a, 0x04, 0xec, 0x4e, 0x76, 0x8c, + 0xea, 0xb5, 0x4f, 0xe7, 0x33, 0xce, 0x5e, 0xce, + 0x6f, 0x09, 0xaa, 0x8a, 0xcb, 0xab, 0x0d, 0xaf, + 0xcf, 0x9e, 0x71, 0xbd, 0x69, 0x08, 0x91, 0x98, + 0x32, 0xd8, 0x50, 0x86, 0x2a, 0x98, 0xca, 0x3c, + 0x79, 0x14, 0xbc, 0xff, 0x70, 0x41, 0x55, 0xdd, + 0x1a, 0x64, 0x26, 0x9b, 0x09, 0xae, 0x37, 0x8d, + 0x77, 0xe7, 0x5f, 0x98, 0x35, 0x18, 0xb3, 0x18, + 0xc7, 0x64, 0x4a, 0x33, 0x4e, 0x45, 0x96, 0xf9, + 0xf6, 0x7d, 0xc3, 0xdb, 0xc5, 0x0b, 0x5a, 0x6b, + 0x64, 0xe6, 0x5d, 0x82, 0x29, 0x21, 0xd4, 0x78, + 0x78, 0x2f, 0x38, 0x6a, 0x30, 0xa5, 0x18, 0x9b, + 0xa8, 0x2a, 0xc6, 0x14, 0x53, 0x19, 0x7b, 0x20, + 0xb4, 0xa5, 0xfa, 0x9d, 0xa0, 0xaa, 0x90, 0x20, + 0x29, 0x42, 0x22, 0x04, 0x21, 0x13, 0x01, 0xb6, + 0x08, 0x05, 0x4d, 0xa6, 0x45, 0x60, 0x0a, 0x5c, + 0xfb, 0x06, 0xde, 0x6e, 0x49, 0x12, 0x92, 0x09, + 0x89, 0x26, 0x41, 0xf4, 0x44, 0x80, 0x61, 0x10, + 0x42, 0x98, 0x03, 0x04, 0x6c, 0x17, 0x26, 0x41, + 0x44, 0x60, 0x17, 0xe1, 0x5e, 0xdc, 0x00, 0x64, + 0x86, 0x08, 0xa4, 0xfe, 0x32, 0x07, 0x08, 0x7a, + 0x4c, 0x8b, 0x3e, 0x82, 0x03, 0x9a, 0x85, 0xa0, + 0x8f, 0x15, 0x30, 0x0c, 0xbd, 0xc6, 0xf6, 0xbe, + 0x41, 0x95, 0xb1, 0x21, 0x04, 0x2d, 0xe8, 0x28, + 0xd0, 0x13, 0x0d, 0x14, 0xcc, 0x86, 0x7e, 0x7f, + 0x70, 0x89, 0x5b, 0x6b, 0x7e, 0x8e, 0x60, 0x09, + 0xa7, 0x99, 0x4a, 0x3d, 0xcd, 0xa6, 0x12, 0xc6, + 0x34, 0xae, 0x03, 0x23, 0x64, 0x26, 0x47, 0xcd, + 0x3c, 0x3e, 0x86, 0x37, 0xaf, 0x4e, 0xb1, 0xba, + 0x19, 0x86, 0xdd, 0x7a, 0xd9, 0x7e, 0xa8, 0x93, + 0xe3, 0x6e, 0xba, 0xf7, 0x0f, 0x4e, 0x1f, 0xc0, + 0xf9, 0xc7, 0x0b, 0x7e, 0x4c, 0x37, 0xf4, 0x7b, + 0x12, 0x50, 0x36, 0x27, 0xf7, 0x8b, 0x1d, 0xf4, + 0x8d, 0xc1, 0xf3, 0x39, 0x40, 0x1e, 0xee, 0x3c, + 0xa0, 0x3b, 0x23, 0xac, 0xd7, 0xeb, 0xbf, 0x6e, + 0xfc, 0x53, 0xbf, 0x00, 0xda, 0x66, 0xf7, 0x1a, + 0x90, 0x45, 0x16, 0xc5, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; /* End Of File */ /* protection_zone.png - 961 bytes */ unsigned char protection_zone_png[961] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x03, 0x1d, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xcd, 0x96, - 0xdd, 0x4b, 0x1c, 0x57, 0x18, 0x87, 0x9f, 0x75, - 0xd6, 0xb5, 0x63, 0xb0, 0xa9, 0x75, 0xab, 0xf1, - 0xab, 0x49, 0xe3, 0x92, 0x1a, 0x82, 0xb0, 0xb4, - 0x14, 0x5a, 0x63, 0x3e, 0xf0, 0xa6, 0xf5, 0xaa, - 0xf9, 0x03, 0x44, 0xbc, 0x08, 0x5e, 0x85, 0xfc, - 0x05, 0x29, 0x04, 0x72, 0xe1, 0x6d, 0x21, 0xac, - 0x8b, 0x4b, 0x51, 0x59, 0xbc, 0xf0, 0xb2, 0x01, - 0xc1, 0xab, 0xf6, 0xaa, 0x42, 0x21, 0x15, 0x12, - 0x02, 0x22, 0xab, 0x33, 0xcc, 0x3a, 0xba, 0x54, - 0xd3, 0xd5, 0xec, 0x9a, 0x38, 0xbb, 0x33, 0x3b, - 0x67, 0x72, 0x61, 0x9d, 0xb8, 0xd1, 0x64, 0x67, - 0xd7, 0x4d, 0xb7, 0x3f, 0x38, 0x30, 0xe7, 0x3d, - 0xe7, 0xbc, 0xef, 0x73, 0xde, 0xf3, 0x35, 0xbe, - 0xc9, 0xc9, 0x49, 0x87, 0x1a, 0xca, 0x0f, 0x30, - 0x36, 0x36, 0x56, 0x93, 0xe0, 0xb1, 0x58, 0xec, - 0x00, 0x00, 0x20, 0x9d, 0x4e, 0xff, 0xa7, 0xc1, - 0x5b, 0x5a, 0x5a, 0x00, 0xde, 0x00, 0x38, 0x4e, - 0x6d, 0x56, 0xa2, 0xee, 0x28, 0xc0, 0xfb, 0x4a, - 0x30, 0x18, 0x3c, 0xd1, 0xf6, 0x2e, 0x7b, 0x29, - 0x7f, 0x87, 0xf2, 0x94, 0x81, 0xd6, 0xd6, 0x56, - 0x94, 0x85, 0x6e, 0x7a, 0x86, 0xf4, 0x22, 0xbb, - 0xf6, 0xfb, 0x05, 0xfc, 0x0d, 0x75, 0x74, 0x5d, - 0x55, 0x8b, 0xec, 0x89, 0x5f, 0x3b, 0xb8, 0x74, - 0x2b, 0xc5, 0xf6, 0xf6, 0x76, 0xc9, 0x0c, 0x94, - 0x04, 0x68, 0x6b, 0x6b, 0x73, 0x83, 0x2b, 0x0b, - 0xdd, 0xae, 0x5d, 0x6a, 0x90, 0xb8, 0x30, 0xa8, - 0x01, 0xb0, 0xb1, 0x78, 0x11, 0x80, 0x7c, 0xd6, - 0xc2, 0xce, 0xdb, 0x5c, 0xba, 0x95, 0xe2, 0xd9, - 0x2f, 0x9f, 0xd3, 0x77, 0x7b, 0x9d, 0xad, 0xad, - 0xad, 0xd3, 0x01, 0x1c, 0xd5, 0xdb, 0x19, 0x70, - 0xcc, 0xbf, 0x71, 0xec, 0xbd, 0x63, 0x19, 0xc8, - 0x6d, 0x3e, 0xc4, 0xca, 0xbd, 0xf2, 0xe4, 0xd7, - 0x05, 0x10, 0x42, 0x94, 0x04, 0xc8, 0x6d, 0x3e, - 0x44, 0x6a, 0x0c, 0xe1, 0xd4, 0xb5, 0xe0, 0x0f, - 0x34, 0xb3, 0x9f, 0x4e, 0xb2, 0xb7, 0x3e, 0x4f, - 0xf3, 0xf9, 0x1e, 0x7c, 0x46, 0x8a, 0x7c, 0x6e, - 0x07, 0x61, 0xed, 0x73, 0xe6, 0x93, 0x2b, 0xd8, - 0xf9, 0x7a, 0x4f, 0x7e, 0x2b, 0x3a, 0x05, 0xfe, - 0x40, 0x33, 0x05, 0x73, 0x97, 0xd4, 0x9f, 0x3f, - 0x93, 0x49, 0xfe, 0x45, 0x43, 0xe3, 0x8f, 0xf8, - 0xfd, 0x20, 0xac, 0x7d, 0x84, 0xf9, 0x12, 0x00, - 0xcb, 0x30, 0x3c, 0xf9, 0x2d, 0x1b, 0x40, 0xfa, - 0x28, 0xc4, 0xf3, 0xe5, 0x47, 0x28, 0x0b, 0x0f, - 0x5c, 0xdb, 0xca, 0xfc, 0x1c, 0x4d, 0xe7, 0xce, - 0xd2, 0x15, 0xfe, 0x16, 0x61, 0x99, 0x08, 0x3b, - 0xe3, 0xb6, 0x95, 0xf2, 0x5b, 0xf2, 0x18, 0xea, - 0xba, 0x4e, 0xcf, 0x90, 0xce, 0xc6, 0xe2, 0x45, - 0x02, 0x9f, 0xfe, 0x40, 0xc1, 0xdc, 0xa5, 0xb5, - 0x6f, 0x98, 0x60, 0xef, 0x35, 0xd7, 0x49, 0xbd, - 0x2c, 0xd3, 0xd9, 0xf7, 0x35, 0x76, 0xee, 0x15, - 0x67, 0x3b, 0xaf, 0xb1, 0x34, 0x37, 0x41, 0xff, - 0xbd, 0x0c, 0xba, 0xae, 0x57, 0xe7, 0x18, 0xc2, - 0xc1, 0x0e, 0xf7, 0x49, 0x4d, 0x98, 0x7b, 0x49, - 0xfc, 0x81, 0xbd, 0xa2, 0xe0, 0x00, 0x3e, 0xa9, - 0x1e, 0x2b, 0x9b, 0x2f, 0x6b, 0xf6, 0x65, 0x01, - 0x48, 0x0d, 0x52, 0x51, 0xbd, 0xa9, 0x23, 0x44, - 0x30, 0xd4, 0x49, 0x9d, 0xb3, 0xcf, 0x0b, 0x2d, - 0x81, 0x63, 0x5b, 0xd8, 0xe6, 0x2e, 0x00, 0xa2, - 0xe0, 0x78, 0x06, 0xf0, 0x74, 0x13, 0x6a, 0x9a, - 0x46, 0xf7, 0x8d, 0x04, 0x9b, 0x8f, 0xfb, 0x91, - 0xdb, 0xaf, 0xf3, 0x7c, 0xf9, 0x11, 0xcd, 0xe7, - 0x7b, 0xf0, 0xff, 0x8b, 0xff, 0x71, 0x47, 0x07, - 0xd9, 0x54, 0x8a, 0xcf, 0xbe, 0xbc, 0xc9, 0xd2, - 0xdc, 0x04, 0xdf, 0xfd, 0xf4, 0x0f, 0x9a, 0xa6, - 0x55, 0xef, 0x26, 0x04, 0x90, 0xa4, 0xc0, 0x01, - 0xb1, 0xbd, 0x83, 0xc8, 0x6f, 0xe0, 0x33, 0x0e, - 0x52, 0xef, 0xd8, 0x79, 0x84, 0x65, 0xba, 0xfd, - 0x44, 0xc1, 0x41, 0x92, 0x02, 0x9e, 0x37, 0xb5, - 0xe7, 0xb7, 0x40, 0x55, 0x55, 0xba, 0xae, 0xaa, - 0xa8, 0xbf, 0x7d, 0x43, 0xf0, 0xf2, 0xf7, 0xec, - 0x6c, 0x1b, 0xec, 0xac, 0x3e, 0x21, 0xa3, 0x27, - 0xb1, 0x0c, 0x87, 0xf6, 0xbe, 0x41, 0x1e, 0xcf, - 0x46, 0x18, 0xb8, 0x9f, 0x45, 0x55, 0xd5, 0xea, - 0xbe, 0x05, 0x87, 0x52, 0x14, 0xc5, 0xbd, 0x92, - 0xed, 0xbc, 0xcd, 0x17, 0xe1, 0xbb, 0x08, 0x3b, - 0xc3, 0xd2, 0xdc, 0x04, 0xca, 0xe2, 0x1f, 0x0c, - 0xdc, 0xcf, 0xa2, 0x28, 0x8a, 0xa7, 0x99, 0x57, - 0x04, 0x00, 0xb0, 0xb6, 0xb6, 0x46, 0x68, 0x48, - 0xc7, 0xb6, 0x4d, 0x9e, 0x46, 0xdb, 0xc9, 0xbd, - 0x28, 0xd0, 0x7f, 0x2f, 0xe3, 0xb6, 0x95, 0xab, - 0x8a, 0x6e, 0xc2, 0xd5, 0xd5, 0x55, 0x00, 0xbe, - 0xba, 0x93, 0x2e, 0xaa, 0x57, 0xa2, 0x53, 0xfd, - 0x90, 0x24, 0x12, 0x89, 0x8a, 0x03, 0x57, 0x05, - 0xa0, 0x1a, 0xaa, 0x08, 0x60, 0x78, 0x78, 0xd8, - 0xfd, 0x9e, 0x9d, 0x9d, 0x3d, 0x56, 0x2f, 0x47, - 0xee, 0x31, 0x14, 0x42, 0x78, 0x2e, 0xb2, 0x2c, - 0x13, 0x8f, 0xc7, 0x91, 0x65, 0x19, 0x21, 0x04, - 0xf1, 0x78, 0xbc, 0xa8, 0xee, 0xa5, 0x9c, 0x2a, - 0x03, 0x86, 0x61, 0x30, 0x32, 0x32, 0xe2, 0x8e, - 0x1b, 0x1f, 0x1f, 0x67, 0x65, 0x65, 0x85, 0xde, - 0xde, 0xde, 0xb2, 0x97, 0xb2, 0x22, 0x00, 0x59, - 0x96, 0x89, 0x46, 0xa3, 0xee, 0xb8, 0x64, 0x32, - 0xc9, 0xcc, 0xcc, 0x4c, 0xd9, 0x7e, 0x2a, 0x06, - 0x78, 0xbb, 0xbf, 0x61, 0x18, 0x8c, 0x8e, 0x8e, - 0x02, 0x30, 0x3d, 0x3d, 0xfd, 0xe1, 0x01, 0x22, - 0x91, 0x48, 0x51, 0xff, 0xa9, 0xa9, 0xa9, 0x13, - 0xc1, 0x3e, 0x18, 0x40, 0x35, 0xf5, 0xff, 0x01, - 0x08, 0x87, 0xc3, 0xb5, 0x03, 0x88, 0xc5, 0x62, - 0x35, 0x09, 0x0e, 0xf0, 0x1a, 0x63, 0x9d, 0x9a, - 0x46, 0xc9, 0x4e, 0x77, 0x5a, 0x00, 0x00, 0x00, - 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, - 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x03, 0x1d, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xcd, 0x96, + 0xdd, 0x4b, 0x1c, 0x57, 0x18, 0x87, 0x9f, 0x75, + 0xd6, 0xb5, 0x63, 0xb0, 0xa9, 0x75, 0xab, 0xf1, + 0xab, 0x49, 0xe3, 0x92, 0x1a, 0x82, 0xb0, 0xb4, + 0x14, 0x5a, 0x63, 0x3e, 0xf0, 0xa6, 0xf5, 0xaa, + 0xf9, 0x03, 0x44, 0xbc, 0x08, 0x5e, 0x85, 0xfc, + 0x05, 0x29, 0x04, 0x72, 0xe1, 0x6d, 0x21, 0xac, + 0x8b, 0x4b, 0x51, 0x59, 0xbc, 0xf0, 0xb2, 0x01, + 0xc1, 0xab, 0xf6, 0xaa, 0x42, 0x21, 0x15, 0x12, + 0x02, 0x22, 0xab, 0x33, 0xcc, 0x3a, 0xba, 0x54, + 0xd3, 0xd5, 0xec, 0x9a, 0x38, 0xbb, 0x33, 0x3b, + 0x67, 0x72, 0x61, 0x9d, 0xb8, 0xd1, 0x64, 0x67, + 0xd7, 0x4d, 0xb7, 0x3f, 0x38, 0x30, 0xe7, 0x3d, + 0xe7, 0xbc, 0xef, 0x73, 0xde, 0xf3, 0x35, 0xbe, + 0xc9, 0xc9, 0x49, 0x87, 0x1a, 0xca, 0x0f, 0x30, + 0x36, 0x36, 0x56, 0x93, 0xe0, 0xb1, 0x58, 0xec, + 0x00, 0x00, 0x20, 0x9d, 0x4e, 0xff, 0xa7, 0xc1, + 0x5b, 0x5a, 0x5a, 0x00, 0xde, 0x00, 0x38, 0x4e, + 0x6d, 0x56, 0xa2, 0xee, 0x28, 0xc0, 0xfb, 0x4a, + 0x30, 0x18, 0x3c, 0xd1, 0xf6, 0x2e, 0x7b, 0x29, + 0x7f, 0x87, 0xf2, 0x94, 0x81, 0xd6, 0xd6, 0x56, + 0x94, 0x85, 0x6e, 0x7a, 0x86, 0xf4, 0x22, 0xbb, + 0xf6, 0xfb, 0x05, 0xfc, 0x0d, 0x75, 0x74, 0x5d, + 0x55, 0x8b, 0xec, 0x89, 0x5f, 0x3b, 0xb8, 0x74, + 0x2b, 0xc5, 0xf6, 0xf6, 0x76, 0xc9, 0x0c, 0x94, + 0x04, 0x68, 0x6b, 0x6b, 0x73, 0x83, 0x2b, 0x0b, + 0xdd, 0xae, 0x5d, 0x6a, 0x90, 0xb8, 0x30, 0xa8, + 0x01, 0xb0, 0xb1, 0x78, 0x11, 0x80, 0x7c, 0xd6, + 0xc2, 0xce, 0xdb, 0x5c, 0xba, 0x95, 0xe2, 0xd9, + 0x2f, 0x9f, 0xd3, 0x77, 0x7b, 0x9d, 0xad, 0xad, + 0xad, 0xd3, 0x01, 0x1c, 0xd5, 0xdb, 0x19, 0x70, + 0xcc, 0xbf, 0x71, 0xec, 0xbd, 0x63, 0x19, 0xc8, + 0x6d, 0x3e, 0xc4, 0xca, 0xbd, 0xf2, 0xe4, 0xd7, + 0x05, 0x10, 0x42, 0x94, 0x04, 0xc8, 0x6d, 0x3e, + 0x44, 0x6a, 0x0c, 0xe1, 0xd4, 0xb5, 0xe0, 0x0f, + 0x34, 0xb3, 0x9f, 0x4e, 0xb2, 0xb7, 0x3e, 0x4f, + 0xf3, 0xf9, 0x1e, 0x7c, 0x46, 0x8a, 0x7c, 0x6e, + 0x07, 0x61, 0xed, 0x73, 0xe6, 0x93, 0x2b, 0xd8, + 0xf9, 0x7a, 0x4f, 0x7e, 0x2b, 0x3a, 0x05, 0xfe, + 0x40, 0x33, 0x05, 0x73, 0x97, 0xd4, 0x9f, 0x3f, + 0x93, 0x49, 0xfe, 0x45, 0x43, 0xe3, 0x8f, 0xf8, + 0xfd, 0x20, 0xac, 0x7d, 0x84, 0xf9, 0x12, 0x00, + 0xcb, 0x30, 0x3c, 0xf9, 0x2d, 0x1b, 0x40, 0xfa, + 0x28, 0xc4, 0xf3, 0xe5, 0x47, 0x28, 0x0b, 0x0f, + 0x5c, 0xdb, 0xca, 0xfc, 0x1c, 0x4d, 0xe7, 0xce, + 0xd2, 0x15, 0xfe, 0x16, 0x61, 0x99, 0x08, 0x3b, + 0xe3, 0xb6, 0x95, 0xf2, 0x5b, 0xf2, 0x18, 0xea, + 0xba, 0x4e, 0xcf, 0x90, 0xce, 0xc6, 0xe2, 0x45, + 0x02, 0x9f, 0xfe, 0x40, 0xc1, 0xdc, 0xa5, 0xb5, + 0x6f, 0x98, 0x60, 0xef, 0x35, 0xd7, 0x49, 0xbd, + 0x2c, 0xd3, 0xd9, 0xf7, 0x35, 0x76, 0xee, 0x15, + 0x67, 0x3b, 0xaf, 0xb1, 0x34, 0x37, 0x41, 0xff, + 0xbd, 0x0c, 0xba, 0xae, 0x57, 0xe7, 0x18, 0xc2, + 0xc1, 0x0e, 0xf7, 0x49, 0x4d, 0x98, 0x7b, 0x49, + 0xfc, 0x81, 0xbd, 0xa2, 0xe0, 0x00, 0x3e, 0xa9, + 0x1e, 0x2b, 0x9b, 0x2f, 0x6b, 0xf6, 0x65, 0x01, + 0x48, 0x0d, 0x52, 0x51, 0xbd, 0xa9, 0x23, 0x44, + 0x30, 0xd4, 0x49, 0x9d, 0xb3, 0xcf, 0x0b, 0x2d, + 0x81, 0x63, 0x5b, 0xd8, 0xe6, 0x2e, 0x00, 0xa2, + 0xe0, 0x78, 0x06, 0xf0, 0x74, 0x13, 0x6a, 0x9a, + 0x46, 0xf7, 0x8d, 0x04, 0x9b, 0x8f, 0xfb, 0x91, + 0xdb, 0xaf, 0xf3, 0x7c, 0xf9, 0x11, 0xcd, 0xe7, + 0x7b, 0xf0, 0xff, 0x8b, 0xff, 0x71, 0x47, 0x07, + 0xd9, 0x54, 0x8a, 0xcf, 0xbe, 0xbc, 0xc9, 0xd2, + 0xdc, 0x04, 0xdf, 0xfd, 0xf4, 0x0f, 0x9a, 0xa6, + 0x55, 0xef, 0x26, 0x04, 0x90, 0xa4, 0xc0, 0x01, + 0xb1, 0xbd, 0x83, 0xc8, 0x6f, 0xe0, 0x33, 0x0e, + 0x52, 0xef, 0xd8, 0x79, 0x84, 0x65, 0xba, 0xfd, + 0x44, 0xc1, 0x41, 0x92, 0x02, 0x9e, 0x37, 0xb5, + 0xe7, 0xb7, 0x40, 0x55, 0x55, 0xba, 0xae, 0xaa, + 0xa8, 0xbf, 0x7d, 0x43, 0xf0, 0xf2, 0xf7, 0xec, + 0x6c, 0x1b, 0xec, 0xac, 0x3e, 0x21, 0xa3, 0x27, + 0xb1, 0x0c, 0x87, 0xf6, 0xbe, 0x41, 0x1e, 0xcf, + 0x46, 0x18, 0xb8, 0x9f, 0x45, 0x55, 0xd5, 0xea, + 0xbe, 0x05, 0x87, 0x52, 0x14, 0xc5, 0xbd, 0x92, + 0xed, 0xbc, 0xcd, 0x17, 0xe1, 0xbb, 0x08, 0x3b, + 0xc3, 0xd2, 0xdc, 0x04, 0xca, 0xe2, 0x1f, 0x0c, + 0xdc, 0xcf, 0xa2, 0x28, 0x8a, 0xa7, 0x99, 0x57, + 0x04, 0x00, 0xb0, 0xb6, 0xb6, 0x46, 0x68, 0x48, + 0xc7, 0xb6, 0x4d, 0x9e, 0x46, 0xdb, 0xc9, 0xbd, + 0x28, 0xd0, 0x7f, 0x2f, 0xe3, 0xb6, 0x95, 0xab, + 0x8a, 0x6e, 0xc2, 0xd5, 0xd5, 0x55, 0x00, 0xbe, + 0xba, 0x93, 0x2e, 0xaa, 0x57, 0xa2, 0x53, 0xfd, + 0x90, 0x24, 0x12, 0x89, 0x8a, 0x03, 0x57, 0x05, + 0xa0, 0x1a, 0xaa, 0x08, 0x60, 0x78, 0x78, 0xd8, + 0xfd, 0x9e, 0x9d, 0x9d, 0x3d, 0x56, 0x2f, 0x47, + 0xee, 0x31, 0x14, 0x42, 0x78, 0x2e, 0xb2, 0x2c, + 0x13, 0x8f, 0xc7, 0x91, 0x65, 0x19, 0x21, 0x04, + 0xf1, 0x78, 0xbc, 0xa8, 0xee, 0xa5, 0x9c, 0x2a, + 0x03, 0x86, 0x61, 0x30, 0x32, 0x32, 0xe2, 0x8e, + 0x1b, 0x1f, 0x1f, 0x67, 0x65, 0x65, 0x85, 0xde, + 0xde, 0xde, 0xb2, 0x97, 0xb2, 0x22, 0x00, 0x59, + 0x96, 0x89, 0x46, 0xa3, 0xee, 0xb8, 0x64, 0x32, + 0xc9, 0xcc, 0xcc, 0x4c, 0xd9, 0x7e, 0x2a, 0x06, + 0x78, 0xbb, 0xbf, 0x61, 0x18, 0x8c, 0x8e, 0x8e, + 0x02, 0x30, 0x3d, 0x3d, 0xfd, 0xe1, 0x01, 0x22, + 0x91, 0x48, 0x51, 0xff, 0xa9, 0xa9, 0xa9, 0x13, + 0xc1, 0x3e, 0x18, 0x40, 0x35, 0xf5, 0xff, 0x01, + 0x08, 0x87, 0xc3, 0xb5, 0x03, 0x88, 0xc5, 0x62, + 0x35, 0x09, 0x0e, 0xf0, 0x1a, 0x63, 0x9d, 0x9a, + 0x46, 0xc9, 0x4e, 0x77, 0x5a, 0x00, 0x00, 0x00, + 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, + 0x82 +}; /* End Of File */ /* protection_zone_small.png - 687 bytes */ unsigned char protection_zone_small_png[687] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x0b, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x93, - 0x4d, 0x6b, 0x13, 0x51, 0x14, 0x86, 0x9f, 0x3b, - 0x33, 0xcd, 0x24, 0x36, 0x53, 0x1b, 0x6d, 0xb5, - 0xb5, 0xad, 0x16, 0xc1, 0x0f, 0xa8, 0x54, 0xd1, - 0x95, 0x1b, 0x41, 0x44, 0xba, 0x2c, 0xd2, 0x3f, - 0xe0, 0xc6, 0x95, 0xe2, 0xda, 0x95, 0x7f, 0xa3, - 0xf4, 0x47, 0x74, 0xd5, 0x8d, 0x82, 0xe0, 0xae, - 0x92, 0x8d, 0x88, 0xb8, 0x70, 0x25, 0xd8, 0x26, - 0xb5, 0xcc, 0x24, 0x8d, 0xc9, 0x64, 0x3e, 0x72, - 0xe7, 0x7e, 0xb8, 0x28, 0xad, 0xc6, 0x46, 0x04, - 0x7d, 0xe1, 0x2c, 0x0e, 0xbc, 0xe7, 0xe1, 0x3d, - 0x9c, 0x7b, 0xc5, 0xc6, 0xc6, 0x86, 0xe5, 0x3f, - 0xe4, 0x01, 0xac, 0xad, 0xad, 0xfd, 0xd3, 0xf0, - 0xe6, 0xe6, 0xe6, 0x21, 0xc0, 0x18, 0x03, 0x40, - 0xc5, 0x37, 0x80, 0x83, 0x54, 0xee, 0x61, 0xef, - 0x36, 0x11, 0x42, 0x90, 0xaa, 0x0b, 0x00, 0x94, - 0x3c, 0x8d, 0x10, 0x9a, 0x34, 0x77, 0x87, 0x13, - 0x18, 0x63, 0xf0, 0xbd, 0x04, 0x19, 0x6d, 0x61, - 0x55, 0x1f, 0xe1, 0x94, 0x11, 0xc2, 0x92, 0xea, - 0x0e, 0x8e, 0x27, 0xf0, 0xc6, 0xce, 0xa0, 0xa5, - 0x25, 0x97, 0x39, 0x50, 0x63, 0x6c, 0x6a, 0x85, - 0x81, 0xad, 0x02, 0xe0, 0x00, 0x68, 0xad, 0xf1, - 0xc5, 0x3e, 0x3a, 0xdd, 0xa5, 0x3a, 0xbb, 0x8a, - 0xe3, 0x8e, 0x23, 0xbc, 0x71, 0xce, 0x5e, 0x7b, - 0x49, 0xed, 0xf2, 0x0b, 0x1c, 0x2f, 0x40, 0x78, - 0x01, 0xc1, 0xfc, 0x7d, 0xe2, 0x2f, 0xaf, 0xf0, - 0x74, 0x07, 0xad, 0xf5, 0x70, 0x02, 0x10, 0x58, - 0x5c, 0x7c, 0xbf, 0x84, 0x77, 0x6e, 0x19, 0xb7, - 0x7a, 0x97, 0x64, 0xef, 0x2d, 0xfd, 0xc6, 0x6b, - 0xce, 0x5f, 0xbd, 0x43, 0x9a, 0x7d, 0x46, 0x74, - 0xdb, 0xa8, 0xa4, 0x8d, 0xb5, 0xa5, 0xe3, 0xb5, - 0x7f, 0x01, 0x58, 0x2c, 0x80, 0x95, 0xd8, 0x22, - 0x21, 0xfc, 0xb0, 0x4e, 0xf3, 0xdd, 0x3a, 0x45, - 0xbc, 0x47, 0xb2, 0xbf, 0xcd, 0xc4, 0xd4, 0x24, - 0xc1, 0xf4, 0x25, 0x8c, 0xcc, 0xb0, 0xc6, 0x1c, - 0x03, 0x9c, 0x23, 0x40, 0x6f, 0x30, 0x43, 0x39, - 0x98, 0x27, 0x3d, 0xd8, 0xc6, 0x0d, 0x96, 0x29, - 0xfa, 0x21, 0xdd, 0xaf, 0x9f, 0x48, 0xda, 0x1d, - 0xd2, 0x68, 0x8f, 0x52, 0x25, 0xe0, 0xfb, 0xce, - 0x2e, 0x95, 0x85, 0x55, 0x52, 0x31, 0x79, 0x32, - 0xc1, 0xa0, 0xf0, 0xf0, 0xad, 0x8b, 0x4c, 0x7b, - 0x94, 0x0b, 0x98, 0x98, 0xbb, 0xc1, 0xe9, 0x85, - 0x45, 0xac, 0x2e, 0x98, 0x98, 0x99, 0x03, 0xeb, - 0x90, 0xf7, 0xbe, 0xe1, 0xce, 0xce, 0x23, 0xb5, - 0x83, 0x31, 0x6a, 0x18, 0xa0, 0x94, 0x42, 0x57, - 0x6e, 0xe2, 0xa4, 0x6f, 0x90, 0x59, 0x88, 0xd1, - 0x31, 0x57, 0x1e, 0x3e, 0xc2, 0x64, 0x21, 0xfd, - 0xb0, 0x89, 0x4c, 0xba, 0x68, 0xe7, 0x22, 0xa5, - 0xda, 0x75, 0xa4, 0x52, 0x27, 0x57, 0x50, 0x4a, - 0x91, 0x9b, 0x45, 0x84, 0xeb, 0x32, 0xe8, 0xbd, - 0x87, 0xbc, 0x81, 0x2d, 0x52, 0x54, 0xde, 0xc7, - 0x1b, 0xf3, 0x91, 0x69, 0x0e, 0x95, 0x25, 0x4c, - 0x75, 0x11, 0x35, 0x0a, 0x60, 0x8c, 0x21, 0x8e, - 0x63, 0x8a, 0x53, 0x4f, 0xd0, 0x45, 0x83, 0x24, - 0xfe, 0x48, 0xd6, 0x8a, 0x18, 0xf4, 0x32, 0xba, - 0xcd, 0x06, 0x85, 0x73, 0x9b, 0xea, 0xad, 0x67, - 0xc4, 0x71, 0x7c, 0xec, 0x1f, 0x7a, 0x07, 0x47, - 0x15, 0x46, 0x2d, 0x64, 0xf5, 0x31, 0xe5, 0xa9, - 0x7b, 0x0c, 0xa4, 0x20, 0x4b, 0x7c, 0xfc, 0x85, - 0xa7, 0x94, 0x96, 0x9e, 0x13, 0x45, 0xe1, 0x90, - 0xf7, 0xb7, 0x33, 0xfe, 0x54, 0xd4, 0x3a, 0xc0, - 0xf7, 0x57, 0x98, 0x5e, 0x7a, 0x00, 0x56, 0x10, - 0x25, 0x2e, 0xdd, 0xf6, 0xc1, 0xc8, 0xff, 0x30, - 0x12, 0x00, 0x90, 0x65, 0x19, 0x3b, 0xd9, 0xc8, - 0x99, 0x93, 0x80, 0x7a, 0xbd, 0xfe, 0x77, 0xe7, - 0x1f, 0xf4, 0x03, 0xcc, 0x53, 0x31, 0xfb, 0xc0, - 0x7d, 0xa9, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x49, - 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x0b, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x93, + 0x4d, 0x6b, 0x13, 0x51, 0x14, 0x86, 0x9f, 0x3b, + 0x33, 0xcd, 0x24, 0x36, 0x53, 0x1b, 0x6d, 0xb5, + 0xb5, 0xad, 0x16, 0xc1, 0x0f, 0xa8, 0x54, 0xd1, + 0x95, 0x1b, 0x41, 0x44, 0xba, 0x2c, 0xd2, 0x3f, + 0xe0, 0xc6, 0x95, 0xe2, 0xda, 0x95, 0x7f, 0xa3, + 0xf4, 0x47, 0x74, 0xd5, 0x8d, 0x82, 0xe0, 0xae, + 0x92, 0x8d, 0x88, 0xb8, 0x70, 0x25, 0xd8, 0x26, + 0xb5, 0xcc, 0x24, 0x8d, 0xc9, 0x64, 0x3e, 0x72, + 0xe7, 0x7e, 0xb8, 0x28, 0xad, 0xc6, 0x46, 0x04, + 0x7d, 0xe1, 0x2c, 0x0e, 0xbc, 0xe7, 0xe1, 0x3d, + 0x9c, 0x7b, 0xc5, 0xc6, 0xc6, 0x86, 0xe5, 0x3f, + 0xe4, 0x01, 0xac, 0xad, 0xad, 0xfd, 0xd3, 0xf0, + 0xe6, 0xe6, 0xe6, 0x21, 0xc0, 0x18, 0x03, 0x40, + 0xc5, 0x37, 0x80, 0x83, 0x54, 0xee, 0x61, 0xef, + 0x36, 0x11, 0x42, 0x90, 0xaa, 0x0b, 0x00, 0x94, + 0x3c, 0x8d, 0x10, 0x9a, 0x34, 0x77, 0x87, 0x13, + 0x18, 0x63, 0xf0, 0xbd, 0x04, 0x19, 0x6d, 0x61, + 0x55, 0x1f, 0xe1, 0x94, 0x11, 0xc2, 0x92, 0xea, + 0x0e, 0x8e, 0x27, 0xf0, 0xc6, 0xce, 0xa0, 0xa5, + 0x25, 0x97, 0x39, 0x50, 0x63, 0x6c, 0x6a, 0x85, + 0x81, 0xad, 0x02, 0xe0, 0x00, 0x68, 0xad, 0xf1, + 0xc5, 0x3e, 0x3a, 0xdd, 0xa5, 0x3a, 0xbb, 0x8a, + 0xe3, 0x8e, 0x23, 0xbc, 0x71, 0xce, 0x5e, 0x7b, + 0x49, 0xed, 0xf2, 0x0b, 0x1c, 0x2f, 0x40, 0x78, + 0x01, 0xc1, 0xfc, 0x7d, 0xe2, 0x2f, 0xaf, 0xf0, + 0x74, 0x07, 0xad, 0xf5, 0x70, 0x02, 0x10, 0x58, + 0x5c, 0x7c, 0xbf, 0x84, 0x77, 0x6e, 0x19, 0xb7, + 0x7a, 0x97, 0x64, 0xef, 0x2d, 0xfd, 0xc6, 0x6b, + 0xce, 0x5f, 0xbd, 0x43, 0x9a, 0x7d, 0x46, 0x74, + 0xdb, 0xa8, 0xa4, 0x8d, 0xb5, 0xa5, 0xe3, 0xb5, + 0x7f, 0x01, 0x58, 0x2c, 0x80, 0x95, 0xd8, 0x22, + 0x21, 0xfc, 0xb0, 0x4e, 0xf3, 0xdd, 0x3a, 0x45, + 0xbc, 0x47, 0xb2, 0xbf, 0xcd, 0xc4, 0xd4, 0x24, + 0xc1, 0xf4, 0x25, 0x8c, 0xcc, 0xb0, 0xc6, 0x1c, + 0x03, 0x9c, 0x23, 0x40, 0x6f, 0x30, 0x43, 0x39, + 0x98, 0x27, 0x3d, 0xd8, 0xc6, 0x0d, 0x96, 0x29, + 0xfa, 0x21, 0xdd, 0xaf, 0x9f, 0x48, 0xda, 0x1d, + 0xd2, 0x68, 0x8f, 0x52, 0x25, 0xe0, 0xfb, 0xce, + 0x2e, 0x95, 0x85, 0x55, 0x52, 0x31, 0x79, 0x32, + 0xc1, 0xa0, 0xf0, 0xf0, 0xad, 0x8b, 0x4c, 0x7b, + 0x94, 0x0b, 0x98, 0x98, 0xbb, 0xc1, 0xe9, 0x85, + 0x45, 0xac, 0x2e, 0x98, 0x98, 0x99, 0x03, 0xeb, + 0x90, 0xf7, 0xbe, 0xe1, 0xce, 0xce, 0x23, 0xb5, + 0x83, 0x31, 0x6a, 0x18, 0xa0, 0x94, 0x42, 0x57, + 0x6e, 0xe2, 0xa4, 0x6f, 0x90, 0x59, 0x88, 0xd1, + 0x31, 0x57, 0x1e, 0x3e, 0xc2, 0x64, 0x21, 0xfd, + 0xb0, 0x89, 0x4c, 0xba, 0x68, 0xe7, 0x22, 0xa5, + 0xda, 0x75, 0xa4, 0x52, 0x27, 0x57, 0x50, 0x4a, + 0x91, 0x9b, 0x45, 0x84, 0xeb, 0x32, 0xe8, 0xbd, + 0x87, 0xbc, 0x81, 0x2d, 0x52, 0x54, 0xde, 0xc7, + 0x1b, 0xf3, 0x91, 0x69, 0x0e, 0x95, 0x25, 0x4c, + 0x75, 0x11, 0x35, 0x0a, 0x60, 0x8c, 0x21, 0x8e, + 0x63, 0x8a, 0x53, 0x4f, 0xd0, 0x45, 0x83, 0x24, + 0xfe, 0x48, 0xd6, 0x8a, 0x18, 0xf4, 0x32, 0xba, + 0xcd, 0x06, 0x85, 0x73, 0x9b, 0xea, 0xad, 0x67, + 0xc4, 0x71, 0x7c, 0xec, 0x1f, 0x7a, 0x07, 0x47, + 0x15, 0x46, 0x2d, 0x64, 0xf5, 0x31, 0xe5, 0xa9, + 0x7b, 0x0c, 0xa4, 0x20, 0x4b, 0x7c, 0xfc, 0x85, + 0xa7, 0x94, 0x96, 0x9e, 0x13, 0x45, 0xe1, 0x90, + 0xf7, 0xb7, 0x33, 0xfe, 0x54, 0xd4, 0x3a, 0xc0, + 0xf7, 0x57, 0x98, 0x5e, 0x7a, 0x00, 0x56, 0x10, + 0x25, 0x2e, 0xdd, 0xf6, 0xc1, 0xc8, 0xff, 0x30, + 0x12, 0x00, 0x90, 0x65, 0x19, 0x3b, 0xd9, 0xc8, + 0x99, 0x93, 0x80, 0x7a, 0xbd, 0xfe, 0x77, 0xe7, + 0x1f, 0xf4, 0x03, 0xcc, 0x53, 0x31, 0xfb, 0xc0, + 0x7d, 0xa9, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x49, + 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* pvp_zone.png - 677 bytes */ unsigned char pvp_zone_png[677] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x01, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xd5, 0x96, - 0x3f, 0x6f, 0xd3, 0x40, 0x14, 0xc0, 0x7f, 0xa6, - 0x04, 0xe4, 0x11, 0x45, 0xf2, 0x80, 0xaa, 0x0c, - 0x11, 0x22, 0x6b, 0x36, 0x3e, 0x48, 0xc7, 0x48, - 0x51, 0x86, 0x28, 0x2b, 0x63, 0x3e, 0x40, 0x3f, - 0x43, 0x14, 0xc5, 0x0b, 0x90, 0xa1, 0x62, 0xe7, - 0x0b, 0x20, 0x26, 0xda, 0x21, 0xa2, 0x82, 0x29, - 0x43, 0xda, 0x85, 0x4a, 0x8d, 0x48, 0x69, 0x6c, - 0xe4, 0x9c, 0xed, 0xe4, 0xcc, 0x60, 0x6c, 0x72, - 0xf9, 0x53, 0x3b, 0x95, 0x53, 0xc3, 0x93, 0x9e, - 0xde, 0xbd, 0x7b, 0xef, 0xde, 0xfb, 0xf9, 0xce, - 0xf2, 0x59, 0xeb, 0xf5, 0x7a, 0x01, 0x39, 0xca, - 0x63, 0x80, 0x56, 0xab, 0x95, 0x4b, 0x73, 0xd3, - 0x34, 0x43, 0x00, 0x80, 0xc9, 0x64, 0xf2, 0xa0, - 0xcd, 0x8b, 0xc5, 0x22, 0xc0, 0x5f, 0x80, 0x20, - 0xc8, 0xe7, 0x24, 0xfe, 0x0f, 0x00, 0xc3, 0x30, - 0xee, 0x55, 0x7c, 0x3c, 0x1e, 0x67, 0x03, 0x00, - 0xf0, 0xeb, 0xed, 0x1b, 0x34, 0xe1, 0x22, 0x6d, - 0x0b, 0x6d, 0x6a, 0x85, 0x93, 0x96, 0x05, 0x8e, - 0x13, 0xaa, 0x10, 0xb4, 0xbe, 0x7f, 0x8e, 0xf3, - 0x4f, 0x4e, 0xaf, 0x52, 0xed, 0x6a, 0x6a, 0x00, - 0x4d, 0xb8, 0xe8, 0x47, 0x47, 0x48, 0xc7, 0x41, - 0x2b, 0x14, 0x58, 0xdc, 0xdc, 0x80, 0xef, 0xe3, - 0x9d, 0x7f, 0x89, 0x73, 0x5e, 0x7f, 0xf0, 0xb8, - 0x7e, 0xe1, 0xf1, 0xfe, 0xe3, 0xb7, 0x54, 0x35, - 0x15, 0x00, 0x29, 0xe5, 0x9d, 0x89, 0xd2, 0xb6, - 0x90, 0x8e, 0x83, 0x38, 0x3e, 0x06, 0xcf, 0x83, - 0xf9, 0x3c, 0x0c, 0x08, 0x11, 0x5a, 0xdf, 0x87, - 0x27, 0xe1, 0xf0, 0x69, 0xe1, 0x20, 0x55, 0x4d, - 0x80, 0x47, 0xd1, 0x20, 0x08, 0x82, 0xad, 0x0a, - 0xa0, 0x4d, 0x2d, 0xa4, 0x6d, 0xab, 0xcd, 0x23, - 0xfb, 0x47, 0xbe, 0xda, 0xd7, 0x8a, 0x9f, 0x54, - 0x53, 0xd9, 0x81, 0xc4, 0xed, 0xb2, 0x2c, 0xe6, - 0x17, 0x17, 0x6a, 0xf3, 0x68, 0xec, 0xfb, 0x1b, - 0x97, 0x64, 0xfa, 0x0e, 0xe0, 0x38, 0xc8, 0xc9, - 0x8f, 0xf5, 0xe6, 0x1b, 0xc4, 0xf5, 0x17, 0x7b, - 0x00, 0xf0, 0x3c, 0x34, 0xe1, 0x12, 0x44, 0x67, - 0x0e, 0x5b, 0x9f, 0xdc, 0x5f, 0x04, 0x7b, 0x00, - 0x10, 0x02, 0x69, 0x5b, 0xb8, 0x87, 0x87, 0x5b, - 0x53, 0x6e, 0x3f, 0x9d, 0x63, 0xf0, 0x2c, 0xf6, - 0x33, 0x05, 0x70, 0x2e, 0x2f, 0x71, 0x06, 0x03, - 0x5c, 0x21, 0x98, 0xda, 0x76, 0x3c, 0xff, 0x73, - 0x69, 0x47, 0x06, 0xd5, 0x22, 0x2f, 0x97, 0xd6, - 0x64, 0x0a, 0x60, 0x9c, 0x9d, 0x25, 0x16, 0x7b, - 0xf7, 0xea, 0xb9, 0xe2, 0x67, 0x06, 0x30, 0x1a, - 0x8d, 0x12, 0x0b, 0x95, 0xcb, 0xe5, 0xb5, 0xb9, - 0x6c, 0xdf, 0x81, 0x1d, 0xa4, 0x70, 0xa0, 0xe5, - 0x07, 0x10, 0x7d, 0x86, 0x73, 0x01, 0x38, 0x39, - 0xbd, 0x52, 0xfc, 0x07, 0x05, 0x18, 0x0e, 0x87, - 0xf7, 0x5a, 0x97, 0xfb, 0x0f, 0x49, 0xaa, 0xcb, - 0x28, 0xd2, 0x5a, 0xad, 0x16, 0x6b, 0x10, 0x04, - 0x34, 0x9b, 0x4d, 0xc5, 0xae, 0xc6, 0xd3, 0x5c, - 0x46, 0x31, 0x80, 0x94, 0x32, 0x51, 0x75, 0x5d, - 0xa7, 0xdf, 0xef, 0xa3, 0xeb, 0x7a, 0x7c, 0xd5, - 0x2e, 0xdb, 0xd5, 0xf8, 0x5d, 0x1a, 0xc9, 0x4e, - 0x47, 0x30, 0x9b, 0xcd, 0xa8, 0xd7, 0xeb, 0x4a, - 0xfe, 0xb2, 0xdd, 0x14, 0x4f, 0x92, 0x9d, 0x00, - 0x74, 0x5d, 0xa7, 0xdb, 0xed, 0x6e, 0x05, 0xd8, - 0x14, 0xcf, 0x14, 0x60, 0x35, 0xaf, 0x54, 0x2a, - 0xd1, 0x68, 0x34, 0xa8, 0x54, 0x2a, 0x6b, 0x40, - 0x69, 0x65, 0x27, 0x80, 0x4e, 0xa7, 0xa3, 0xe4, - 0xb5, 0xdb, 0x6d, 0x05, 0x6c, 0x35, 0x9e, 0x39, - 0xc0, 0x3e, 0xe4, 0xdf, 0x01, 0xa8, 0x56, 0xab, - 0xf9, 0x01, 0x98, 0xa6, 0x99, 0x4b, 0x73, 0x80, - 0xdf, 0x6f, 0x05, 0xf5, 0x96, 0x71, 0x1b, 0x2d, - 0xd2, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, - 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x01, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xd5, 0x96, + 0x3f, 0x6f, 0xd3, 0x40, 0x14, 0xc0, 0x7f, 0xa6, + 0x04, 0xe4, 0x11, 0x45, 0xf2, 0x80, 0xaa, 0x0c, + 0x11, 0x22, 0x6b, 0x36, 0x3e, 0x48, 0xc7, 0x48, + 0x51, 0x86, 0x28, 0x2b, 0x63, 0x3e, 0x40, 0x3f, + 0x43, 0x14, 0xc5, 0x0b, 0x90, 0xa1, 0x62, 0xe7, + 0x0b, 0x20, 0x26, 0xda, 0x21, 0xa2, 0x82, 0x29, + 0x43, 0xda, 0x85, 0x4a, 0x8d, 0x48, 0x69, 0x6c, + 0xe4, 0x9c, 0xed, 0xe4, 0xcc, 0x60, 0x6c, 0x72, + 0xf9, 0x53, 0x3b, 0x95, 0x53, 0xc3, 0x93, 0x9e, + 0xde, 0xbd, 0x7b, 0xef, 0xde, 0xfb, 0xf9, 0xce, + 0xf2, 0x59, 0xeb, 0xf5, 0x7a, 0x01, 0x39, 0xca, + 0x63, 0x80, 0x56, 0xab, 0x95, 0x4b, 0x73, 0xd3, + 0x34, 0x43, 0x00, 0x80, 0xc9, 0x64, 0xf2, 0xa0, + 0xcd, 0x8b, 0xc5, 0x22, 0xc0, 0x5f, 0x80, 0x20, + 0xc8, 0xe7, 0x24, 0xfe, 0x0f, 0x00, 0xc3, 0x30, + 0xee, 0x55, 0x7c, 0x3c, 0x1e, 0x67, 0x03, 0x00, + 0xf0, 0xeb, 0xed, 0x1b, 0x34, 0xe1, 0x22, 0x6d, + 0x0b, 0x6d, 0x6a, 0x85, 0x93, 0x96, 0x05, 0x8e, + 0x13, 0xaa, 0x10, 0xb4, 0xbe, 0x7f, 0x8e, 0xf3, + 0x4f, 0x4e, 0xaf, 0x52, 0xed, 0x6a, 0x6a, 0x00, + 0x4d, 0xb8, 0xe8, 0x47, 0x47, 0x48, 0xc7, 0x41, + 0x2b, 0x14, 0x58, 0xdc, 0xdc, 0x80, 0xef, 0xe3, + 0x9d, 0x7f, 0x89, 0x73, 0x5e, 0x7f, 0xf0, 0xb8, + 0x7e, 0xe1, 0xf1, 0xfe, 0xe3, 0xb7, 0x54, 0x35, + 0x15, 0x00, 0x29, 0xe5, 0x9d, 0x89, 0xd2, 0xb6, + 0x90, 0x8e, 0x83, 0x38, 0x3e, 0x06, 0xcf, 0x83, + 0xf9, 0x3c, 0x0c, 0x08, 0x11, 0x5a, 0xdf, 0x87, + 0x27, 0xe1, 0xf0, 0x69, 0xe1, 0x20, 0x55, 0x4d, + 0x80, 0x47, 0xd1, 0x20, 0x08, 0x82, 0xad, 0x0a, + 0xa0, 0x4d, 0x2d, 0xa4, 0x6d, 0xab, 0xcd, 0x23, + 0xfb, 0x47, 0xbe, 0xda, 0xd7, 0x8a, 0x9f, 0x54, + 0x53, 0xd9, 0x81, 0xc4, 0xed, 0xb2, 0x2c, 0xe6, + 0x17, 0x17, 0x6a, 0xf3, 0x68, 0xec, 0xfb, 0x1b, + 0x97, 0x64, 0xfa, 0x0e, 0xe0, 0x38, 0xc8, 0xc9, + 0x8f, 0xf5, 0xe6, 0x1b, 0xc4, 0xf5, 0x17, 0x7b, + 0x00, 0xf0, 0x3c, 0x34, 0xe1, 0x12, 0x44, 0x67, + 0x0e, 0x5b, 0x9f, 0xdc, 0x5f, 0x04, 0x7b, 0x00, + 0x10, 0x02, 0x69, 0x5b, 0xb8, 0x87, 0x87, 0x5b, + 0x53, 0x6e, 0x3f, 0x9d, 0x63, 0xf0, 0x2c, 0xf6, + 0x33, 0x05, 0x70, 0x2e, 0x2f, 0x71, 0x06, 0x03, + 0x5c, 0x21, 0x98, 0xda, 0x76, 0x3c, 0xff, 0x73, + 0x69, 0x47, 0x06, 0xd5, 0x22, 0x2f, 0x97, 0xd6, + 0x64, 0x0a, 0x60, 0x9c, 0x9d, 0x25, 0x16, 0x7b, + 0xf7, 0xea, 0xb9, 0xe2, 0x67, 0x06, 0x30, 0x1a, + 0x8d, 0x12, 0x0b, 0x95, 0xcb, 0xe5, 0xb5, 0xb9, + 0x6c, 0xdf, 0x81, 0x1d, 0xa4, 0x70, 0xa0, 0xe5, + 0x07, 0x10, 0x7d, 0x86, 0x73, 0x01, 0x38, 0x39, + 0xbd, 0x52, 0xfc, 0x07, 0x05, 0x18, 0x0e, 0x87, + 0xf7, 0x5a, 0x97, 0xfb, 0x0f, 0x49, 0xaa, 0xcb, + 0x28, 0xd2, 0x5a, 0xad, 0x16, 0x6b, 0x10, 0x04, + 0x34, 0x9b, 0x4d, 0xc5, 0xae, 0xc6, 0xd3, 0x5c, + 0x46, 0x31, 0x80, 0x94, 0x32, 0x51, 0x75, 0x5d, + 0xa7, 0xdf, 0xef, 0xa3, 0xeb, 0x7a, 0x7c, 0xd5, + 0x2e, 0xdb, 0xd5, 0xf8, 0x5d, 0x1a, 0xc9, 0x4e, + 0x47, 0x30, 0x9b, 0xcd, 0xa8, 0xd7, 0xeb, 0x4a, + 0xfe, 0xb2, 0xdd, 0x14, 0x4f, 0x92, 0x9d, 0x00, + 0x74, 0x5d, 0xa7, 0xdb, 0xed, 0x6e, 0x05, 0xd8, + 0x14, 0xcf, 0x14, 0x60, 0x35, 0xaf, 0x54, 0x2a, + 0xd1, 0x68, 0x34, 0xa8, 0x54, 0x2a, 0x6b, 0x40, + 0x69, 0x65, 0x27, 0x80, 0x4e, 0xa7, 0xa3, 0xe4, + 0xb5, 0xdb, 0x6d, 0x05, 0x6c, 0x35, 0x9e, 0x39, + 0xc0, 0x3e, 0xe4, 0xdf, 0x01, 0xa8, 0x56, 0xab, + 0xf9, 0x01, 0x98, 0xa6, 0x99, 0x4b, 0x73, 0x80, + 0xdf, 0x6f, 0x05, 0xf5, 0x96, 0x71, 0x1b, 0x2d, + 0xd2, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, + 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* pvp_zone_small.png - 620 bytes */ unsigned char pvp_zone_small_png[620] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xc8, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, - 0xbd, 0x6e, 0x53, 0x41, 0x10, 0x85, 0xbf, 0xd9, - 0x7b, 0xaf, 0xed, 0xc4, 0x96, 0x2e, 0xf9, 0x71, - 0x87, 0x44, 0x4f, 0x41, 0x01, 0x6d, 0x82, 0x44, - 0x47, 0x43, 0xe5, 0x86, 0x67, 0x48, 0xc5, 0x5b, - 0xe4, 0x0d, 0x40, 0xee, 0x68, 0x90, 0xa0, 0x48, - 0x0b, 0x35, 0x88, 0x26, 0x52, 0x2a, 0x42, 0x82, - 0x28, 0x28, 0x88, 0x08, 0xc4, 0xc4, 0x01, 0x14, - 0xd9, 0x5e, 0xdb, 0xbb, 0x3b, 0x43, 0xe1, 0x80, - 0x49, 0xb0, 0x53, 0xc0, 0x91, 0xa6, 0x1a, 0x9d, - 0x4f, 0x67, 0x7e, 0xa4, 0xdd, 0x6e, 0x1b, 0xff, - 0xa1, 0x1c, 0xa0, 0xd5, 0x6a, 0xfd, 0x93, 0x79, - 0x6b, 0x6b, 0x6b, 0x02, 0x50, 0x55, 0x9a, 0xcd, - 0x55, 0xcc, 0x0f, 0xb1, 0x10, 0x40, 0x15, 0x01, - 0xb0, 0x49, 0x38, 0x31, 0x63, 0x60, 0x89, 0x9e, - 0x29, 0x15, 0x71, 0x94, 0x4b, 0x2b, 0x74, 0x4f, - 0x4e, 0xa6, 0x09, 0x54, 0x15, 0xf3, 0x9e, 0xc1, - 0xd3, 0x67, 0xc8, 0xe2, 0x22, 0x78, 0x3f, 0xa9, - 0x5e, 0x0f, 0xed, 0x74, 0xa8, 0x07, 0xe5, 0xd5, - 0xc1, 0x5b, 0x9e, 0x1c, 0xef, 0x12, 0xc7, 0xca, - 0xa3, 0xe7, 0xbb, 0xa8, 0xda, 0x14, 0x90, 0x52, - 0x82, 0x71, 0x40, 0x1a, 0x0d, 0x6a, 0xeb, 0xeb, - 0xa4, 0xbd, 0x3d, 0x34, 0x04, 0xf0, 0x1e, 0x75, - 0xc2, 0x28, 0x2f, 0xb8, 0x65, 0xc2, 0xea, 0xb5, - 0x82, 0xc7, 0xef, 0xdf, 0x11, 0x55, 0x49, 0x49, - 0x2f, 0x24, 0x30, 0x05, 0xef, 0x09, 0x3b, 0x3b, - 0x8c, 0x36, 0x37, 0x91, 0xb2, 0x04, 0x33, 0xc4, - 0x8c, 0x3c, 0x19, 0xc7, 0x61, 0xc4, 0xe7, 0x1b, - 0x35, 0x0a, 0xe7, 0x10, 0x11, 0x54, 0x2f, 0x00, - 0xc4, 0xc0, 0x8e, 0x8e, 0x48, 0x80, 0x5b, 0x5e, - 0x86, 0x7a, 0x1d, 0xce, 0xf6, 0x91, 0x25, 0xf8, - 0x91, 0x3c, 0xa7, 0x61, 0x88, 0x13, 0xc7, 0x2f, - 0xcf, 0x39, 0x00, 0x66, 0x58, 0xb7, 0x8b, 0x65, - 0x19, 0x38, 0xf7, 0xdb, 0x0c, 0x60, 0x9a, 0xc8, - 0xc4, 0x91, 0x3b, 0x21, 0xc4, 0x84, 0x99, 0xcd, - 0x00, 0x00, 0x32, 0x1e, 0x43, 0x8c, 0x98, 0x08, - 0x52, 0x14, 0x90, 0x12, 0x02, 0xb8, 0xa2, 0x8a, - 0x8c, 0xfb, 0xa0, 0x91, 0x10, 0x0d, 0x9b, 0x99, - 0x40, 0x95, 0xb0, 0xbf, 0xcf, 0xe8, 0xfb, 0x37, - 0x86, 0xfd, 0x3e, 0xe6, 0x3d, 0x00, 0x51, 0x95, - 0x46, 0x5e, 0xe5, 0xa0, 0xfb, 0x95, 0xc1, 0xd5, - 0x45, 0x9c, 0x9b, 0x37, 0xc2, 0xc2, 0x02, 0xb2, - 0xb6, 0x86, 0x9c, 0x9e, 0x42, 0x79, 0x85, 0x18, - 0x23, 0x02, 0x0c, 0x42, 0x20, 0xf8, 0x11, 0x1f, - 0x7a, 0x87, 0x88, 0xc4, 0x89, 0x61, 0x16, 0xe0, - 0xc4, 0x7b, 0xd8, 0xd8, 0xc0, 0x01, 0xf5, 0x3f, - 0xbe, 0xad, 0x04, 0x2a, 0x95, 0x0a, 0xd7, 0x5f, - 0xbe, 0xe0, 0xcd, 0xc3, 0x07, 0xd8, 0x59, 0xf7, - 0x1c, 0x20, 0xa5, 0x44, 0xa7, 0xd3, 0x99, 0xfb, - 0xb2, 0xb5, 0x5a, 0x0d, 0xeb, 0xf7, 0xa9, 0x2e, - 0x54, 0xa9, 0xf8, 0xc9, 0x08, 0x29, 0xa5, 0xbf, - 0x97, 0x38, 0x4f, 0x59, 0x96, 0x51, 0xcb, 0x1d, - 0xaf, 0x77, 0x3f, 0xd1, 0x58, 0x6e, 0x52, 0x38, - 0x37, 0xfb, 0x0a, 0xf3, 0xa4, 0xaa, 0xdc, 0xb9, - 0x77, 0x9f, 0x9b, 0xb7, 0xef, 0x92, 0x67, 0x19, - 0xe5, 0xd2, 0x0a, 0x1f, 0x0f, 0xbf, 0x4c, 0x01, - 0xdb, 0xdb, 0xdb, 0x97, 0x02, 0x2e, 0xd3, 0x4f, - 0x09, 0x72, 0x13, 0x56, 0x31, 0x7b, 0x99, 0x32, - 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, - 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xc8, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, + 0xbd, 0x6e, 0x53, 0x41, 0x10, 0x85, 0xbf, 0xd9, + 0x7b, 0xaf, 0xed, 0xc4, 0x96, 0x2e, 0xf9, 0x71, + 0x87, 0x44, 0x4f, 0x41, 0x01, 0x6d, 0x82, 0x44, + 0x47, 0x43, 0xe5, 0x86, 0x67, 0x48, 0xc5, 0x5b, + 0xe4, 0x0d, 0x40, 0xee, 0x68, 0x90, 0xa0, 0x48, + 0x0b, 0x35, 0x88, 0x26, 0x52, 0x2a, 0x42, 0x82, + 0x28, 0x28, 0x88, 0x08, 0xc4, 0xc4, 0x01, 0x14, + 0xd9, 0x5e, 0xdb, 0xbb, 0x3b, 0x43, 0xe1, 0x80, + 0x49, 0xb0, 0x53, 0xc0, 0x91, 0xa6, 0x1a, 0x9d, + 0x4f, 0x67, 0x7e, 0xa4, 0xdd, 0x6e, 0x1b, 0xff, + 0xa1, 0x1c, 0xa0, 0xd5, 0x6a, 0xfd, 0x93, 0x79, + 0x6b, 0x6b, 0x6b, 0x02, 0x50, 0x55, 0x9a, 0xcd, + 0x55, 0xcc, 0x0f, 0xb1, 0x10, 0x40, 0x15, 0x01, + 0xb0, 0x49, 0x38, 0x31, 0x63, 0x60, 0x89, 0x9e, + 0x29, 0x15, 0x71, 0x94, 0x4b, 0x2b, 0x74, 0x4f, + 0x4e, 0xa6, 0x09, 0x54, 0x15, 0xf3, 0x9e, 0xc1, + 0xd3, 0x67, 0xc8, 0xe2, 0x22, 0x78, 0x3f, 0xa9, + 0x5e, 0x0f, 0xed, 0x74, 0xa8, 0x07, 0xe5, 0xd5, + 0xc1, 0x5b, 0x9e, 0x1c, 0xef, 0x12, 0xc7, 0xca, + 0xa3, 0xe7, 0xbb, 0xa8, 0xda, 0x14, 0x90, 0x52, + 0x82, 0x71, 0x40, 0x1a, 0x0d, 0x6a, 0xeb, 0xeb, + 0xa4, 0xbd, 0x3d, 0x34, 0x04, 0xf0, 0x1e, 0x75, + 0xc2, 0x28, 0x2f, 0xb8, 0x65, 0xc2, 0xea, 0xb5, + 0x82, 0xc7, 0xef, 0xdf, 0x11, 0x55, 0x49, 0x49, + 0x2f, 0x24, 0x30, 0x05, 0xef, 0x09, 0x3b, 0x3b, + 0x8c, 0x36, 0x37, 0x91, 0xb2, 0x04, 0x33, 0xc4, + 0x8c, 0x3c, 0x19, 0xc7, 0x61, 0xc4, 0xe7, 0x1b, + 0x35, 0x0a, 0xe7, 0x10, 0x11, 0x54, 0x2f, 0x00, + 0xc4, 0xc0, 0x8e, 0x8e, 0x48, 0x80, 0x5b, 0x5e, + 0x86, 0x7a, 0x1d, 0xce, 0xf6, 0x91, 0x25, 0xf8, + 0x91, 0x3c, 0xa7, 0x61, 0x88, 0x13, 0xc7, 0x2f, + 0xcf, 0x39, 0x00, 0x66, 0x58, 0xb7, 0x8b, 0x65, + 0x19, 0x38, 0xf7, 0xdb, 0x0c, 0x60, 0x9a, 0xc8, + 0xc4, 0x91, 0x3b, 0x21, 0xc4, 0x84, 0x99, 0xcd, + 0x00, 0x00, 0x32, 0x1e, 0x43, 0x8c, 0x98, 0x08, + 0x52, 0x14, 0x90, 0x12, 0x02, 0xb8, 0xa2, 0x8a, + 0x8c, 0xfb, 0xa0, 0x91, 0x10, 0x0d, 0x9b, 0x99, + 0x40, 0x95, 0xb0, 0xbf, 0xcf, 0xe8, 0xfb, 0x37, + 0x86, 0xfd, 0x3e, 0xe6, 0x3d, 0x00, 0x51, 0x95, + 0x46, 0x5e, 0xe5, 0xa0, 0xfb, 0x95, 0xc1, 0xd5, + 0x45, 0x9c, 0x9b, 0x37, 0xc2, 0xc2, 0x02, 0xb2, + 0xb6, 0x86, 0x9c, 0x9e, 0x42, 0x79, 0x85, 0x18, + 0x23, 0x02, 0x0c, 0x42, 0x20, 0xf8, 0x11, 0x1f, + 0x7a, 0x87, 0x88, 0xc4, 0x89, 0x61, 0x16, 0xe0, + 0xc4, 0x7b, 0xd8, 0xd8, 0xc0, 0x01, 0xf5, 0x3f, + 0xbe, 0xad, 0x04, 0x2a, 0x95, 0x0a, 0xd7, 0x5f, + 0xbe, 0xe0, 0xcd, 0xc3, 0x07, 0xd8, 0x59, 0xf7, + 0x1c, 0x20, 0xa5, 0x44, 0xa7, 0xd3, 0x99, 0xfb, + 0xb2, 0xb5, 0x5a, 0x0d, 0xeb, 0xf7, 0xa9, 0x2e, + 0x54, 0xa9, 0xf8, 0xc9, 0x08, 0x29, 0xa5, 0xbf, + 0x97, 0x38, 0x4f, 0x59, 0x96, 0x51, 0xcb, 0x1d, + 0xaf, 0x77, 0x3f, 0xd1, 0x58, 0x6e, 0x52, 0x38, + 0x37, 0xfb, 0x0a, 0xf3, 0xa4, 0xaa, 0xdc, 0xb9, + 0x77, 0x9f, 0x9b, 0xb7, 0xef, 0x92, 0x67, 0x19, + 0xe5, 0xd2, 0x0a, 0x1f, 0x0f, 0xbf, 0x4c, 0x01, + 0xdb, 0xdb, 0xdb, 0x97, 0x02, 0x2e, 0xd3, 0x4f, + 0x09, 0x72, 0x13, 0x56, 0x31, 0x7b, 0x99, 0x32, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, + 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* rectangular_1.png - 353 bytes */ unsigned char rectangular_1_png[353] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x00, 0xbd, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd5, - 0x3b, 0x0e, 0xc2, 0x30, 0x0c, 0x80, 0xe1, 0xdf, - 0x55, 0x54, 0xc4, 0xdc, 0x0b, 0x70, 0x84, 0x5e, - 0x81, 0x89, 0x83, 0x20, 0xa5, 0x0b, 0x23, 0x13, - 0x07, 0x60, 0x66, 0x4d, 0x38, 0x09, 0x57, 0x61, - 0xe2, 0x02, 0x95, 0xe0, 0x02, 0x0d, 0x03, 0x4f, - 0xa9, 0x9d, 0x0a, 0x8a, 0x41, 0xb2, 0x47, 0x4b, - 0x89, 0xbf, 0xd8, 0x91, 0x2c, 0x21, 0x84, 0x84, - 0x62, 0x38, 0x00, 0xef, 0xbd, 0x4a, 0xf1, 0x18, - 0xe3, 0x0d, 0x00, 0xd0, 0xb6, 0x6d, 0xd6, 0xe2, - 0x55, 0x55, 0x01, 0xbc, 0x00, 0x29, 0xe9, 0x4c, - 0xc2, 0x00, 0x06, 0x78, 0x02, 0xba, 0xae, 0xd3, - 0x05, 0xa8, 0x77, 0xc0, 0x00, 0x7f, 0x05, 0x98, - 0x6d, 0x0f, 0x83, 0xf9, 0xd3, 0x66, 0x91, 0x07, - 0x00, 0x90, 0x82, 0xe7, 0x71, 0x44, 0x04, 0xa4, - 0x89, 0xa3, 0xba, 0x38, 0x1e, 0x90, 0x60, 0xba, - 0xda, 0x53, 0xba, 0x82, 0xcb, 0x6e, 0x39, 0xea, - 0x8e, 0x8f, 0x00, 0x00, 0x13, 0x57, 0x50, 0x3a, - 0x79, 0x43, 0x65, 0x04, 0x88, 0xc0, 0xf9, 0xfe, - 0x72, 0x11, 0x0d, 0x40, 0x13, 0x7b, 0xb9, 0x6c, - 0x80, 0xe3, 0x7a, 0x3e, 0x98, 0xcf, 0xfe, 0x07, - 0xbe, 0x11, 0x06, 0xb0, 0x75, 0x6c, 0x00, 0x03, - 0xfc, 0x0e, 0xa0, 0xae, 0x6b, 0x3d, 0x40, 0x8c, - 0xfd, 0xc5, 0x92, 0x2b, 0xae, 0x78, 0xba, 0x7f, - 0xcb, 0x5a, 0x76, 0x96, 0x40, 0x00, 0x00, 0x00, - 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, - 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x00, 0xbd, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd5, + 0x3b, 0x0e, 0xc2, 0x30, 0x0c, 0x80, 0xe1, 0xdf, + 0x55, 0x54, 0xc4, 0xdc, 0x0b, 0x70, 0x84, 0x5e, + 0x81, 0x89, 0x83, 0x20, 0xa5, 0x0b, 0x23, 0x13, + 0x07, 0x60, 0x66, 0x4d, 0x38, 0x09, 0x57, 0x61, + 0xe2, 0x02, 0x95, 0xe0, 0x02, 0x0d, 0x03, 0x4f, + 0xa9, 0x9d, 0x0a, 0x8a, 0x41, 0xb2, 0x47, 0x4b, + 0x89, 0xbf, 0xd8, 0x91, 0x2c, 0x21, 0x84, 0x84, + 0x62, 0x38, 0x00, 0xef, 0xbd, 0x4a, 0xf1, 0x18, + 0xe3, 0x0d, 0x00, 0xd0, 0xb6, 0x6d, 0xd6, 0xe2, + 0x55, 0x55, 0x01, 0xbc, 0x00, 0x29, 0xe9, 0x4c, + 0xc2, 0x00, 0x06, 0x78, 0x02, 0xba, 0xae, 0xd3, + 0x05, 0xa8, 0x77, 0xc0, 0x00, 0x7f, 0x05, 0x98, + 0x6d, 0x0f, 0x83, 0xf9, 0xd3, 0x66, 0x91, 0x07, + 0x00, 0x90, 0x82, 0xe7, 0x71, 0x44, 0x04, 0xa4, + 0x89, 0xa3, 0xba, 0x38, 0x1e, 0x90, 0x60, 0xba, + 0xda, 0x53, 0xba, 0x82, 0xcb, 0x6e, 0x39, 0xea, + 0x8e, 0x8f, 0x00, 0x00, 0x13, 0x57, 0x50, 0x3a, + 0x79, 0x43, 0x65, 0x04, 0x88, 0xc0, 0xf9, 0xfe, + 0x72, 0x11, 0x0d, 0x40, 0x13, 0x7b, 0xb9, 0x6c, + 0x80, 0xe3, 0x7a, 0x3e, 0x98, 0xcf, 0xfe, 0x07, + 0xbe, 0x11, 0x06, 0xb0, 0x75, 0x6c, 0x00, 0x03, + 0xfc, 0x0e, 0xa0, 0xae, 0x6b, 0x3d, 0x40, 0x8c, + 0xfd, 0xc5, 0x92, 0x2b, 0xae, 0x78, 0xba, 0x7f, + 0xcb, 0x5a, 0x76, 0x96, 0x40, 0x00, 0x00, 0x00, + 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, + 0x82 +}; /* End Of File */ /* rectangular_1_small.png - 250 bytes */ unsigned char rectangular_1_small_png[250] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, - 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, - 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, - 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, - 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, - 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0x56, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x9c, - 0x39, 0x73, 0xe6, 0x7f, 0x06, 0x0a, 0x00, 0x0b, - 0x03, 0x03, 0x03, 0x43, 0x70, 0x70, 0x30, 0x59, - 0x9a, 0xd7, 0xae, 0x5d, 0x0b, 0x31, 0xe0, 0xdf, - 0xbf, 0x7f, 0x94, 0xb9, 0x80, 0x62, 0x03, 0xfe, - 0xfe, 0xfd, 0x3b, 0xc0, 0x2e, 0xa0, 0x99, 0x01, - 0x8a, 0xed, 0xbb, 0x18, 0x18, 0x18, 0x18, 0x18, - 0xee, 0x57, 0xba, 0x51, 0xe6, 0x02, 0x7c, 0xf2, - 0x78, 0x0d, 0xb8, 0x5d, 0xea, 0x44, 0x99, 0x01, - 0xc4, 0x80, 0xd1, 0x74, 0x00, 0x35, 0xe0, 0xe4, - 0xc9, 0x93, 0x64, 0x1b, 0x00, 0x00, 0x73, 0xd8, - 0x39, 0x95, 0x67, 0xa5, 0xcf, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, - 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, + 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, + 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, + 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, + 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0x56, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x9c, + 0x39, 0x73, 0xe6, 0x7f, 0x06, 0x0a, 0x00, 0x0b, + 0x03, 0x03, 0x03, 0x43, 0x70, 0x70, 0x30, 0x59, + 0x9a, 0xd7, 0xae, 0x5d, 0x0b, 0x31, 0xe0, 0xdf, + 0xbf, 0x7f, 0x94, 0xb9, 0x80, 0x62, 0x03, 0xfe, + 0xfe, 0xfd, 0x3b, 0xc0, 0x2e, 0xa0, 0x99, 0x01, + 0x8a, 0xed, 0xbb, 0x18, 0x18, 0x18, 0x18, 0x18, + 0xee, 0x57, 0xba, 0x51, 0xe6, 0x02, 0x7c, 0xf2, + 0x78, 0x0d, 0xb8, 0x5d, 0xea, 0x44, 0x99, 0x01, + 0xc4, 0x80, 0xd1, 0x74, 0x00, 0x35, 0xe0, 0xe4, + 0xc9, 0x93, 0x64, 0x1b, 0x00, 0x00, 0x73, 0xd8, + 0x39, 0x95, 0x67, 0xa5, 0xcf, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, + 0x60, 0x82 +}; /* End Of File */ /* rectangular_2.png - 393 bytes */ unsigned char rectangular_2_png[393] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x00, 0xe5, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd5, - 0x31, 0x12, 0x82, 0x30, 0x10, 0x05, 0xd0, 0xbf, - 0xb0, 0x84, 0xb1, 0xe6, 0x00, 0x5e, 0x81, 0x1b, - 0xd8, 0x7a, 0x0b, 0xad, 0x42, 0x63, 0x65, 0x6b, - 0xab, 0xe3, 0x19, 0x12, 0x2f, 0xe2, 0x51, 0x6c, - 0x2c, 0x3c, 0x00, 0x57, 0x20, 0x16, 0x08, 0x58, - 0x38, 0x20, 0x8c, 0x6c, 0x2c, 0xb2, 0x33, 0x69, - 0x60, 0x27, 0xff, 0xcd, 0x92, 0x09, 0x64, 0x8c, - 0x71, 0xf0, 0x58, 0x0c, 0x00, 0x5a, 0x6b, 0x2f, - 0xe1, 0xd6, 0xda, 0x1a, 0x00, 0x00, 0x65, 0x59, - 0x8a, 0x86, 0x67, 0x59, 0x06, 0x00, 0x1d, 0xc0, - 0x39, 0x3f, 0x5f, 0x22, 0x00, 0x02, 0xa0, 0x05, - 0x54, 0x55, 0xe5, 0x17, 0xe0, 0x7d, 0x02, 0x01, - 0xf0, 0x2d, 0x60, 0x79, 0xba, 0x0e, 0xf6, 0x3c, - 0x0e, 0xeb, 0xf9, 0x00, 0x00, 0xe0, 0x8c, 0xc6, - 0xa7, 0x76, 0x22, 0x80, 0x0a, 0x3b, 0x6a, 0xaf, - 0x69, 0x00, 0x07, 0x2c, 0x76, 0x17, 0x28, 0x8e, - 0xa0, 0x62, 0x42, 0xf2, 0x5a, 0x8f, 0xf3, 0x76, - 0xf4, 0x5e, 0x93, 0xcf, 0x40, 0xca, 0x11, 0x14, - 0x13, 0x14, 0xd7, 0xe1, 0x2a, 0xa6, 0x37, 0xa0, - 0x04, 0x20, 0xa9, 0x43, 0x15, 0x47, 0x1d, 0x80, - 0x04, 0x01, 0x4d, 0x78, 0xda, 0x4c, 0x80, 0x85, - 0x27, 0xd0, 0x84, 0x2b, 0xee, 0x26, 0x21, 0x06, - 0x20, 0x02, 0xee, 0xc7, 0x4d, 0x3b, 0xf2, 0xf6, - 0xb9, 0x18, 0xa0, 0xb0, 0xbd, 0xef, 0x67, 0x05, - 0xdc, 0xf6, 0xab, 0xc1, 0x1e, 0x91, 0x33, 0xf0, - 0xab, 0x0a, 0xbf, 0xe3, 0x00, 0x08, 0x80, 0xff, - 0x01, 0xe4, 0x79, 0xee, 0x0f, 0x60, 0x6d, 0xff, - 0xd5, 0x3a, 0x67, 0x3d, 0x01, 0x06, 0xcf, 0x89, - 0x5d, 0xe0, 0xa7, 0xf0, 0x23, 0x00, 0x00, 0x00, - 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, - 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x00, 0xe5, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd5, + 0x31, 0x12, 0x82, 0x30, 0x10, 0x05, 0xd0, 0xbf, + 0xb0, 0x84, 0xb1, 0xe6, 0x00, 0x5e, 0x81, 0x1b, + 0xd8, 0x7a, 0x0b, 0xad, 0x42, 0x63, 0x65, 0x6b, + 0xab, 0xe3, 0x19, 0x12, 0x2f, 0xe2, 0x51, 0x6c, + 0x2c, 0x3c, 0x00, 0x57, 0x20, 0x16, 0x08, 0x58, + 0x38, 0x20, 0x8c, 0x6c, 0x2c, 0xb2, 0x33, 0x69, + 0x60, 0x27, 0xff, 0xcd, 0x92, 0x09, 0x64, 0x8c, + 0x71, 0xf0, 0x58, 0x0c, 0x00, 0x5a, 0x6b, 0x2f, + 0xe1, 0xd6, 0xda, 0x1a, 0x00, 0x00, 0x65, 0x59, + 0x8a, 0x86, 0x67, 0x59, 0x06, 0x00, 0x1d, 0xc0, + 0x39, 0x3f, 0x5f, 0x22, 0x00, 0x02, 0xa0, 0x05, + 0x54, 0x55, 0xe5, 0x17, 0xe0, 0x7d, 0x02, 0x01, + 0xf0, 0x2d, 0x60, 0x79, 0xba, 0x0e, 0xf6, 0x3c, + 0x0e, 0xeb, 0xf9, 0x00, 0x00, 0xe0, 0x8c, 0xc6, + 0xa7, 0x76, 0x22, 0x80, 0x0a, 0x3b, 0x6a, 0xaf, + 0x69, 0x00, 0x07, 0x2c, 0x76, 0x17, 0x28, 0x8e, + 0xa0, 0x62, 0x42, 0xf2, 0x5a, 0x8f, 0xf3, 0x76, + 0xf4, 0x5e, 0x93, 0xcf, 0x40, 0xca, 0x11, 0x14, + 0x13, 0x14, 0xd7, 0xe1, 0x2a, 0xa6, 0x37, 0xa0, + 0x04, 0x20, 0xa9, 0x43, 0x15, 0x47, 0x1d, 0x80, + 0x04, 0x01, 0x4d, 0x78, 0xda, 0x4c, 0x80, 0x85, + 0x27, 0xd0, 0x84, 0x2b, 0xee, 0x26, 0x21, 0x06, + 0x20, 0x02, 0xee, 0xc7, 0x4d, 0x3b, 0xf2, 0xf6, + 0xb9, 0x18, 0xa0, 0xb0, 0xbd, 0xef, 0x67, 0x05, + 0xdc, 0xf6, 0xab, 0xc1, 0x1e, 0x91, 0x33, 0xf0, + 0xab, 0x0a, 0xbf, 0xe3, 0x00, 0x08, 0x80, 0xff, + 0x01, 0xe4, 0x79, 0xee, 0x0f, 0x60, 0x6d, 0xff, + 0xd5, 0x3a, 0x67, 0x3d, 0x01, 0x06, 0xcf, 0x89, + 0x5d, 0xe0, 0xa7, 0xf0, 0x23, 0x00, 0x00, 0x00, + 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, + 0x82 +}; /* End Of File */ /* rectangular_2_small.png - 248 bytes */ unsigned char rectangular_2_small_png[248] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, - 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, - 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, - 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, - 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, - 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0x54, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x9c, - 0x39, 0x73, 0xe6, 0x7f, 0x06, 0x0a, 0x00, 0x0b, - 0x03, 0x03, 0x03, 0x43, 0x70, 0x70, 0x30, 0x59, - 0x9a, 0xd7, 0xae, 0x5d, 0x0b, 0x31, 0xe0, 0xdf, - 0xbf, 0x7f, 0x94, 0xb9, 0x80, 0x62, 0x03, 0xfe, - 0xfe, 0xfd, 0x3b, 0xc0, 0x2e, 0xc0, 0x66, 0x80, - 0x7c, 0xeb, 0x0e, 0x14, 0xfe, 0xc3, 0x6a, 0x0f, - 0xca, 0x5c, 0x80, 0x4b, 0xcd, 0x20, 0x36, 0xe0, - 0x66, 0xb1, 0x03, 0x75, 0x5d, 0x80, 0x0b, 0x0c, - 0xe2, 0x74, 0x40, 0x92, 0x01, 0x27, 0x4f, 0x9e, - 0x24, 0xdb, 0x00, 0x00, 0x12, 0x29, 0x3f, 0x83, - 0x6d, 0xab, 0x33, 0x49, 0x00, 0x00, 0x00, 0x00, - 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, + 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, + 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, + 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, + 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0x54, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x9c, + 0x39, 0x73, 0xe6, 0x7f, 0x06, 0x0a, 0x00, 0x0b, + 0x03, 0x03, 0x03, 0x43, 0x70, 0x70, 0x30, 0x59, + 0x9a, 0xd7, 0xae, 0x5d, 0x0b, 0x31, 0xe0, 0xdf, + 0xbf, 0x7f, 0x94, 0xb9, 0x80, 0x62, 0x03, 0xfe, + 0xfe, 0xfd, 0x3b, 0xc0, 0x2e, 0xc0, 0x66, 0x80, + 0x7c, 0xeb, 0x0e, 0x14, 0xfe, 0xc3, 0x6a, 0x0f, + 0xca, 0x5c, 0x80, 0x4b, 0xcd, 0x20, 0x36, 0xe0, + 0x66, 0xb1, 0x03, 0x75, 0x5d, 0x80, 0x0b, 0x0c, + 0xe2, 0x74, 0x40, 0x92, 0x01, 0x27, 0x4f, 0x9e, + 0x24, 0xdb, 0x00, 0x00, 0x12, 0x29, 0x3f, 0x83, + 0x6d, 0xab, 0x33, 0x49, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; /* End Of File */ /* rectangular_3.png - 424 bytes */ unsigned char rectangular_3_png[424] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x04, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd5, - 0x31, 0x92, 0x82, 0x30, 0x14, 0xc6, 0xf1, 0xef, - 0xc1, 0xe3, 0x31, 0xd6, 0xd4, 0xde, 0x81, 0x13, - 0xec, 0x01, 0x3c, 0xc3, 0xda, 0x62, 0x63, 0x63, - 0xeb, 0x8c, 0x63, 0xe1, 0x29, 0xc8, 0xde, 0xc3, - 0x4b, 0x58, 0x5a, 0xec, 0x01, 0xac, 0xb9, 0x02, - 0xb1, 0x88, 0x11, 0xb4, 0xd0, 0xe0, 0x98, 0xa4, - 0x49, 0x66, 0xe8, 0x98, 0xfc, 0x7f, 0xbc, 0x30, - 0x40, 0x6d, 0xdb, 0x6a, 0x44, 0x5c, 0x0c, 0x00, - 0x4d, 0xd3, 0x44, 0x89, 0x2b, 0xa5, 0x0c, 0x00, - 0x00, 0xba, 0xae, 0x0b, 0x1a, 0xaf, 0xaa, 0x0a, - 0x00, 0x06, 0x80, 0xd6, 0x71, 0x4e, 0x22, 0x01, - 0x12, 0xe0, 0x0e, 0xe8, 0xfb, 0x3e, 0x2e, 0x20, - 0xfa, 0x04, 0xde, 0x01, 0xe6, 0x87, 0xe3, 0xa4, - 0x8d, 0x2f, 0xbb, 0xc5, 0x77, 0x01, 0x00, 0xa0, - 0xdb, 0x06, 0xef, 0x6e, 0x23, 0x02, 0x68, 0xa5, - 0x9c, 0x27, 0x3a, 0x0d, 0xa0, 0x81, 0xd9, 0xfa, - 0x0f, 0xc2, 0x19, 0x24, 0x27, 0x14, 0x4f, 0x17, - 0xe7, 0x84, 0xf3, 0x7e, 0xe9, 0xbc, 0xdf, 0x64, - 0x00, 0x00, 0x94, 0x9c, 0x41, 0x98, 0x20, 0x6c, - 0xa2, 0x32, 0x8a, 0x17, 0x39, 0x8d, 0xb0, 0xbe, - 0x00, 0x85, 0x89, 0x0a, 0x67, 0x0f, 0x80, 0x22, - 0x14, 0xc0, 0xc6, 0x4b, 0x3b, 0x01, 0x0e, 0x0d, - 0xb8, 0xc5, 0x85, 0x87, 0x49, 0x48, 0x48, 0x80, - 0x8d, 0x97, 0xb7, 0xf0, 0xf8, 0x7d, 0x08, 0x02, - 0xb0, 0xe7, 0x6e, 0xe3, 0xc3, 0x51, 0x18, 0x90, - 0x77, 0x80, 0x79, 0xe2, 0xec, 0x1e, 0x97, 0xa7, - 0x49, 0x78, 0x05, 0x10, 0x01, 0xa7, 0xed, 0xef, - 0xeb, 0x7b, 0xbc, 0x02, 0x56, 0xca, 0x69, 0x53, - 0x2f, 0x80, 0xff, 0xcd, 0x8f, 0x73, 0xfc, 0x23, - 0x40, 0xfa, 0x1d, 0x27, 0x40, 0x02, 0x44, 0x07, - 0xd4, 0x75, 0x1d, 0x0f, 0xa0, 0x94, 0xfb, 0x17, - 0xee, 0xdb, 0xeb, 0x0a, 0x1b, 0x6c, 0x93, 0xa0, - 0x12, 0x6b, 0xcd, 0xa0, 0x00, 0x00, 0x00, 0x00, - 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x04, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0xd5, + 0x31, 0x92, 0x82, 0x30, 0x14, 0xc6, 0xf1, 0xef, + 0xc1, 0xe3, 0x31, 0xd6, 0xd4, 0xde, 0x81, 0x13, + 0xec, 0x01, 0x3c, 0xc3, 0xda, 0x62, 0x63, 0x63, + 0xeb, 0x8c, 0x63, 0xe1, 0x29, 0xc8, 0xde, 0xc3, + 0x4b, 0x58, 0x5a, 0xec, 0x01, 0xac, 0xb9, 0x02, + 0xb1, 0x88, 0x11, 0xb4, 0xd0, 0xe0, 0x98, 0xa4, + 0x49, 0x66, 0xe8, 0x98, 0xfc, 0x7f, 0xbc, 0x30, + 0x40, 0x6d, 0xdb, 0x6a, 0x44, 0x5c, 0x0c, 0x00, + 0x4d, 0xd3, 0x44, 0x89, 0x2b, 0xa5, 0x0c, 0x00, + 0x00, 0xba, 0xae, 0x0b, 0x1a, 0xaf, 0xaa, 0x0a, + 0x00, 0x06, 0x80, 0xd6, 0x71, 0x4e, 0x22, 0x01, + 0x12, 0xe0, 0x0e, 0xe8, 0xfb, 0x3e, 0x2e, 0x20, + 0xfa, 0x04, 0xde, 0x01, 0xe6, 0x87, 0xe3, 0xa4, + 0x8d, 0x2f, 0xbb, 0xc5, 0x77, 0x01, 0x00, 0xa0, + 0xdb, 0x06, 0xef, 0x6e, 0x23, 0x02, 0x68, 0xa5, + 0x9c, 0x27, 0x3a, 0x0d, 0xa0, 0x81, 0xd9, 0xfa, + 0x0f, 0xc2, 0x19, 0x24, 0x27, 0x14, 0x4f, 0x17, + 0xe7, 0x84, 0xf3, 0x7e, 0xe9, 0xbc, 0xdf, 0x64, + 0x00, 0x00, 0x94, 0x9c, 0x41, 0x98, 0x20, 0x6c, + 0xa2, 0x32, 0x8a, 0x17, 0x39, 0x8d, 0xb0, 0xbe, + 0x00, 0x85, 0x89, 0x0a, 0x67, 0x0f, 0x80, 0x22, + 0x14, 0xc0, 0xc6, 0x4b, 0x3b, 0x01, 0x0e, 0x0d, + 0xb8, 0xc5, 0x85, 0x87, 0x49, 0x48, 0x48, 0x80, + 0x8d, 0x97, 0xb7, 0xf0, 0xf8, 0x7d, 0x08, 0x02, + 0xb0, 0xe7, 0x6e, 0xe3, 0xc3, 0x51, 0x18, 0x90, + 0x77, 0x80, 0x79, 0xe2, 0xec, 0x1e, 0x97, 0xa7, + 0x49, 0x78, 0x05, 0x10, 0x01, 0xa7, 0xed, 0xef, + 0xeb, 0x7b, 0xbc, 0x02, 0x56, 0xca, 0x69, 0x53, + 0x2f, 0x80, 0xff, 0xcd, 0x8f, 0x73, 0xfc, 0x23, + 0x40, 0xfa, 0x1d, 0x27, 0x40, 0x02, 0x44, 0x07, + 0xd4, 0x75, 0x1d, 0x0f, 0xa0, 0x94, 0xfb, 0x17, + 0xee, 0xdb, 0xeb, 0x0a, 0x1b, 0x6c, 0x93, 0xa0, + 0x12, 0x6b, 0xcd, 0xa0, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; /* End Of File */ /* rectangular_3_small.png - 276 bytes */ unsigned char rectangular_3_small_png[276] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, - 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, - 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, - 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, - 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, - 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0x70, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x9c, - 0x39, 0x73, 0xe6, 0x7f, 0x06, 0x0a, 0x00, 0x0b, - 0x03, 0x03, 0x03, 0x43, 0x70, 0x70, 0x30, 0x59, - 0x9a, 0xd7, 0xae, 0x5d, 0x0b, 0x31, 0xe0, 0xdf, - 0xbf, 0x7f, 0x94, 0xb9, 0x80, 0x62, 0x03, 0xfe, - 0xfe, 0xfd, 0x4b, 0x5d, 0x17, 0xc8, 0x36, 0x6f, - 0xc3, 0xaa, 0xf8, 0x71, 0xad, 0x17, 0x71, 0x06, - 0xe0, 0x02, 0xd8, 0xd4, 0xd1, 0xc7, 0x00, 0x0e, - 0x56, 0x26, 0x86, 0x1f, 0xbf, 0xff, 0x91, 0x67, - 0x00, 0x07, 0x2b, 0x13, 0x03, 0x0f, 0x3b, 0x05, - 0x06, 0xfc, 0xf8, 0xfd, 0x8f, 0xe1, 0xc7, 0xef, - 0x7f, 0xa4, 0x79, 0xe1, 0x7a, 0xa1, 0x1d, 0x56, - 0xc3, 0x70, 0x1a, 0x40, 0xf5, 0x74, 0x40, 0x7f, - 0x03, 0x4e, 0x9e, 0x3c, 0x49, 0xb6, 0x01, 0x00, - 0x3a, 0xcf, 0x51, 0x68, 0xe4, 0x22, 0x6a, 0xc2, - 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, - 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, + 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, + 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, + 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, + 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0x70, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0x63, 0x9c, + 0x39, 0x73, 0xe6, 0x7f, 0x06, 0x0a, 0x00, 0x0b, + 0x03, 0x03, 0x03, 0x43, 0x70, 0x70, 0x30, 0x59, + 0x9a, 0xd7, 0xae, 0x5d, 0x0b, 0x31, 0xe0, 0xdf, + 0xbf, 0x7f, 0x94, 0xb9, 0x80, 0x62, 0x03, 0xfe, + 0xfe, 0xfd, 0x4b, 0x5d, 0x17, 0xc8, 0x36, 0x6f, + 0xc3, 0xaa, 0xf8, 0x71, 0xad, 0x17, 0x71, 0x06, + 0xe0, 0x02, 0xd8, 0xd4, 0xd1, 0xc7, 0x00, 0x0e, + 0x56, 0x26, 0x86, 0x1f, 0xbf, 0xff, 0x91, 0x67, + 0x00, 0x07, 0x2b, 0x13, 0x03, 0x0f, 0x3b, 0x05, + 0x06, 0xfc, 0xf8, 0xfd, 0x8f, 0xe1, 0xc7, 0xef, + 0x7f, 0xa4, 0x79, 0xe1, 0x7a, 0xa1, 0x1d, 0x56, + 0xc3, 0x70, 0x1a, 0x40, 0xf5, 0x74, 0x40, 0x7f, + 0x03, 0x4e, 0x9e, 0x3c, 0x49, 0xb6, 0x01, 0x00, + 0x3a, 0xcf, 0x51, 0x68, 0xe4, 0x22, 0x6a, 0xc2, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, + 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* rectangular_4.png - 483 bytes */ unsigned char rectangular_4_png[483] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x3f, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x95, - 0x31, 0x52, 0x85, 0x30, 0x10, 0x86, 0xff, 0x4d, - 0x96, 0x30, 0xaf, 0xa6, 0xf5, 0x10, 0xf4, 0x1e, - 0xc1, 0x13, 0x38, 0xf6, 0xbc, 0xc6, 0x79, 0x33, - 0x96, 0x36, 0x16, 0xde, 0x82, 0x78, 0x0e, 0x3b, - 0x0f, 0xe0, 0x01, 0x3c, 0x82, 0x2d, 0x57, 0x00, - 0x0b, 0x12, 0x08, 0x0c, 0x84, 0x3c, 0x25, 0xa6, - 0x61, 0x67, 0xe8, 0x98, 0xfd, 0x3e, 0xfe, 0xdd, - 0x1d, 0xa8, 0xae, 0xeb, 0x0e, 0x09, 0x8b, 0x01, - 0xa0, 0xaa, 0xaa, 0x24, 0x70, 0xad, 0x75, 0x2f, - 0x00, 0x00, 0x4d, 0xd3, 0xfc, 0x2b, 0xbc, 0x28, - 0x0a, 0x00, 0x18, 0x05, 0xba, 0x2e, 0xcd, 0x24, - 0x0e, 0x81, 0x43, 0x60, 0x10, 0x68, 0xdb, 0x36, - 0xad, 0x80, 0x2f, 0x81, 0x9b, 0xd7, 0xf7, 0x5f, - 0x03, 0xbe, 0x5f, 0xee, 0xfe, 0x2e, 0x00, 0x00, - 0x5d, 0x5d, 0x21, 0x78, 0x4a, 0x04, 0x10, 0x00, - 0x3a, 0xeb, 0xcd, 0xbe, 0xe1, 0x02, 0x1d, 0x70, - 0x7a, 0x7c, 0x83, 0x62, 0x01, 0x25, 0x09, 0xd9, - 0xec, 0x61, 0x49, 0x60, 0x01, 0xb0, 0x24, 0x48, - 0x22, 0x7c, 0x3e, 0x3f, 0x04, 0xf5, 0xbd, 0x6a, - 0x09, 0x73, 0x16, 0x50, 0x4c, 0x50, 0xdc, 0x43, - 0x95, 0x03, 0xcf, 0x24, 0x81, 0x45, 0xff, 0x48, - 0xe1, 0x8a, 0xef, 0x29, 0x90, 0xf5, 0x50, 0xc5, - 0x62, 0x22, 0xb0, 0x94, 0x42, 0x14, 0x01, 0x0b, - 0xcf, 0x6d, 0x02, 0xbc, 0x30, 0x0a, 0x93, 0x42, - 0x1c, 0x01, 0x03, 0x57, 0x3c, 0x26, 0xb1, 0x96, - 0x42, 0x14, 0x01, 0x0b, 0xcf, 0x0d, 0xd8, 0xdd, - 0x87, 0x79, 0x0a, 0x51, 0x04, 0xec, 0xdc, 0x2d, - 0x7c, 0x1c, 0xc5, 0x34, 0x89, 0x78, 0x3b, 0xc0, - 0x06, 0x66, 0xe0, 0xca, 0x93, 0xc4, 0xfe, 0x02, - 0xe4, 0x24, 0xe0, 0x9c, 0xe1, 0xda, 0x65, 0xec, - 0x2f, 0x00, 0x4c, 0xbe, 0xd0, 0x26, 0xb1, 0x76, - 0x19, 0xd4, 0x3b, 0x47, 0x14, 0x18, 0xa2, 0x5f, - 0xbe, 0x8c, 0xd0, 0xbe, 0xc1, 0x02, 0x04, 0xe0, - 0xe3, 0xe9, 0x7e, 0xf3, 0x9d, 0x79, 0x05, 0x0b, - 0x6c, 0xfd, 0x8e, 0xe9, 0xac, 0xaf, 0x87, 0x07, - 0xf4, 0x0d, 0x4a, 0xe0, 0xeb, 0x72, 0xeb, 0x6d, - 0xe2, 0xab, 0x5d, 0x77, 0x20, 0x46, 0x1d, 0x02, - 0x87, 0xc0, 0x20, 0x50, 0x96, 0x65, 0x3a, 0x01, - 0xad, 0xfd, 0x37, 0x1e, 0xb3, 0x7e, 0x00, 0x5a, - 0x4d, 0x9f, 0x6b, 0xab, 0xa8, 0x9d, 0x1d, 0x00, - 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, - 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x3f, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x95, + 0x31, 0x52, 0x85, 0x30, 0x10, 0x86, 0xff, 0x4d, + 0x96, 0x30, 0xaf, 0xa6, 0xf5, 0x10, 0xf4, 0x1e, + 0xc1, 0x13, 0x38, 0xf6, 0xbc, 0xc6, 0x79, 0x33, + 0x96, 0x36, 0x16, 0xde, 0x82, 0x78, 0x0e, 0x3b, + 0x0f, 0xe0, 0x01, 0x3c, 0x82, 0x2d, 0x57, 0x00, + 0x0b, 0x12, 0x08, 0x0c, 0x84, 0x3c, 0x25, 0xa6, + 0x61, 0x67, 0xe8, 0x98, 0xfd, 0x3e, 0xfe, 0xdd, + 0x1d, 0xa8, 0xae, 0xeb, 0x0e, 0x09, 0x8b, 0x01, + 0xa0, 0xaa, 0xaa, 0x24, 0x70, 0xad, 0x75, 0x2f, + 0x00, 0x00, 0x4d, 0xd3, 0xfc, 0x2b, 0xbc, 0x28, + 0x0a, 0x00, 0x18, 0x05, 0xba, 0x2e, 0xcd, 0x24, + 0x0e, 0x81, 0x43, 0x60, 0x10, 0x68, 0xdb, 0x36, + 0xad, 0x80, 0x2f, 0x81, 0x9b, 0xd7, 0xf7, 0x5f, + 0x03, 0xbe, 0x5f, 0xee, 0xfe, 0x2e, 0x00, 0x00, + 0x5d, 0x5d, 0x21, 0x78, 0x4a, 0x04, 0x10, 0x00, + 0x3a, 0xeb, 0xcd, 0xbe, 0xe1, 0x02, 0x1d, 0x70, + 0x7a, 0x7c, 0x83, 0x62, 0x01, 0x25, 0x09, 0xd9, + 0xec, 0x61, 0x49, 0x60, 0x01, 0xb0, 0x24, 0x48, + 0x22, 0x7c, 0x3e, 0x3f, 0x04, 0xf5, 0xbd, 0x6a, + 0x09, 0x73, 0x16, 0x50, 0x4c, 0x50, 0xdc, 0x43, + 0x95, 0x03, 0xcf, 0x24, 0x81, 0x45, 0xff, 0x48, + 0xe1, 0x8a, 0xef, 0x29, 0x90, 0xf5, 0x50, 0xc5, + 0x62, 0x22, 0xb0, 0x94, 0x42, 0x14, 0x01, 0x0b, + 0xcf, 0x6d, 0x02, 0xbc, 0x30, 0x0a, 0x93, 0x42, + 0x1c, 0x01, 0x03, 0x57, 0x3c, 0x26, 0xb1, 0x96, + 0x42, 0x14, 0x01, 0x0b, 0xcf, 0x0d, 0xd8, 0xdd, + 0x87, 0x79, 0x0a, 0x51, 0x04, 0xec, 0xdc, 0x2d, + 0x7c, 0x1c, 0xc5, 0x34, 0x89, 0x78, 0x3b, 0xc0, + 0x06, 0x66, 0xe0, 0xca, 0x93, 0xc4, 0xfe, 0x02, + 0xe4, 0x24, 0xe0, 0x9c, 0xe1, 0xda, 0x65, 0xec, + 0x2f, 0x00, 0x4c, 0xbe, 0xd0, 0x26, 0xb1, 0x76, + 0x19, 0xd4, 0x3b, 0x47, 0x14, 0x18, 0xa2, 0x5f, + 0xbe, 0x8c, 0xd0, 0xbe, 0xc1, 0x02, 0x04, 0xe0, + 0xe3, 0xe9, 0x7e, 0xf3, 0x9d, 0x79, 0x05, 0x0b, + 0x6c, 0xfd, 0x8e, 0xe9, 0xac, 0xaf, 0x87, 0x07, + 0xf4, 0x0d, 0x4a, 0xe0, 0xeb, 0x72, 0xeb, 0x6d, + 0xe2, 0xab, 0x5d, 0x77, 0x20, 0x46, 0x1d, 0x02, + 0x87, 0xc0, 0x20, 0x50, 0x96, 0x65, 0x3a, 0x01, + 0xad, 0xfd, 0x37, 0x1e, 0xb3, 0x7e, 0x00, 0x5a, + 0x4d, 0x9f, 0x6b, 0xab, 0xa8, 0x9d, 0x1d, 0x00, + 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, + 0x42, 0x60, 0x82 +}; /* End Of File */ /* rectangular_4_small.png - 333 bytes */ unsigned char rectangular_4_small_png[333] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, - 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, - 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, - 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, - 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, - 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0xa9, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xad, 0xd2, - 0xb1, 0x0d, 0x02, 0x21, 0x18, 0x05, 0xe0, 0x07, - 0x27, 0xc7, 0xe5, 0x60, 0x03, 0x47, 0x71, 0x05, - 0x3b, 0xf6, 0x70, 0x05, 0xe3, 0x18, 0x0c, 0x41, - 0xe7, 0x12, 0xf4, 0xae, 0xe0, 0x00, 0x54, 0x54, - 0x80, 0x05, 0xf1, 0x42, 0xbc, 0x3b, 0x23, 0xe0, - 0x2b, 0xc9, 0xff, 0xbe, 0xbc, 0x02, 0xa2, 0xb5, - 0x4e, 0xe8, 0xc8, 0x01, 0x00, 0x94, 0x52, 0x4d, - 0x65, 0x63, 0x4c, 0x06, 0x62, 0x8c, 0x7d, 0x0b, - 0xba, 0x81, 0x10, 0xc2, 0xf2, 0x70, 0xbc, 0xdd, - 0xbf, 0x16, 0x9e, 0xd7, 0x73, 0xdb, 0x02, 0x42, - 0x80, 0x94, 0xd6, 0xb7, 0x3f, 0x01, 0x6c, 0x20, - 0x98, 0x47, 0x0a, 0xe7, 0x43, 0x3d, 0x30, 0x31, - 0x8a, 0x79, 0xa4, 0x10, 0x2d, 0xc0, 0xc4, 0x28, - 0x24, 0xa7, 0x10, 0x3c, 0x03, 0x5b, 0xb7, 0xbb, - 0xc0, 0x7b, 0xb6, 0xe0, 0x14, 0x92, 0x0f, 0x90, - 0xbc, 0x02, 0x20, 0x04, 0xcb, 0x6c, 0x31, 0xe6, - 0x15, 0x55, 0x40, 0x4a, 0x80, 0xf3, 0x01, 0xce, - 0x07, 0x7c, 0x66, 0x13, 0x28, 0xff, 0xc1, 0xe3, - 0x72, 0x5a, 0x95, 0xca, 0x94, 0xb7, 0xbb, 0x0b, - 0x6a, 0xf2, 0x1f, 0xc0, 0x5a, 0xdb, 0x0c, 0xbc, - 0x00, 0x5b, 0x39, 0x5c, 0x43, 0x69, 0xfb, 0xe6, - 0x30, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, - 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, + 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, + 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, + 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, + 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0xa9, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xad, 0xd2, + 0xb1, 0x0d, 0x02, 0x21, 0x18, 0x05, 0xe0, 0x07, + 0x27, 0xc7, 0xe5, 0x60, 0x03, 0x47, 0x71, 0x05, + 0x3b, 0xf6, 0x70, 0x05, 0xe3, 0x18, 0x0c, 0x41, + 0xe7, 0x12, 0xf4, 0xae, 0xe0, 0x00, 0x54, 0x54, + 0x80, 0x05, 0xf1, 0x42, 0xbc, 0x3b, 0x23, 0xe0, + 0x2b, 0xc9, 0xff, 0xbe, 0xbc, 0x02, 0xa2, 0xb5, + 0x4e, 0xe8, 0xc8, 0x01, 0x00, 0x94, 0x52, 0x4d, + 0x65, 0x63, 0x4c, 0x06, 0x62, 0x8c, 0x7d, 0x0b, + 0xba, 0x81, 0x10, 0xc2, 0xf2, 0x70, 0xbc, 0xdd, + 0xbf, 0x16, 0x9e, 0xd7, 0x73, 0xdb, 0x02, 0x42, + 0x80, 0x94, 0xd6, 0xb7, 0x3f, 0x01, 0x6c, 0x20, + 0x98, 0x47, 0x0a, 0xe7, 0x43, 0x3d, 0x30, 0x31, + 0x8a, 0x79, 0xa4, 0x10, 0x2d, 0xc0, 0xc4, 0x28, + 0x24, 0xa7, 0x10, 0x3c, 0x03, 0x5b, 0xb7, 0xbb, + 0xc0, 0x7b, 0xb6, 0xe0, 0x14, 0x92, 0x0f, 0x90, + 0xbc, 0x02, 0x20, 0x04, 0xcb, 0x6c, 0x31, 0xe6, + 0x15, 0x55, 0x40, 0x4a, 0x80, 0xf3, 0x01, 0xce, + 0x07, 0x7c, 0x66, 0x13, 0x28, 0xff, 0xc1, 0xe3, + 0x72, 0x5a, 0x95, 0xca, 0x94, 0xb7, 0xbb, 0x0b, + 0x6a, 0xf2, 0x1f, 0xc0, 0x5a, 0xdb, 0x0c, 0xbc, + 0x00, 0x5b, 0x39, 0x5c, 0x43, 0x69, 0xfb, 0xe6, + 0x30, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, + 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* rectangular_5.png - 535 bytes */ unsigned char rectangular_5_png[535] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x73, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x95, - 0x4f, 0x4e, 0x84, 0x30, 0x14, 0x87, 0x7f, 0xaf, - 0x7d, 0x94, 0xb8, 0x66, 0xe5, 0x2d, 0x58, 0x7b, - 0x08, 0x97, 0x2e, 0x3c, 0x00, 0x93, 0x18, 0xdd, - 0xb9, 0x37, 0x1e, 0x83, 0x7a, 0x08, 0x13, 0x4f, - 0xe0, 0x1d, 0x3c, 0xc4, 0xac, 0xb8, 0x02, 0x75, - 0x01, 0x1d, 0xfe, 0x4c, 0x5b, 0x6a, 0x28, 0x32, - 0x8b, 0x69, 0xd2, 0x04, 0x02, 0xf4, 0xf7, 0xf1, - 0x3d, 0x1e, 0xa5, 0xba, 0xae, 0x0d, 0x76, 0x1c, - 0x0c, 0x00, 0x55, 0x55, 0xed, 0x12, 0xae, 0xb5, - 0xee, 0x00, 0x00, 0xa0, 0x69, 0x9a, 0x7f, 0x0d, - 0x2f, 0x8a, 0x02, 0x00, 0x06, 0x00, 0x63, 0xf6, - 0xa9, 0xc4, 0x15, 0xe0, 0xb2, 0x01, 0x6e, 0xdf, - 0xbe, 0x92, 0x84, 0x1c, 0xdf, 0xef, 0x97, 0x01, - 0xda, 0xb6, 0x75, 0xde, 0x60, 0xea, 0x0a, 0xd1, - 0x72, 0xe8, 0xfc, 0x94, 0x0e, 0xda, 0xbb, 0xf6, - 0x04, 0xc0, 0x57, 0x02, 0x63, 0x80, 0x9b, 0xe7, - 0x0f, 0x28, 0x16, 0x50, 0x92, 0x90, 0xcd, 0x26, - 0x4b, 0x02, 0x0b, 0x80, 0x25, 0x41, 0x12, 0x41, - 0x0a, 0x40, 0x0a, 0x82, 0x20, 0xe0, 0xfb, 0xf5, - 0x31, 0xb8, 0x76, 0x14, 0x00, 0x00, 0xe4, 0x2c, - 0xa0, 0x98, 0xa0, 0xb8, 0x0b, 0x55, 0xa3, 0xf0, - 0x4c, 0x12, 0x58, 0x74, 0xd3, 0x86, 0xcb, 0xfe, - 0x38, 0x66, 0xed, 0x38, 0x80, 0xac, 0x0b, 0x55, - 0x2c, 0x26, 0x00, 0x21, 0x0b, 0x82, 0x86, 0x7a, - 0xac, 0x06, 0xb0, 0xe1, 0xb9, 0x35, 0xc0, 0x8e, - 0x52, 0x38, 0x2c, 0xa4, 0x03, 0xe8, 0xc3, 0x15, - 0x0f, 0x26, 0x62, 0x2c, 0x24, 0x03, 0xb0, 0xe1, - 0x79, 0x1f, 0x3c, 0xfe, 0x1e, 0x42, 0x16, 0x92, - 0x01, 0xd8, 0xba, 0xdb, 0xf0, 0xa1, 0x14, 0x53, - 0x13, 0x73, 0x0b, 0xc9, 0x00, 0xba, 0x37, 0x16, - 0xa7, 0x70, 0x15, 0x30, 0x31, 0xb6, 0x90, 0x06, - 0x80, 0x46, 0x06, 0x46, 0x6d, 0xe8, 0xeb, 0x8c, - 0xb1, 0x05, 0xea, 0x1e, 0x4f, 0x53, 0x02, 0x3b, - 0xad, 0x89, 0x50, 0x67, 0x58, 0x0b, 0x69, 0x0c, - 0xcc, 0x01, 0x4e, 0xea, 0xfd, 0x9d, 0x61, 0x2d, - 0x6c, 0x02, 0x30, 0x9f, 0x4a, 0xd2, 0xd9, 0x9f, - 0xd2, 0x5a, 0x48, 0x06, 0xc0, 0x62, 0xf8, 0xed, - 0xba, 0x4c, 0x28, 0x87, 0x09, 0x96, 0xa9, 0x01, - 0xc4, 0x02, 0x88, 0xc3, 0xc4, 0x9f, 0x00, 0x7c, - 0x5b, 0x26, 0x01, 0xf8, 0x7c, 0x7a, 0xf0, 0x5e, - 0x8b, 0x19, 0xab, 0xb6, 0x63, 0x3a, 0x68, 0xef, - 0xc3, 0x31, 0x00, 0x26, 0xb0, 0xf6, 0x22, 0xc0, - 0xcf, 0xcb, 0x5d, 0x44, 0x44, 0x04, 0xc4, 0xda, - 0x6f, 0x60, 0xcb, 0x71, 0x05, 0xb8, 0x1c, 0x80, - 0xb2, 0x2c, 0xf7, 0x03, 0xd0, 0xda, 0xdf, 0x6a, - 0x5b, 0x8f, 0x5f, 0x96, 0x85, 0xaa, 0x93, 0xfe, - 0x48, 0x7c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x49, - 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0x73, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x95, + 0x4f, 0x4e, 0x84, 0x30, 0x14, 0x87, 0x7f, 0xaf, + 0x7d, 0x94, 0xb8, 0x66, 0xe5, 0x2d, 0x58, 0x7b, + 0x08, 0x97, 0x2e, 0x3c, 0x00, 0x93, 0x18, 0xdd, + 0xb9, 0x37, 0x1e, 0x83, 0x7a, 0x08, 0x13, 0x4f, + 0xe0, 0x1d, 0x3c, 0xc4, 0xac, 0xb8, 0x02, 0x75, + 0x01, 0x1d, 0xfe, 0x4c, 0x5b, 0x6a, 0x28, 0x32, + 0x8b, 0x69, 0xd2, 0x04, 0x02, 0xf4, 0xf7, 0xf1, + 0x3d, 0x1e, 0xa5, 0xba, 0xae, 0x0d, 0x76, 0x1c, + 0x0c, 0x00, 0x55, 0x55, 0xed, 0x12, 0xae, 0xb5, + 0xee, 0x00, 0x00, 0xa0, 0x69, 0x9a, 0x7f, 0x0d, + 0x2f, 0x8a, 0x02, 0x00, 0x06, 0x00, 0x63, 0xf6, + 0xa9, 0xc4, 0x15, 0xe0, 0xb2, 0x01, 0x6e, 0xdf, + 0xbe, 0x92, 0x84, 0x1c, 0xdf, 0xef, 0x97, 0x01, + 0xda, 0xb6, 0x75, 0xde, 0x60, 0xea, 0x0a, 0xd1, + 0x72, 0xe8, 0xfc, 0x94, 0x0e, 0xda, 0xbb, 0xf6, + 0x04, 0xc0, 0x57, 0x02, 0x63, 0x80, 0x9b, 0xe7, + 0x0f, 0x28, 0x16, 0x50, 0x92, 0x90, 0xcd, 0x26, + 0x4b, 0x02, 0x0b, 0x80, 0x25, 0x41, 0x12, 0x41, + 0x0a, 0x40, 0x0a, 0x82, 0x20, 0xe0, 0xfb, 0xf5, + 0x31, 0xb8, 0x76, 0x14, 0x00, 0x00, 0xe4, 0x2c, + 0xa0, 0x98, 0xa0, 0xb8, 0x0b, 0x55, 0xa3, 0xf0, + 0x4c, 0x12, 0x58, 0x74, 0xd3, 0x86, 0xcb, 0xfe, + 0x38, 0x66, 0xed, 0x38, 0x80, 0xac, 0x0b, 0x55, + 0x2c, 0x26, 0x00, 0x21, 0x0b, 0x82, 0x86, 0x7a, + 0xac, 0x06, 0xb0, 0xe1, 0xb9, 0x35, 0xc0, 0x8e, + 0x52, 0x38, 0x2c, 0xa4, 0x03, 0xe8, 0xc3, 0x15, + 0x0f, 0x26, 0x62, 0x2c, 0x24, 0x03, 0xb0, 0xe1, + 0x79, 0x1f, 0x3c, 0xfe, 0x1e, 0x42, 0x16, 0x92, + 0x01, 0xd8, 0xba, 0xdb, 0xf0, 0xa1, 0x14, 0x53, + 0x13, 0x73, 0x0b, 0xc9, 0x00, 0xba, 0x37, 0x16, + 0xa7, 0x70, 0x15, 0x30, 0x31, 0xb6, 0x90, 0x06, + 0x80, 0x46, 0x06, 0x46, 0x6d, 0xe8, 0xeb, 0x8c, + 0xb1, 0x05, 0xea, 0x1e, 0x4f, 0x53, 0x02, 0x3b, + 0xad, 0x89, 0x50, 0x67, 0x58, 0x0b, 0x69, 0x0c, + 0xcc, 0x01, 0x4e, 0xea, 0xfd, 0x9d, 0x61, 0x2d, + 0x6c, 0x02, 0x30, 0x9f, 0x4a, 0xd2, 0xd9, 0x9f, + 0xd2, 0x5a, 0x48, 0x06, 0xc0, 0x62, 0xf8, 0xed, + 0xba, 0x4c, 0x28, 0x87, 0x09, 0x96, 0xa9, 0x01, + 0xc4, 0x02, 0x88, 0xc3, 0xc4, 0x9f, 0x00, 0x7c, + 0x5b, 0x26, 0x01, 0xf8, 0x7c, 0x7a, 0xf0, 0x5e, + 0x8b, 0x19, 0xab, 0xb6, 0x63, 0x3a, 0x68, 0xef, + 0xc3, 0x31, 0x00, 0x26, 0xb0, 0xf6, 0x22, 0xc0, + 0xcf, 0xcb, 0x5d, 0x44, 0x44, 0x04, 0xc4, 0xda, + 0x6f, 0x60, 0xcb, 0x71, 0x05, 0xb8, 0x1c, 0x80, + 0xb2, 0x2c, 0xf7, 0x03, 0xd0, 0xda, 0xdf, 0x6a, + 0x5b, 0x8f, 0x5f, 0x96, 0x85, 0xaa, 0x93, 0xfe, + 0x48, 0x7c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x49, + 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* rectangular_5_small.png - 375 bytes */ unsigned char rectangular_5_small_png[375] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, - 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, - 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, - 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, - 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, - 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0xd3, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0xd2, - 0xbb, 0x15, 0x83, 0x30, 0x0c, 0x05, 0xd0, 0x27, - 0x81, 0xfc, 0xc1, 0x0c, 0x90, 0x55, 0x32, 0x45, - 0x0a, 0xd6, 0xc8, 0x0c, 0x29, 0xb2, 0x05, 0x43, - 0x50, 0x64, 0x0c, 0xda, 0x4c, 0x91, 0x8e, 0x8e, - 0xce, 0x24, 0x85, 0xf9, 0xe6, 0x04, 0xe2, 0x03, - 0xaa, 0xa5, 0xeb, 0x67, 0x5b, 0x54, 0x96, 0xe5, - 0x1b, 0x07, 0x2a, 0x05, 0x80, 0xa2, 0x28, 0x76, - 0x0d, 0x57, 0x55, 0x15, 0x80, 0xae, 0xeb, 0x8e, - 0x25, 0x18, 0x80, 0xd3, 0xed, 0x11, 0x35, 0xf4, - 0xba, 0x5f, 0x96, 0x80, 0xf7, 0x7e, 0x73, 0x80, - 0x08, 0x30, 0x29, 0xc3, 0x08, 0xa1, 0x69, 0xfd, - 0xa2, 0xff, 0xef, 0x15, 0x24, 0x21, 0x64, 0x8a, - 0x61, 0x65, 0x02, 0xe6, 0xfd, 0x9b, 0x80, 0x11, - 0x46, 0xa6, 0x18, 0x4e, 0x31, 0xac, 0x62, 0x58, - 0x21, 0x7c, 0xf7, 0xaf, 0x02, 0x46, 0x18, 0xb9, - 0x66, 0x38, 0x1d, 0x80, 0xac, 0x47, 0xa2, 0x80, - 0x21, 0xb6, 0xd3, 0x8c, 0x5c, 0x27, 0xc8, 0x75, - 0x00, 0xb2, 0x18, 0x80, 0x08, 0x63, 0x6c, 0xa7, - 0x42, 0x8a, 0x90, 0x24, 0x81, 0x8b, 0x01, 0x4c, - 0x1a, 0x1e, 0xcc, 0xaa, 0xe9, 0x54, 0xd7, 0xa7, - 0xc8, 0x75, 0x0c, 0x20, 0x04, 0x23, 0x04, 0x2b, - 0x34, 0x22, 0x53, 0x92, 0xe4, 0x37, 0x30, 0xff, - 0xd7, 0xa6, 0xf5, 0x68, 0xda, 0xed, 0xbd, 0x58, - 0xdd, 0x83, 0xe7, 0xf5, 0xbc, 0x39, 0x38, 0x54, - 0xf4, 0x1e, 0xc4, 0x54, 0x0a, 0x00, 0x75, 0x5d, - 0xef, 0x06, 0x3e, 0xd1, 0xce, 0x60, 0x0d, 0x28, - 0x98, 0x26, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x49, - 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, + 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, + 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, + 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, + 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0xd3, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0xd2, + 0xbb, 0x15, 0x83, 0x30, 0x0c, 0x05, 0xd0, 0x27, + 0x81, 0xfc, 0xc1, 0x0c, 0x90, 0x55, 0x32, 0x45, + 0x0a, 0xd6, 0xc8, 0x0c, 0x29, 0xb2, 0x05, 0x43, + 0x50, 0x64, 0x0c, 0xda, 0x4c, 0x91, 0x8e, 0x8e, + 0xce, 0x24, 0x85, 0xf9, 0xe6, 0x04, 0xe2, 0x03, + 0xaa, 0xa5, 0xeb, 0x67, 0x5b, 0x54, 0x96, 0xe5, + 0x1b, 0x07, 0x2a, 0x05, 0x80, 0xa2, 0x28, 0x76, + 0x0d, 0x57, 0x55, 0x15, 0x80, 0xae, 0xeb, 0x8e, + 0x25, 0x18, 0x80, 0xd3, 0xed, 0x11, 0x35, 0xf4, + 0xba, 0x5f, 0x96, 0x80, 0xf7, 0x7e, 0x73, 0x80, + 0x08, 0x30, 0x29, 0xc3, 0x08, 0xa1, 0x69, 0xfd, + 0xa2, 0xff, 0xef, 0x15, 0x24, 0x21, 0x64, 0x8a, + 0x61, 0x65, 0x02, 0xe6, 0xfd, 0x9b, 0x80, 0x11, + 0x46, 0xa6, 0x18, 0x4e, 0x31, 0xac, 0x62, 0x58, + 0x21, 0x7c, 0xf7, 0xaf, 0x02, 0x46, 0x18, 0xb9, + 0x66, 0x38, 0x1d, 0x80, 0xac, 0x47, 0xa2, 0x80, + 0x21, 0xb6, 0xd3, 0x8c, 0x5c, 0x27, 0xc8, 0x75, + 0x00, 0xb2, 0x18, 0x80, 0x08, 0x63, 0x6c, 0xa7, + 0x42, 0x8a, 0x90, 0x24, 0x81, 0x8b, 0x01, 0x4c, + 0x1a, 0x1e, 0xcc, 0xaa, 0xe9, 0x54, 0xd7, 0xa7, + 0xc8, 0x75, 0x0c, 0x20, 0x04, 0x23, 0x04, 0x2b, + 0x34, 0x22, 0x53, 0x92, 0xe4, 0x37, 0x30, 0xff, + 0xd7, 0xa6, 0xf5, 0x68, 0xda, 0xed, 0xbd, 0x58, + 0xdd, 0x83, 0xe7, 0xf5, 0xbc, 0x39, 0x38, 0x54, + 0xf4, 0x1e, 0xc4, 0x54, 0x0a, 0x00, 0x75, 0x5d, + 0xef, 0x06, 0x3e, 0xd1, 0xce, 0x60, 0x0d, 0x28, + 0x98, 0x26, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x49, + 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* rectangular_6.png - 600 bytes */ unsigned char rectangular_6_png[600] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xb4, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x95, - 0x31, 0x52, 0xc3, 0x30, 0x10, 0x45, 0xff, 0xae, - 0x36, 0xca, 0x50, 0xa7, 0xe1, 0x18, 0x29, 0xb9, - 0x05, 0x0d, 0x0d, 0x3d, 0xe3, 0x14, 0xd0, 0x70, - 0x01, 0x0a, 0x6e, 0x61, 0xd1, 0xd3, 0xd3, 0x73, - 0x09, 0x6e, 0x41, 0x93, 0x2b, 0xc4, 0x14, 0xb2, - 0x2c, 0x45, 0x48, 0x8e, 0x6c, 0x05, 0x4c, 0x81, - 0x66, 0x3c, 0xe3, 0x49, 0x66, 0xf4, 0x9f, 0xde, - 0xee, 0xca, 0xd4, 0xb6, 0x6d, 0x87, 0x05, 0x97, - 0x00, 0x40, 0xd3, 0x34, 0x8b, 0x84, 0x1b, 0x63, - 0x2c, 0x00, 0x00, 0xec, 0xf7, 0xfb, 0x5f, 0x0d, - 0xdf, 0x6c, 0x36, 0x00, 0xe0, 0x01, 0xba, 0x6e, - 0x99, 0x4a, 0xfc, 0x03, 0x64, 0x01, 0x2e, 0x9f, - 0xde, 0xce, 0x1e, 0xf6, 0xf9, 0x7c, 0x5d, 0x0e, - 0x00, 0x00, 0x5d, 0xdb, 0xa0, 0x58, 0x0c, 0x8d, - 0xff, 0x45, 0x3b, 0x93, 0xcc, 0x18, 0x00, 0x0e, - 0x87, 0xc3, 0x77, 0x80, 0x0e, 0xb8, 0x78, 0x78, - 0x81, 0x16, 0x86, 0x56, 0x84, 0x55, 0xf4, 0x88, - 0x22, 0x08, 0x03, 0xa2, 0x08, 0x8a, 0x08, 0x8a, - 0x01, 0xc5, 0x04, 0x26, 0x80, 0x89, 0x40, 0x04, - 0x10, 0x01, 0xef, 0x8f, 0xb7, 0xd9, 0x8c, 0x93, - 0x3d, 0xb0, 0x16, 0x86, 0x16, 0x82, 0x16, 0x1b, - 0xaa, 0x83, 0xf0, 0x95, 0x22, 0x08, 0xdb, 0xc7, - 0x85, 0xab, 0xfe, 0x9d, 0x89, 0xec, 0xc9, 0x03, - 0x33, 0xa3, 0x06, 0xb2, 0x00, 0x2b, 0x1b, 0xaa, - 0x85, 0x8f, 0x00, 0xc6, 0x2c, 0x30, 0x11, 0x38, - 0x80, 0xa8, 0x02, 0x70, 0xe1, 0x6b, 0x67, 0x40, - 0x12, 0xa5, 0x48, 0x58, 0xb0, 0x65, 0x00, 0x28, - 0x50, 0x30, 0x0f, 0xa0, 0x0f, 0xd7, 0xe2, 0x4d, - 0x4c, 0xb1, 0x50, 0x6d, 0xc0, 0x85, 0xaf, 0xfb, - 0xe0, 0xb0, 0x1f, 0x4a, 0x2c, 0x54, 0xf7, 0x80, - 0xab, 0xbb, 0x0b, 0xf7, 0xa5, 0x38, 0x36, 0x11, - 0x5b, 0x70, 0x3d, 0xc0, 0xb5, 0x00, 0xf6, 0xc4, - 0x3c, 0x84, 0xeb, 0x11, 0x13, 0xb1, 0x85, 0x61, - 0x1c, 0x61, 0x4b, 0x31, 0x1d, 0x80, 0x02, 0x03, - 0xc1, 0x18, 0xe6, 0x26, 0x23, 0x67, 0xa1, 0xca, - 0x40, 0x78, 0x42, 0x67, 0x62, 0x6c, 0x32, 0x62, - 0x0b, 0x67, 0xe9, 0x81, 0x01, 0x60, 0x50, 0x9f, - 0x9f, 0x8c, 0xd0, 0xc2, 0x59, 0x7a, 0x20, 0xee, - 0xf6, 0x18, 0x28, 0xbe, 0x29, 0x63, 0x0b, 0xd5, - 0x25, 0x10, 0xf6, 0xd7, 0x6e, 0xca, 0x84, 0x4e, - 0x98, 0x70, 0x16, 0xdc, 0x38, 0xd6, 0x03, 0xf0, - 0x09, 0x90, 0x84, 0x09, 0x67, 0x81, 0xd9, 0xef, - 0x35, 0x0b, 0x40, 0xf5, 0xf5, 0x1c, 0x05, 0x89, - 0xc6, 0xd4, 0x97, 0x02, 0xe5, 0x06, 0x52, 0x9f, - 0x4a, 0x0b, 0xe0, 0xaf, 0xd7, 0x1c, 0xc8, 0x51, - 0x49, 0x82, 0x3b, 0xc2, 0x59, 0x18, 0xcb, 0x28, - 0x30, 0x10, 0x5c, 0xaf, 0x27, 0x40, 0xdc, 0x48, - 0x86, 0x26, 0xa4, 0xa6, 0x04, 0x04, 0xe0, 0xf5, - 0xee, 0x26, 0xf9, 0xfb, 0xe4, 0x45, 0x73, 0x00, - 0x76, 0x26, 0xb7, 0x57, 0x71, 0xa8, 0xdf, 0x7f, - 0x22, 0xc0, 0xc7, 0xfd, 0x55, 0x69, 0x4c, 0xf1, - 0x9a, 0x35, 0x05, 0x3f, 0xbd, 0xfe, 0x0e, 0xc0, - 0x76, 0xbb, 0x5d, 0x0e, 0xc0, 0x98, 0x74, 0xb3, - 0xfd, 0xc6, 0xfa, 0x02, 0x7d, 0x31, 0xb6, 0xb6, - 0x3f, 0xfe, 0x15, 0xb2, 0x00, 0x00, 0x00, 0x00, - 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xb4, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x95, + 0x31, 0x52, 0xc3, 0x30, 0x10, 0x45, 0xff, 0xae, + 0x36, 0xca, 0x50, 0xa7, 0xe1, 0x18, 0x29, 0xb9, + 0x05, 0x0d, 0x0d, 0x3d, 0xe3, 0x14, 0xd0, 0x70, + 0x01, 0x0a, 0x6e, 0x61, 0xd1, 0xd3, 0xd3, 0x73, + 0x09, 0x6e, 0x41, 0x93, 0x2b, 0xc4, 0x14, 0xb2, + 0x2c, 0x45, 0x48, 0x8e, 0x6c, 0x05, 0x4c, 0x81, + 0x66, 0x3c, 0xe3, 0x49, 0x66, 0xf4, 0x9f, 0xde, + 0xee, 0xca, 0xd4, 0xb6, 0x6d, 0x87, 0x05, 0x97, + 0x00, 0x40, 0xd3, 0x34, 0x8b, 0x84, 0x1b, 0x63, + 0x2c, 0x00, 0x00, 0xec, 0xf7, 0xfb, 0x5f, 0x0d, + 0xdf, 0x6c, 0x36, 0x00, 0xe0, 0x01, 0xba, 0x6e, + 0x99, 0x4a, 0xfc, 0x03, 0x64, 0x01, 0x2e, 0x9f, + 0xde, 0xce, 0x1e, 0xf6, 0xf9, 0x7c, 0x5d, 0x0e, + 0x00, 0x00, 0x5d, 0xdb, 0xa0, 0x58, 0x0c, 0x8d, + 0xff, 0x45, 0x3b, 0x93, 0xcc, 0x18, 0x00, 0x0e, + 0x87, 0xc3, 0x77, 0x80, 0x0e, 0xb8, 0x78, 0x78, + 0x81, 0x16, 0x86, 0x56, 0x84, 0x55, 0xf4, 0x88, + 0x22, 0x08, 0x03, 0xa2, 0x08, 0x8a, 0x08, 0x8a, + 0x01, 0xc5, 0x04, 0x26, 0x80, 0x89, 0x40, 0x04, + 0x10, 0x01, 0xef, 0x8f, 0xb7, 0xd9, 0x8c, 0x93, + 0x3d, 0xb0, 0x16, 0x86, 0x16, 0x82, 0x16, 0x1b, + 0xaa, 0x83, 0xf0, 0x95, 0x22, 0x08, 0xdb, 0xc7, + 0x85, 0xab, 0xfe, 0x9d, 0x89, 0xec, 0xc9, 0x03, + 0x33, 0xa3, 0x06, 0xb2, 0x00, 0x2b, 0x1b, 0xaa, + 0x85, 0x8f, 0x00, 0xc6, 0x2c, 0x30, 0x11, 0x38, + 0x80, 0xa8, 0x02, 0x70, 0xe1, 0x6b, 0x67, 0x40, + 0x12, 0xa5, 0x48, 0x58, 0xb0, 0x65, 0x00, 0x28, + 0x50, 0x30, 0x0f, 0xa0, 0x0f, 0xd7, 0xe2, 0x4d, + 0x4c, 0xb1, 0x50, 0x6d, 0xc0, 0x85, 0xaf, 0xfb, + 0xe0, 0xb0, 0x1f, 0x4a, 0x2c, 0x54, 0xf7, 0x80, + 0xab, 0xbb, 0x0b, 0xf7, 0xa5, 0x38, 0x36, 0x11, + 0x5b, 0x70, 0x3d, 0xc0, 0xb5, 0x00, 0xf6, 0xc4, + 0x3c, 0x84, 0xeb, 0x11, 0x13, 0xb1, 0x85, 0x61, + 0x1c, 0x61, 0x4b, 0x31, 0x1d, 0x80, 0x02, 0x03, + 0xc1, 0x18, 0xe6, 0x26, 0x23, 0x67, 0xa1, 0xca, + 0x40, 0x78, 0x42, 0x67, 0x62, 0x6c, 0x32, 0x62, + 0x0b, 0x67, 0xe9, 0x81, 0x01, 0x60, 0x50, 0x9f, + 0x9f, 0x8c, 0xd0, 0xc2, 0x59, 0x7a, 0x20, 0xee, + 0xf6, 0x18, 0x28, 0xbe, 0x29, 0x63, 0x0b, 0xd5, + 0x25, 0x10, 0xf6, 0xd7, 0x6e, 0xca, 0x84, 0x4e, + 0x98, 0x70, 0x16, 0xdc, 0x38, 0xd6, 0x03, 0xf0, + 0x09, 0x90, 0x84, 0x09, 0x67, 0x81, 0xd9, 0xef, + 0x35, 0x0b, 0x40, 0xf5, 0xf5, 0x1c, 0x05, 0x89, + 0xc6, 0xd4, 0x97, 0x02, 0xe5, 0x06, 0x52, 0x9f, + 0x4a, 0x0b, 0xe0, 0xaf, 0xd7, 0x1c, 0xc8, 0x51, + 0x49, 0x82, 0x3b, 0xc2, 0x59, 0x18, 0xcb, 0x28, + 0x30, 0x10, 0x5c, 0xaf, 0x27, 0x40, 0xdc, 0x48, + 0x86, 0x26, 0xa4, 0xa6, 0x04, 0x04, 0xe0, 0xf5, + 0xee, 0x26, 0xf9, 0xfb, 0xe4, 0x45, 0x73, 0x00, + 0x76, 0x26, 0xb7, 0x57, 0x71, 0xa8, 0xdf, 0x7f, + 0x22, 0xc0, 0xc7, 0xfd, 0x55, 0x69, 0x4c, 0xf1, + 0x9a, 0x35, 0x05, 0x3f, 0xbd, 0xfe, 0x0e, 0xc0, + 0x76, 0xbb, 0x5d, 0x0e, 0xc0, 0x98, 0x74, 0xb3, + 0xfd, 0xc6, 0xfa, 0x02, 0x7d, 0x31, 0xb6, 0xb6, + 0x3f, 0xfe, 0x15, 0xb2, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; /* End Of File */ /* rectangular_6_small.png - 431 bytes */ unsigned char rectangular_6_small_png[431] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, - 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, - 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, - 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, - 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, - 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x01, 0x0b, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, - 0xbd, 0x6d, 0xc4, 0x30, 0x0c, 0x46, 0x3f, 0x52, - 0x12, 0x25, 0x59, 0x4e, 0x9b, 0x55, 0x6e, 0x8e, - 0xc0, 0x5b, 0x64, 0x86, 0x94, 0x59, 0xc2, 0x43, - 0x18, 0x99, 0xc3, 0x5d, 0x76, 0x70, 0x97, 0xc6, - 0xfd, 0x01, 0xd6, 0xa5, 0xa0, 0xff, 0xe2, 0xb3, - 0x1d, 0x5c, 0x42, 0x80, 0x85, 0x00, 0x7d, 0x8f, - 0x8f, 0x00, 0xa9, 0xae, 0xeb, 0x1b, 0xfe, 0x51, - 0x16, 0x00, 0xaa, 0xaa, 0xfa, 0x53, 0xb8, 0x69, - 0x1a, 0x05, 0xe4, 0x9c, 0xf1, 0xfc, 0xf6, 0xf1, - 0x50, 0xf8, 0xeb, 0xfd, 0x65, 0x31, 0xc8, 0x39, - 0x1f, 0x7e, 0x24, 0x02, 0x82, 0x65, 0x04, 0x47, - 0x10, 0xcb, 0x10, 0x43, 0xe8, 0xfa, 0xeb, 0x9c, - 0xb1, 0x00, 0x30, 0x0c, 0xc3, 0x6e, 0xd8, 0x19, - 0x42, 0x21, 0x8c, 0xe8, 0x14, 0xe0, 0x2d, 0x43, - 0x2c, 0xa1, 0xeb, 0x97, 0xcc, 0xa1, 0x41, 0x70, - 0x8c, 0x42, 0x18, 0x49, 0x18, 0x51, 0x18, 0x71, - 0x05, 0x58, 0x67, 0x76, 0x01, 0xc1, 0x31, 0x4a, - 0xcf, 0x48, 0x5e, 0x01, 0xc5, 0x08, 0x09, 0x96, - 0xe1, 0xdd, 0x2f, 0x80, 0x49, 0x3b, 0x79, 0x46, - 0xe9, 0x0d, 0x4a, 0xaf, 0x80, 0x69, 0x95, 0x53, - 0x00, 0x11, 0x66, 0xed, 0x24, 0x6a, 0xa1, 0x26, - 0x66, 0x5e, 0x25, 0x9c, 0x01, 0x82, 0xd5, 0x29, - 0x51, 0x96, 0xa9, 0x69, 0xb4, 0x98, 0x4c, 0xa2, - 0x30, 0xe8, 0x10, 0xe0, 0x08, 0xc1, 0x11, 0xa2, - 0xa3, 0x19, 0xb2, 0x98, 0x18, 0xa4, 0x11, 0x72, - 0x68, 0x20, 0x96, 0xe1, 0xc7, 0xde, 0xda, 0x24, - 0xcf, 0x78, 0x0a, 0xba, 0xca, 0x3a, 0xc3, 0xeb, - 0x3b, 0x10, 0x43, 0x10, 0xab, 0xed, 0x9d, 0x76, - 0xd8, 0xda, 0x04, 0x05, 0xec, 0xde, 0x41, 0xd7, - 0x5f, 0xd1, 0xf5, 0x77, 0x27, 0x01, 0xda, 0xbc, - 0x6f, 0x7b, 0x2b, 0x7c, 0xbe, 0x5e, 0xee, 0x93, - 0x27, 0xf5, 0x03, 0xd0, 0xb6, 0xed, 0x43, 0xe1, - 0x75, 0x7d, 0x03, 0x40, 0x83, 0x66, 0xce, 0xc2, - 0x80, 0x62, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x49, - 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, + 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, + 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, + 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, + 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x01, 0x0b, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, + 0xbd, 0x6d, 0xc4, 0x30, 0x0c, 0x46, 0x3f, 0x52, + 0x12, 0x25, 0x59, 0x4e, 0x9b, 0x55, 0x6e, 0x8e, + 0xc0, 0x5b, 0x64, 0x86, 0x94, 0x59, 0xc2, 0x43, + 0x18, 0x99, 0xc3, 0x5d, 0x76, 0x70, 0x97, 0xc6, + 0xfd, 0x01, 0xd6, 0xa5, 0xa0, 0xff, 0xe2, 0xb3, + 0x1d, 0x5c, 0x42, 0x80, 0x85, 0x00, 0x7d, 0x8f, + 0x8f, 0x00, 0xa9, 0xae, 0xeb, 0x1b, 0xfe, 0x51, + 0x16, 0x00, 0xaa, 0xaa, 0xfa, 0x53, 0xb8, 0x69, + 0x1a, 0x05, 0xe4, 0x9c, 0xf1, 0xfc, 0xf6, 0xf1, + 0x50, 0xf8, 0xeb, 0xfd, 0x65, 0x31, 0xc8, 0x39, + 0x1f, 0x7e, 0x24, 0x02, 0x82, 0x65, 0x04, 0x47, + 0x10, 0xcb, 0x10, 0x43, 0xe8, 0xfa, 0xeb, 0x9c, + 0xb1, 0x00, 0x30, 0x0c, 0xc3, 0x6e, 0xd8, 0x19, + 0x42, 0x21, 0x8c, 0xe8, 0x14, 0xe0, 0x2d, 0x43, + 0x2c, 0xa1, 0xeb, 0x97, 0xcc, 0xa1, 0x41, 0x70, + 0x8c, 0x42, 0x18, 0x49, 0x18, 0x51, 0x18, 0x71, + 0x05, 0x58, 0x67, 0x76, 0x01, 0xc1, 0x31, 0x4a, + 0xcf, 0x48, 0x5e, 0x01, 0xc5, 0x08, 0x09, 0x96, + 0xe1, 0xdd, 0x2f, 0x80, 0x49, 0x3b, 0x79, 0x46, + 0xe9, 0x0d, 0x4a, 0xaf, 0x80, 0x69, 0x95, 0x53, + 0x00, 0x11, 0x66, 0xed, 0x24, 0x6a, 0xa1, 0x26, + 0x66, 0x5e, 0x25, 0x9c, 0x01, 0x82, 0xd5, 0x29, + 0x51, 0x96, 0xa9, 0x69, 0xb4, 0x98, 0x4c, 0xa2, + 0x30, 0xe8, 0x10, 0xe0, 0x08, 0xc1, 0x11, 0xa2, + 0xa3, 0x19, 0xb2, 0x98, 0x18, 0xa4, 0x11, 0x72, + 0x68, 0x20, 0x96, 0xe1, 0xc7, 0xde, 0xda, 0x24, + 0xcf, 0x78, 0x0a, 0xba, 0xca, 0x3a, 0xc3, 0xeb, + 0x3b, 0x10, 0x43, 0x10, 0xab, 0xed, 0x9d, 0x76, + 0xd8, 0xda, 0x04, 0x05, 0xec, 0xde, 0x41, 0xd7, + 0x5f, 0xd1, 0xf5, 0x77, 0x27, 0x01, 0xda, 0xbc, + 0x6f, 0x7b, 0x2b, 0x7c, 0xbe, 0x5e, 0xee, 0x93, + 0x27, 0xf5, 0x03, 0xd0, 0xb6, 0xed, 0x43, 0xe1, + 0x75, 0x7d, 0x03, 0x40, 0x83, 0x66, 0xce, 0xc2, + 0x80, 0x62, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x49, + 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* rectangular_7.png - 697 bytes */ unsigned char rectangular_7_png[697] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, - 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x15, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xc5, 0x96, - 0x4d, 0x6e, 0xdb, 0x30, 0x10, 0x85, 0xdf, 0x1b, - 0xd2, 0x34, 0xb2, 0x36, 0x90, 0x73, 0x78, 0xd7, - 0x73, 0x14, 0x5d, 0x75, 0xd9, 0x8d, 0x03, 0x14, - 0xdd, 0x64, 0x9f, 0x65, 0x2e, 0x61, 0x75, 0xd5, - 0x13, 0xf4, 0x00, 0xbd, 0x44, 0xcf, 0x51, 0xc0, - 0x47, 0xa8, 0x94, 0x05, 0x39, 0xe6, 0x88, 0x94, - 0x14, 0x4a, 0x68, 0x6d, 0x02, 0x04, 0x12, 0xc0, - 0xd1, 0xfb, 0xfc, 0xcd, 0x8f, 0xc2, 0xf3, 0xf9, - 0x3c, 0xe0, 0x8e, 0xc7, 0x03, 0xc0, 0xe9, 0x74, - 0xba, 0x4b, 0x78, 0xd7, 0x75, 0x11, 0x00, 0x00, - 0x2e, 0x97, 0xcb, 0x4d, 0xc3, 0x0f, 0x87, 0x03, - 0x00, 0x64, 0x80, 0x61, 0xb8, 0x4f, 0x25, 0x2a, - 0x80, 0xc7, 0x97, 0x9f, 0xff, 0x35, 0xf0, 0xcf, - 0xeb, 0xc7, 0x65, 0x00, 0x00, 0x18, 0xce, 0x27, - 0x34, 0x0b, 0x61, 0xfb, 0xc7, 0xf8, 0xd4, 0x55, - 0xa6, 0xa7, 0x01, 0x06, 0xe0, 0xe1, 0xdb, 0x77, - 0x04, 0x2f, 0x08, 0x8e, 0xd8, 0x15, 0xd7, 0x3b, - 0xc2, 0x0b, 0xe0, 0x1d, 0xe1, 0x48, 0x38, 0x01, - 0x9c, 0x10, 0x42, 0x40, 0x48, 0x90, 0x88, 0xd7, - 0x04, 0xfd, 0x7a, 0xfe, 0x5c, 0xe5, 0xcc, 0x02, - 0x00, 0xc0, 0xde, 0x0b, 0x82, 0x27, 0x82, 0x8f, - 0xa1, 0xc1, 0x84, 0xef, 0x1c, 0xe1, 0x25, 0x5e, - 0x0d, 0x77, 0xe9, 0x67, 0x21, 0xe3, 0xb7, 0x4d, - 0x10, 0xe5, 0x99, 0x05, 0xe8, 0xfb, 0x7e, 0x0c, - 0xb0, 0x8b, 0xa1, 0xc1, 0xcb, 0x08, 0x60, 0xc9, - 0x82, 0x90, 0x90, 0x02, 0xa2, 0x3c, 0x65, 0xce, - 0xac, 0x01, 0x0d, 0xdf, 0xab, 0x01, 0x3f, 0x51, - 0x8a, 0x09, 0x0b, 0xb1, 0x0c, 0x00, 0x13, 0x44, - 0xb3, 0x81, 0x0a, 0x20, 0x85, 0x07, 0x9f, 0x4d, - 0xac, 0xb1, 0x10, 0x0d, 0xd4, 0x08, 0x2b, 0x7a, - 0x20, 0x86, 0xef, 0x53, 0xb0, 0xed, 0x87, 0x16, - 0x0b, 0x65, 0x13, 0xae, 0x06, 0xd0, 0xba, 0x6b, - 0x78, 0x2e, 0xc5, 0xd8, 0x44, 0x69, 0x41, 0x7b, - 0x40, 0xd6, 0x36, 0x61, 0x5d, 0x82, 0x14, 0x96, - 0xc2, 0xc3, 0x82, 0x89, 0xd2, 0x82, 0x1d, 0x47, - 0x3d, 0x9c, 0xc9, 0x99, 0x06, 0xa0, 0x31, 0x60, - 0xc6, 0x70, 0x6e, 0x32, 0xe6, 0x2c, 0x94, 0x02, - 0xb8, 0xb6, 0x04, 0x7a, 0xd5, 0xc4, 0xd2, 0x64, - 0x94, 0x16, 0xb4, 0x07, 0x48, 0x16, 0x4b, 0x6e, - 0x0b, 0xc0, 0x55, 0xfd, 0xfc, 0x64, 0x58, 0x0b, - 0xb6, 0x07, 0x08, 0x60, 0x30, 0x2e, 0x36, 0x01, - 0x94, 0x37, 0x38, 0x56, 0x9b, 0xb2, 0xb4, 0x60, - 0x57, 0xb2, 0x7d, 0x74, 0x33, 0x80, 0x97, 0xbc, - 0x76, 0xa7, 0x4c, 0x84, 0x09, 0x13, 0x6a, 0x41, - 0xc7, 0x51, 0xb7, 0xe1, 0x76, 0x00, 0x79, 0x07, - 0x64, 0xc2, 0x84, 0x5a, 0xb0, 0x8d, 0x68, 0x9f, - 0xdc, 0x0c, 0xe0, 0x52, 0x3d, 0x17, 0x41, 0x8a, - 0x31, 0xcd, 0xa5, 0x80, 0x59, 0x48, 0x1b, 0x9b, - 0xd0, 0x49, 0x5e, 0xaf, 0x73, 0x20, 0xa3, 0x92, - 0x98, 0x1d, 0x61, 0x2d, 0x6c, 0x6e, 0x42, 0x67, - 0xd7, 0xeb, 0x3b, 0x20, 0x3a, 0x92, 0xd6, 0x84, - 0x37, 0xe3, 0xd8, 0xd4, 0x03, 0xe5, 0x6b, 0x52, - 0xb7, 0x99, 0x4b, 0xdf, 0x64, 0x09, 0x64, 0xe7, - 0xea, 0x31, 0xf5, 0xe6, 0xbd, 0xd0, 0x9b, 0xcc, - 0xe6, 0xd7, 0xb1, 0x10, 0xa9, 0x91, 0xf2, 0x6e, - 0x97, 0x6b, 0x6d, 0xb3, 0x9d, 0x49, 0x90, 0xd4, - 0x1f, 0x3e, 0x35, 0x62, 0xaf, 0xcf, 0xe6, 0x8a, - 0x12, 0xd0, 0xfc, 0x53, 0x91, 0x21, 0x38, 0xfa, - 0xdd, 0xda, 0xb1, 0x20, 0x76, 0x5b, 0x3a, 0x21, - 0xfe, 0xf6, 0x2b, 0x9b, 0x90, 0x00, 0x7e, 0x7c, - 0xf9, 0x34, 0x06, 0xc2, 0xbf, 0x39, 0x6d, 0x00, - 0x4f, 0x5d, 0xf5, 0x87, 0xcd, 0x00, 0x0b, 0x1f, - 0x1c, 0x86, 0x06, 0x80, 0xdf, 0x5f, 0x3f, 0xb4, - 0x46, 0x6d, 0x3a, 0xcd, 0x3d, 0x70, 0xab, 0x73, - 0x05, 0x38, 0x1e, 0x8f, 0xf7, 0x03, 0xe8, 0xba, - 0xba, 0xe6, 0xb7, 0x3a, 0x6f, 0xf3, 0xc5, 0xd8, - 0x16, 0x94, 0xc1, 0xc8, 0x93, 0x00, 0x00, 0x00, - 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, - 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x32, + 0x30, 0x2f, 0x30, 0x37, 0xa1, 0x4c, 0x30, 0x14, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0x15, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xc5, 0x96, + 0x4d, 0x6e, 0xdb, 0x30, 0x10, 0x85, 0xdf, 0x1b, + 0xd2, 0x34, 0xb2, 0x36, 0x90, 0x73, 0x78, 0xd7, + 0x73, 0x14, 0x5d, 0x75, 0xd9, 0x8d, 0x03, 0x14, + 0xdd, 0x64, 0x9f, 0x65, 0x2e, 0x61, 0x75, 0xd5, + 0x13, 0xf4, 0x00, 0xbd, 0x44, 0xcf, 0x51, 0xc0, + 0x47, 0xa8, 0x94, 0x05, 0x39, 0xe6, 0x88, 0x94, + 0x14, 0x4a, 0x68, 0x6d, 0x02, 0x04, 0x12, 0xc0, + 0xd1, 0xfb, 0xfc, 0xcd, 0x8f, 0xc2, 0xf3, 0xf9, + 0x3c, 0xe0, 0x8e, 0xc7, 0x03, 0xc0, 0xe9, 0x74, + 0xba, 0x4b, 0x78, 0xd7, 0x75, 0x11, 0x00, 0x00, + 0x2e, 0x97, 0xcb, 0x4d, 0xc3, 0x0f, 0x87, 0x03, + 0x00, 0x64, 0x80, 0x61, 0xb8, 0x4f, 0x25, 0x2a, + 0x80, 0xc7, 0x97, 0x9f, 0xff, 0x35, 0xf0, 0xcf, + 0xeb, 0xc7, 0x65, 0x00, 0x00, 0x18, 0xce, 0x27, + 0x34, 0x0b, 0x61, 0xfb, 0xc7, 0xf8, 0xd4, 0x55, + 0xa6, 0xa7, 0x01, 0x06, 0xe0, 0xe1, 0xdb, 0x77, + 0x04, 0x2f, 0x08, 0x8e, 0xd8, 0x15, 0xd7, 0x3b, + 0xc2, 0x0b, 0xe0, 0x1d, 0xe1, 0x48, 0x38, 0x01, + 0x9c, 0x10, 0x42, 0x40, 0x48, 0x90, 0x88, 0xd7, + 0x04, 0xfd, 0x7a, 0xfe, 0x5c, 0xe5, 0xcc, 0x02, + 0x00, 0xc0, 0xde, 0x0b, 0x82, 0x27, 0x82, 0x8f, + 0xa1, 0xc1, 0x84, 0xef, 0x1c, 0xe1, 0x25, 0x5e, + 0x0d, 0x77, 0xe9, 0x67, 0x21, 0xe3, 0xb7, 0x4d, + 0x10, 0xe5, 0x99, 0x05, 0xe8, 0xfb, 0x7e, 0x0c, + 0xb0, 0x8b, 0xa1, 0xc1, 0xcb, 0x08, 0x60, 0xc9, + 0x82, 0x90, 0x90, 0x02, 0xa2, 0x3c, 0x65, 0xce, + 0xac, 0x01, 0x0d, 0xdf, 0xab, 0x01, 0x3f, 0x51, + 0x8a, 0x09, 0x0b, 0xb1, 0x0c, 0x00, 0x13, 0x44, + 0xb3, 0x81, 0x0a, 0x20, 0x85, 0x07, 0x9f, 0x4d, + 0xac, 0xb1, 0x10, 0x0d, 0xd4, 0x08, 0x2b, 0x7a, + 0x20, 0x86, 0xef, 0x53, 0xb0, 0xed, 0x87, 0x16, + 0x0b, 0x65, 0x13, 0xae, 0x06, 0xd0, 0xba, 0x6b, + 0x78, 0x2e, 0xc5, 0xd8, 0x44, 0x69, 0x41, 0x7b, + 0x40, 0xd6, 0x36, 0x61, 0x5d, 0x82, 0x14, 0x96, + 0xc2, 0xc3, 0x82, 0x89, 0xd2, 0x82, 0x1d, 0x47, + 0x3d, 0x9c, 0xc9, 0x99, 0x06, 0xa0, 0x31, 0x60, + 0xc6, 0x70, 0x6e, 0x32, 0xe6, 0x2c, 0x94, 0x02, + 0xb8, 0xb6, 0x04, 0x7a, 0xd5, 0xc4, 0xd2, 0x64, + 0x94, 0x16, 0xb4, 0x07, 0x48, 0x16, 0x4b, 0x6e, + 0x0b, 0xc0, 0x55, 0xfd, 0xfc, 0x64, 0x58, 0x0b, + 0xb6, 0x07, 0x08, 0x60, 0x30, 0x2e, 0x36, 0x01, + 0x94, 0x37, 0x38, 0x56, 0x9b, 0xb2, 0xb4, 0x60, + 0x57, 0xb2, 0x7d, 0x74, 0x33, 0x80, 0x97, 0xbc, + 0x76, 0xa7, 0x4c, 0x84, 0x09, 0x13, 0x6a, 0x41, + 0xc7, 0x51, 0xb7, 0xe1, 0x76, 0x00, 0x79, 0x07, + 0x64, 0xc2, 0x84, 0x5a, 0xb0, 0x8d, 0x68, 0x9f, + 0xdc, 0x0c, 0xe0, 0x52, 0x3d, 0x17, 0x41, 0x8a, + 0x31, 0xcd, 0xa5, 0x80, 0x59, 0x48, 0x1b, 0x9b, + 0xd0, 0x49, 0x5e, 0xaf, 0x73, 0x20, 0xa3, 0x92, + 0x98, 0x1d, 0x61, 0x2d, 0x6c, 0x6e, 0x42, 0x67, + 0xd7, 0xeb, 0x3b, 0x20, 0x3a, 0x92, 0xd6, 0x84, + 0x37, 0xe3, 0xd8, 0xd4, 0x03, 0xe5, 0x6b, 0x52, + 0xb7, 0x99, 0x4b, 0xdf, 0x64, 0x09, 0x64, 0xe7, + 0xea, 0x31, 0xf5, 0xe6, 0xbd, 0xd0, 0x9b, 0xcc, + 0xe6, 0xd7, 0xb1, 0x10, 0xa9, 0x91, 0xf2, 0x6e, + 0x97, 0x6b, 0x6d, 0xb3, 0x9d, 0x49, 0x90, 0xd4, + 0x1f, 0x3e, 0x35, 0x62, 0xaf, 0xcf, 0xe6, 0x8a, + 0x12, 0xd0, 0xfc, 0x53, 0x91, 0x21, 0x38, 0xfa, + 0xdd, 0xda, 0xb1, 0x20, 0x76, 0x5b, 0x3a, 0x21, + 0xfe, 0xf6, 0x2b, 0x9b, 0x90, 0x00, 0x7e, 0x7c, + 0xf9, 0x34, 0x06, 0xc2, 0xbf, 0x39, 0x6d, 0x00, + 0x4f, 0x5d, 0xf5, 0x87, 0xcd, 0x00, 0x0b, 0x1f, + 0x1c, 0x86, 0x06, 0x80, 0xdf, 0x5f, 0x3f, 0xb4, + 0x46, 0x6d, 0x3a, 0xcd, 0x3d, 0x70, 0xab, 0x73, + 0x05, 0x38, 0x1e, 0x8f, 0xf7, 0x03, 0xe8, 0xba, + 0xba, 0xe6, 0xb7, 0x3a, 0x6f, 0xf3, 0xc5, 0xd8, + 0x16, 0x94, 0xc1, 0xc8, 0x93, 0x00, 0x00, 0x00, + 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, + 0x82 +}; /* End Of File */ /* rectangular_7_small.png - 429 bytes */ unsigned char rectangular_7_small_png[429] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, - 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, - 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, - 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, - 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, - 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, - 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x01, 0x09, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, - 0xdb, 0x6d, 0xc4, 0x20, 0x10, 0x45, 0xef, 0x3c, - 0x01, 0xe3, 0xad, 0x66, 0x8b, 0xda, 0x9a, 0x5c, - 0x54, 0x3a, 0x48, 0x05, 0xe9, 0x60, 0xbf, 0x9c, - 0x8f, 0x31, 0xd8, 0x6b, 0x9c, 0x87, 0x92, 0x2b, - 0x21, 0x21, 0x04, 0x87, 0x33, 0x03, 0xb4, 0x2c, - 0xcb, 0x8a, 0x7f, 0x44, 0x01, 0xe0, 0xf1, 0xf6, - 0xb7, 0xc3, 0xcb, 0x7d, 0x03, 0x7c, 0x15, 0x22, - 0x20, 0x2b, 0x23, 0x1b, 0xc1, 0x95, 0xe1, 0x42, - 0x50, 0x21, 0x08, 0x03, 0xef, 0x1f, 0xcf, 0xdd, - 0xe0, 0x2a, 0x26, 0x84, 0xc9, 0x19, 0xc5, 0x02, - 0x90, 0x94, 0xe1, 0x4a, 0x50, 0x0e, 0x08, 0xf0, - 0x0d, 0x20, 0x1b, 0x63, 0x72, 0x46, 0x75, 0x46, - 0x71, 0x46, 0x39, 0x00, 0x4c, 0x02, 0xd2, 0x32, - 0x00, 0xb2, 0x31, 0xe6, 0xc4, 0xa8, 0x29, 0x00, - 0xd3, 0x06, 0xc9, 0xca, 0x48, 0xf6, 0x03, 0xa0, - 0x69, 0xd7, 0xc4, 0x98, 0x93, 0x60, 0x4e, 0x01, - 0x68, 0xa5, 0x24, 0x23, 0xb8, 0x04, 0x64, 0x00, - 0x10, 0xa1, 0x6b, 0x57, 0x0f, 0x8b, 0x30, 0x91, - 0x5e, 0x4a, 0xeb, 0xc5, 0x25, 0x20, 0x6b, 0xdc, - 0x52, 0x7c, 0xbf, 0xb5, 0x6e, 0x16, 0xcd, 0xa4, - 0x38, 0x47, 0x2f, 0x84, 0x40, 0x03, 0xc0, 0x08, - 0xd9, 0x08, 0xc5, 0xa8, 0x43, 0x76, 0x13, 0x41, - 0x4d, 0x7b, 0x29, 0xae, 0x17, 0x06, 0xae, 0x41, - 0x4f, 0xca, 0x83, 0x4d, 0x4d, 0x8c, 0x5b, 0x7e, - 0x2d, 0x65, 0x04, 0x08, 0xc1, 0x35, 0x46, 0xb2, - 0x18, 0xf9, 0x6c, 0x93, 0xf7, 0xa7, 0x1d, 0x00, - 0xba, 0x3d, 0x8f, 0x6d, 0x5d, 0x76, 0xa1, 0x6e, - 0xd4, 0x6c, 0xaa, 0x87, 0xc9, 0x74, 0x00, 0xf4, - 0x99, 0xf0, 0x0e, 0x39, 0x83, 0x5c, 0x5f, 0x6d, - 0x6e, 0x59, 0xd0, 0xba, 0xd8, 0x0d, 0xe2, 0x6f, - 0x3f, 0x71, 0x0e, 0x0d, 0x2b, 0xb1, 0xb8, 0xae, - 0x07, 0xc0, 0x72, 0xbf, 0xda, 0xf5, 0xbb, 0x7c, - 0x02, 0xc4, 0x1d, 0x16, 0xad, 0xd2, 0x98, 0x29, - 0x34, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, - 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, + 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x00, 0x41, + 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x4f, 0xb3, + 0x1f, 0x4e, 0x00, 0x00, 0x00, 0x16, 0x74, 0x45, + 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x00, + 0x31, 0x32, 0x2f, 0x32, 0x32, 0x2f, 0x30, 0x37, + 0x0b, 0x45, 0xf8, 0x9f, 0x00, 0x00, 0x01, 0x09, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0x92, + 0xdb, 0x6d, 0xc4, 0x20, 0x10, 0x45, 0xef, 0x3c, + 0x01, 0xe3, 0xad, 0x66, 0x8b, 0xda, 0x9a, 0x5c, + 0x54, 0x3a, 0x48, 0x05, 0xe9, 0x60, 0xbf, 0x9c, + 0x8f, 0x31, 0xd8, 0x6b, 0x9c, 0x87, 0x92, 0x2b, + 0x21, 0x21, 0x04, 0x87, 0x33, 0x03, 0xb4, 0x2c, + 0xcb, 0x8a, 0x7f, 0x44, 0x01, 0xe0, 0xf1, 0xf6, + 0xb7, 0xc3, 0xcb, 0x7d, 0x03, 0x7c, 0x15, 0x22, + 0x20, 0x2b, 0x23, 0x1b, 0xc1, 0x95, 0xe1, 0x42, + 0x50, 0x21, 0x08, 0x03, 0xef, 0x1f, 0xcf, 0xdd, + 0xe0, 0x2a, 0x26, 0x84, 0xc9, 0x19, 0xc5, 0x02, + 0x90, 0x94, 0xe1, 0x4a, 0x50, 0x0e, 0x08, 0xf0, + 0x0d, 0x20, 0x1b, 0x63, 0x72, 0x46, 0x75, 0x46, + 0x71, 0x46, 0x39, 0x00, 0x4c, 0x02, 0xd2, 0x32, + 0x00, 0xb2, 0x31, 0xe6, 0xc4, 0xa8, 0x29, 0x00, + 0xd3, 0x06, 0xc9, 0xca, 0x48, 0xf6, 0x03, 0xa0, + 0x69, 0xd7, 0xc4, 0x98, 0x93, 0x60, 0x4e, 0x01, + 0x68, 0xa5, 0x24, 0x23, 0xb8, 0x04, 0x64, 0x00, + 0x10, 0xa1, 0x6b, 0x57, 0x0f, 0x8b, 0x30, 0x91, + 0x5e, 0x4a, 0xeb, 0xc5, 0x25, 0x20, 0x6b, 0xdc, + 0x52, 0x7c, 0xbf, 0xb5, 0x6e, 0x16, 0xcd, 0xa4, + 0x38, 0x47, 0x2f, 0x84, 0x40, 0x03, 0xc0, 0x08, + 0xd9, 0x08, 0xc5, 0xa8, 0x43, 0x76, 0x13, 0x41, + 0x4d, 0x7b, 0x29, 0xae, 0x17, 0x06, 0xae, 0x41, + 0x4f, 0xca, 0x83, 0x4d, 0x4d, 0x8c, 0x5b, 0x7e, + 0x2d, 0x65, 0x04, 0x08, 0xc1, 0x35, 0x46, 0xb2, + 0x18, 0xf9, 0x6c, 0x93, 0xf7, 0xa7, 0x1d, 0x00, + 0xba, 0x3d, 0x8f, 0x6d, 0x5d, 0x76, 0xa1, 0x6e, + 0xd4, 0x6c, 0xaa, 0x87, 0xc9, 0x74, 0x00, 0xf4, + 0x99, 0xf0, 0x0e, 0x39, 0x83, 0x5c, 0x5f, 0x6d, + 0x6e, 0x59, 0xd0, 0xba, 0xd8, 0x0d, 0xe2, 0x6f, + 0x3f, 0x71, 0x0e, 0x0d, 0x2b, 0xb1, 0xb8, 0xae, + 0x07, 0xc0, 0x72, 0xbf, 0xda, 0xf5, 0xbb, 0x7c, + 0x02, 0xc4, 0x1d, 0x16, 0xad, 0xd2, 0x98, 0x29, + 0x34, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, + 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* window_hatch.png - 910 bytes */ unsigned char window_hatch_png[910] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0xea, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x97, - 0xcf, 0x6b, 0x54, 0x57, 0x14, 0xc7, 0x3f, 0x13, - 0x85, 0xe6, 0xd1, 0x98, 0x98, 0x66, 0x34, 0xfe, - 0x08, 0x42, 0xc1, 0x2e, 0x14, 0x3a, 0x99, 0x16, - 0x11, 0x04, 0xb7, 0xed, 0xc6, 0x1f, 0x2b, 0x77, - 0x81, 0x10, 0x21, 0x4c, 0xb7, 0x2d, 0x08, 0xee, - 0xf4, 0x1f, 0x70, 0xa9, 0x8b, 0x99, 0x62, 0x13, - 0x86, 0x52, 0x0a, 0x85, 0x52, 0x28, 0xe8, 0x42, - 0x0c, 0xe8, 0xa2, 0x8b, 0xac, 0xea, 0x88, 0xa0, - 0x42, 0x10, 0x54, 0x04, 0xc5, 0x98, 0x1a, 0x32, - 0xbc, 0xd1, 0xb9, 0xe7, 0x7b, 0xba, 0x78, 0x33, - 0xe3, 0x24, 0x9d, 0x5f, 0x21, 0xda, 0x59, 0xb4, - 0x07, 0x2e, 0xf7, 0x9e, 0xf7, 0xee, 0xfd, 0xde, - 0xcf, 0x39, 0xf7, 0xbe, 0x33, 0x4c, 0x2a, 0x9f, - 0xcf, 0x3b, 0x7d, 0xb4, 0xed, 0x00, 0xb9, 0x5c, - 0xae, 0x2f, 0x9b, 0x17, 0x0a, 0x85, 0x04, 0x00, - 0x60, 0x79, 0x79, 0xf9, 0x5f, 0xdd, 0x7c, 0x6c, - 0x6c, 0x0c, 0xe0, 0x1d, 0x80, 0x7b, 0x7f, 0x4e, - 0xe2, 0x7f, 0x80, 0xae, 0x00, 0xa5, 0xef, 0x4f, - 0xb5, 0x5d, 0x2c, 0x39, 0x92, 0x63, 0x72, 0x82, - 0x09, 0x33, 0x11, 0x4c, 0x84, 0x20, 0x82, 0x25, - 0xcf, 0x4e, 0x5e, 0xb8, 0xb5, 0x35, 0x00, 0x80, - 0x89, 0xec, 0x21, 0x64, 0x06, 0xee, 0xc9, 0x3c, - 0x1f, 0xc0, 0x01, 0xb7, 0x64, 0x9d, 0x4b, 0x28, - 0x08, 0x99, 0x21, 0x39, 0x08, 0x9c, 0x01, 0xfe, - 0x5c, 0xbc, 0xd3, 0x35, 0xb3, 0x0d, 0x00, 0x49, - 0xed, 0x23, 0xb5, 0xc0, 0xca, 0xd3, 0xe7, 0xc4, - 0x2b, 0xab, 0x3d, 0x45, 0xbe, 0x63, 0x64, 0x98, - 0xf1, 0x7d, 0x7b, 0x08, 0xa6, 0x8e, 0xba, 0x3d, - 0x67, 0xc0, 0xcd, 0x89, 0x57, 0x56, 0xb9, 0xf1, - 0xd5, 0x22, 0xee, 0x24, 0xd1, 0x8b, 0x64, 0x5c, - 0xf3, 0x2f, 0xee, 0xff, 0x96, 0xa1, 0xe8, 0x00, - 0x20, 0x7e, 0xb8, 0x58, 0x60, 0xd7, 0xee, 0xdd, - 0x98, 0xa9, 0x6b, 0x06, 0x06, 0x9a, 0x01, 0x5a, - 0x35, 0x00, 0xd5, 0x34, 0x6e, 0x96, 0xaf, 0x70, - 0xb3, 0x7c, 0x99, 0x37, 0xa9, 0x07, 0x98, 0x20, - 0xd4, 0x5a, 0xd5, 0xe0, 0x8f, 0x57, 0x93, 0x28, - 0x2e, 0xe1, 0x7a, 0x4b, 0x30, 0xe1, 0xb5, 0x3b, - 0xd0, 0x49, 0xb7, 0x67, 0x00, 0x94, 0xa4, 0xfd, - 0x8b, 0xd1, 0x47, 0xbc, 0x49, 0xfd, 0xc2, 0xc2, - 0x5a, 0x8e, 0xaa, 0xfe, 0x22, 0x18, 0x54, 0x03, - 0x84, 0x00, 0xa5, 0xca, 0xd7, 0x5c, 0x7b, 0x71, - 0x8c, 0xd5, 0xb5, 0x25, 0xcc, 0x84, 0x04, 0xa6, - 0xd6, 0x9a, 0x9b, 0x06, 0x50, 0x0d, 0x20, 0x58, - 0xe0, 0xc8, 0xf0, 0x24, 0x66, 0xc6, 0xed, 0xca, - 0x69, 0xaa, 0x3c, 0x4c, 0x20, 0x0c, 0x1e, 0xac, - 0xed, 0xe7, 0xb7, 0x95, 0x6f, 0xf8, 0x6e, 0xe9, - 0x6a, 0x23, 0x03, 0xea, 0x01, 0xa0, 0xeb, 0x1d, - 0x90, 0x1c, 0x05, 0x4b, 0x2e, 0x9c, 0xaa, 0xdc, - 0x7b, 0x5d, 0xe2, 0xe4, 0x44, 0x9a, 0x67, 0xe5, - 0x0a, 0xe5, 0x6d, 0x27, 0x78, 0xb5, 0x9a, 0x65, - 0x54, 0x67, 0x78, 0xf2, 0xe2, 0x38, 0x6b, 0x95, - 0x3d, 0x28, 0x6c, 0x23, 0x23, 0x4f, 0xbe, 0x0a, - 0x79, 0x5b, 0xdd, 0x4d, 0x03, 0x04, 0x13, 0x93, - 0xe9, 0x97, 0x7c, 0x3e, 0xb6, 0x97, 0x7d, 0x83, - 0x07, 0xc9, 0x8c, 0x08, 0x79, 0x86, 0xc7, 0x3b, - 0x1e, 0x22, 0x7e, 0xe2, 0xb3, 0x89, 0x1f, 0x11, - 0xc9, 0x86, 0x5a, 0x70, 0x2c, 0x58, 0x47, 0xdd, - 0x9e, 0x01, 0x4c, 0x8e, 0x82, 0x63, 0x26, 0xc6, - 0x3f, 0xfa, 0x14, 0xb9, 0x08, 0xfe, 0x16, 0xb9, - 0x70, 0xc4, 0xde, 0xc1, 0x03, 0x49, 0x5a, 0x11, - 0x22, 0xb9, 0x74, 0xaf, 0x55, 0xc2, 0xcd, 0xdf, - 0x0f, 0x40, 0x30, 0x21, 0x73, 0x06, 0x3f, 0x1e, - 0xa2, 0x72, 0xe9, 0x77, 0xdc, 0x12, 0x98, 0xe4, - 0x9b, 0x7f, 0x57, 0x03, 0xac, 0x56, 0x1b, 0x24, - 0x27, 0xbd, 0x73, 0x27, 0x75, 0xb9, 0xad, 0x67, - 0xc0, 0x04, 0x9e, 0x62, 0x64, 0x34, 0xcd, 0xf0, - 0xf0, 0x27, 0xd4, 0xeb, 0xca, 0xe1, 0xa9, 0x73, - 0x94, 0x9f, 0x5e, 0x07, 0xc4, 0x60, 0xfa, 0x28, - 0x77, 0x8b, 0x57, 0xf1, 0x7a, 0xe1, 0x71, 0x48, - 0xa5, 0x06, 0xde, 0x5f, 0x06, 0x96, 0xee, 0xdf, - 0x6f, 0xd4, 0xf6, 0x7a, 0xe4, 0x77, 0xce, 0x9f, - 0x6d, 0x8a, 0xfc, 0xe7, 0xa4, 0x04, 0xb7, 0xb0, - 0x2d, 0x03, 0x7c, 0x99, 0xfb, 0xb5, 0xa3, 0x40, - 0x37, 0xdb, 0x32, 0xc0, 0x87, 0xb6, 0xbe, 0x03, - 0x74, 0xac, 0x84, 0xb3, 0xb3, 0xb3, 0xeb, 0xfa, - 0xa9, 0xa9, 0xa9, 0x46, 0xeb, 0xc5, 0xdf, 0xb8, - 0xbe, 0x63, 0x29, 0x96, 0xf4, 0x8f, 0x56, 0x7f, - 0x5e, 0xef, 0xa3, 0x28, 0xa2, 0x58, 0x2c, 0x12, - 0x45, 0x11, 0x92, 0x1a, 0xe3, 0x62, 0xb1, 0xb8, - 0xee, 0x7d, 0xdd, 0xdf, 0xb8, 0x7e, 0xa3, 0x36, - 0x74, 0x39, 0x82, 0x38, 0x8e, 0x99, 0x9e, 0x9e, - 0x6e, 0xbc, 0xdf, 0xe8, 0xb7, 0x5a, 0xdb, 0x3c, - 0x6e, 0x37, 0xbf, 0xe7, 0x23, 0x88, 0xa2, 0x88, - 0xf9, 0xf9, 0x79, 0xa2, 0x28, 0x6a, 0xe9, 0xd7, - 0x45, 0x5b, 0x8d, 0xdb, 0xcd, 0xdf, 0xf4, 0x8f, - 0x51, 0xb3, 0x70, 0xab, 0xbe, 0x79, 0x1c, 0xc7, - 0x31, 0x33, 0x33, 0x33, 0x00, 0xcc, 0xcd, 0xcd, - 0xb5, 0x9d, 0xdf, 0x6c, 0xa9, 0x7c, 0x3e, 0xef, - 0xb9, 0x5c, 0x8e, 0x52, 0xa9, 0xd4, 0x72, 0xc2, - 0x87, 0xb2, 0x4c, 0x26, 0xb3, 0xfe, 0x9f, 0xd1, - 0x7f, 0xb6, 0x0e, 0x34, 0x00, 0xb2, 0xd9, 0x6c, - 0xff, 0x00, 0x0a, 0x85, 0x42, 0x5f, 0x36, 0x07, - 0xf8, 0x1b, 0xa7, 0x8d, 0x56, 0x66, 0x8d, 0x73, - 0x68, 0x22, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, - 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x02, 0xea, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x97, + 0xcf, 0x6b, 0x54, 0x57, 0x14, 0xc7, 0x3f, 0x13, + 0x85, 0xe6, 0xd1, 0x98, 0x98, 0x66, 0x34, 0xfe, + 0x08, 0x42, 0xc1, 0x2e, 0x14, 0x3a, 0x99, 0x16, + 0x11, 0x04, 0xb7, 0xed, 0xc6, 0x1f, 0x2b, 0x77, + 0x81, 0x10, 0x21, 0x4c, 0xb7, 0x2d, 0x08, 0xee, + 0xf4, 0x1f, 0x70, 0xa9, 0x8b, 0x99, 0x62, 0x13, + 0x86, 0x52, 0x0a, 0x85, 0x52, 0x28, 0xe8, 0x42, + 0x0c, 0xe8, 0xa2, 0x8b, 0xac, 0xea, 0x88, 0xa0, + 0x42, 0x10, 0x54, 0x04, 0xc5, 0x98, 0x1a, 0x32, + 0xbc, 0xd1, 0xb9, 0xe7, 0x7b, 0xba, 0x78, 0x33, + 0xe3, 0x24, 0x9d, 0x5f, 0x21, 0xda, 0x59, 0xb4, + 0x07, 0x2e, 0xf7, 0x9e, 0xf7, 0xee, 0xfd, 0xde, + 0xcf, 0x39, 0xf7, 0xbe, 0x33, 0x4c, 0x2a, 0x9f, + 0xcf, 0x3b, 0x7d, 0xb4, 0xed, 0x00, 0xb9, 0x5c, + 0xae, 0x2f, 0x9b, 0x17, 0x0a, 0x85, 0x04, 0x00, + 0x60, 0x79, 0x79, 0xf9, 0x5f, 0xdd, 0x7c, 0x6c, + 0x6c, 0x0c, 0xe0, 0x1d, 0x80, 0x7b, 0x7f, 0x4e, + 0xe2, 0x7f, 0x80, 0xae, 0x00, 0xa5, 0xef, 0x4f, + 0xb5, 0x5d, 0x2c, 0x39, 0x92, 0x63, 0x72, 0x82, + 0x09, 0x33, 0x11, 0x4c, 0x84, 0x20, 0x82, 0x25, + 0xcf, 0x4e, 0x5e, 0xb8, 0xb5, 0x35, 0x00, 0x80, + 0x89, 0xec, 0x21, 0x64, 0x06, 0xee, 0xc9, 0x3c, + 0x1f, 0xc0, 0x01, 0xb7, 0x64, 0x9d, 0x4b, 0x28, + 0x08, 0x99, 0x21, 0x39, 0x08, 0x9c, 0x01, 0xfe, + 0x5c, 0xbc, 0xd3, 0x35, 0xb3, 0x0d, 0x00, 0x49, + 0xed, 0x23, 0xb5, 0xc0, 0xca, 0xd3, 0xe7, 0xc4, + 0x2b, 0xab, 0x3d, 0x45, 0xbe, 0x63, 0x64, 0x98, + 0xf1, 0x7d, 0x7b, 0x08, 0xa6, 0x8e, 0xba, 0x3d, + 0x67, 0xc0, 0xcd, 0x89, 0x57, 0x56, 0xb9, 0xf1, + 0xd5, 0x22, 0xee, 0x24, 0xd1, 0x8b, 0x64, 0x5c, + 0xf3, 0x2f, 0xee, 0xff, 0x96, 0xa1, 0xe8, 0x00, + 0x20, 0x7e, 0xb8, 0x58, 0x60, 0xd7, 0xee, 0xdd, + 0x98, 0xa9, 0x6b, 0x06, 0x06, 0x9a, 0x01, 0x5a, + 0x35, 0x00, 0xd5, 0x34, 0x6e, 0x96, 0xaf, 0x70, + 0xb3, 0x7c, 0x99, 0x37, 0xa9, 0x07, 0x98, 0x20, + 0xd4, 0x5a, 0xd5, 0xe0, 0x8f, 0x57, 0x93, 0x28, + 0x2e, 0xe1, 0x7a, 0x4b, 0x30, 0xe1, 0xb5, 0x3b, + 0xd0, 0x49, 0xb7, 0x67, 0x00, 0x94, 0xa4, 0xfd, + 0x8b, 0xd1, 0x47, 0xbc, 0x49, 0xfd, 0xc2, 0xc2, + 0x5a, 0x8e, 0xaa, 0xfe, 0x22, 0x18, 0x54, 0x03, + 0x84, 0x00, 0xa5, 0xca, 0xd7, 0x5c, 0x7b, 0x71, + 0x8c, 0xd5, 0xb5, 0x25, 0xcc, 0x84, 0x04, 0xa6, + 0xd6, 0x9a, 0x9b, 0x06, 0x50, 0x0d, 0x20, 0x58, + 0xe0, 0xc8, 0xf0, 0x24, 0x66, 0xc6, 0xed, 0xca, + 0x69, 0xaa, 0x3c, 0x4c, 0x20, 0x0c, 0x1e, 0xac, + 0xed, 0xe7, 0xb7, 0x95, 0x6f, 0xf8, 0x6e, 0xe9, + 0x6a, 0x23, 0x03, 0xea, 0x01, 0xa0, 0xeb, 0x1d, + 0x90, 0x1c, 0x05, 0x4b, 0x2e, 0x9c, 0xaa, 0xdc, + 0x7b, 0x5d, 0xe2, 0xe4, 0x44, 0x9a, 0x67, 0xe5, + 0x0a, 0xe5, 0x6d, 0x27, 0x78, 0xb5, 0x9a, 0x65, + 0x54, 0x67, 0x78, 0xf2, 0xe2, 0x38, 0x6b, 0x95, + 0x3d, 0x28, 0x6c, 0x23, 0x23, 0x4f, 0xbe, 0x0a, + 0x79, 0x5b, 0xdd, 0x4d, 0x03, 0x04, 0x13, 0x93, + 0xe9, 0x97, 0x7c, 0x3e, 0xb6, 0x97, 0x7d, 0x83, + 0x07, 0xc9, 0x8c, 0x08, 0x79, 0x86, 0xc7, 0x3b, + 0x1e, 0x22, 0x7e, 0xe2, 0xb3, 0x89, 0x1f, 0x11, + 0xc9, 0x86, 0x5a, 0x70, 0x2c, 0x58, 0x47, 0xdd, + 0x9e, 0x01, 0x4c, 0x8e, 0x82, 0x63, 0x26, 0xc6, + 0x3f, 0xfa, 0x14, 0xb9, 0x08, 0xfe, 0x16, 0xb9, + 0x70, 0xc4, 0xde, 0xc1, 0x03, 0x49, 0x5a, 0x11, + 0x22, 0xb9, 0x74, 0xaf, 0x55, 0xc2, 0xcd, 0xdf, + 0x0f, 0x40, 0x30, 0x21, 0x73, 0x06, 0x3f, 0x1e, + 0xa2, 0x72, 0xe9, 0x77, 0xdc, 0x12, 0x98, 0xe4, + 0x9b, 0x7f, 0x57, 0x03, 0xac, 0x56, 0x1b, 0x24, + 0x27, 0xbd, 0x73, 0x27, 0x75, 0xb9, 0xad, 0x67, + 0xc0, 0x04, 0x9e, 0x62, 0x64, 0x34, 0xcd, 0xf0, + 0xf0, 0x27, 0xd4, 0xeb, 0xca, 0xe1, 0xa9, 0x73, + 0x94, 0x9f, 0x5e, 0x07, 0xc4, 0x60, 0xfa, 0x28, + 0x77, 0x8b, 0x57, 0xf1, 0x7a, 0xe1, 0x71, 0x48, + 0xa5, 0x06, 0xde, 0x5f, 0x06, 0x96, 0xee, 0xdf, + 0x6f, 0xd4, 0xf6, 0x7a, 0xe4, 0x77, 0xce, 0x9f, + 0x6d, 0x8a, 0xfc, 0xe7, 0xa4, 0x04, 0xb7, 0xb0, + 0x2d, 0x03, 0x7c, 0x99, 0xfb, 0xb5, 0xa3, 0x40, + 0x37, 0xdb, 0x32, 0xc0, 0x87, 0xb6, 0xbe, 0x03, + 0x74, 0xac, 0x84, 0xb3, 0xb3, 0xb3, 0xeb, 0xfa, + 0xa9, 0xa9, 0xa9, 0x46, 0xeb, 0xc5, 0xdf, 0xb8, + 0xbe, 0x63, 0x29, 0x96, 0xf4, 0x8f, 0x56, 0x7f, + 0x5e, 0xef, 0xa3, 0x28, 0xa2, 0x58, 0x2c, 0x12, + 0x45, 0x11, 0x92, 0x1a, 0xe3, 0x62, 0xb1, 0xb8, + 0xee, 0x7d, 0xdd, 0xdf, 0xb8, 0x7e, 0xa3, 0x36, + 0x74, 0x39, 0x82, 0x38, 0x8e, 0x99, 0x9e, 0x9e, + 0x6e, 0xbc, 0xdf, 0xe8, 0xb7, 0x5a, 0xdb, 0x3c, + 0x6e, 0x37, 0xbf, 0xe7, 0x23, 0x88, 0xa2, 0x88, + 0xf9, 0xf9, 0x79, 0xa2, 0x28, 0x6a, 0xe9, 0xd7, + 0x45, 0x5b, 0x8d, 0xdb, 0xcd, 0xdf, 0xf4, 0x8f, + 0x51, 0xb3, 0x70, 0xab, 0xbe, 0x79, 0x1c, 0xc7, + 0x31, 0x33, 0x33, 0x33, 0x00, 0xcc, 0xcd, 0xcd, + 0xb5, 0x9d, 0xdf, 0x6c, 0xa9, 0x7c, 0x3e, 0xef, + 0xb9, 0x5c, 0x8e, 0x52, 0xa9, 0xd4, 0x72, 0xc2, + 0x87, 0xb2, 0x4c, 0x26, 0xb3, 0xfe, 0x9f, 0xd1, + 0x7f, 0xb6, 0x0e, 0x34, 0x00, 0xb2, 0xd9, 0x6c, + 0xff, 0x00, 0x0a, 0x85, 0x42, 0x5f, 0x36, 0x07, + 0xf8, 0x1b, 0xa7, 0x8d, 0x56, 0x66, 0x8d, 0x73, + 0x68, 0x22, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; /* End Of File */ /* window_hatch_small.png - 641 bytes */ unsigned char window_hatch_small_png[641] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xdd, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0xd2, - 0x4d, 0x4b, 0x54, 0x61, 0x18, 0xc6, 0xf1, 0xff, - 0x73, 0x3c, 0xbe, 0x34, 0xa3, 0x8e, 0x22, 0x83, - 0xa5, 0xcc, 0x04, 0x59, 0x50, 0x66, 0x2d, 0x82, - 0x22, 0x5a, 0xb9, 0xad, 0x88, 0x88, 0x59, 0xd7, - 0x37, 0xe9, 0x03, 0xf4, 0x05, 0x82, 0x21, 0xd7, - 0xed, 0x66, 0x13, 0x2d, 0x5a, 0x14, 0x14, 0xcd, - 0xa2, 0x81, 0x5c, 0xf4, 0xa2, 0x91, 0x88, 0x6f, - 0x99, 0x43, 0x36, 0xce, 0x9c, 0xc9, 0x69, 0x3c, - 0xe7, 0x79, 0xb9, 0x9f, 0x16, 0x91, 0x22, 0x67, - 0x95, 0x5e, 0xfb, 0xfb, 0xc7, 0x75, 0xc1, 0xad, - 0xca, 0xe5, 0xb2, 0xe7, 0x18, 0x09, 0x01, 0x4a, - 0xa5, 0xd2, 0x91, 0x8e, 0x2b, 0x95, 0xca, 0x5f, - 0x40, 0x44, 0x8e, 0xd7, 0x40, 0x44, 0xf8, 0xf8, - 0xe4, 0x0e, 0xbd, 0x03, 0xfd, 0x28, 0xe5, 0x51, - 0x5e, 0x00, 0x85, 0x17, 0x8f, 0x88, 0x47, 0x5b, - 0xd0, 0xd6, 0xe1, 0x9c, 0xa0, 0x8d, 0xd0, 0xe9, - 0xec, 0x71, 0xfb, 0xe1, 0xeb, 0x03, 0xc0, 0x39, - 0x47, 0x98, 0x19, 0x20, 0x7f, 0xa6, 0x88, 0xb4, - 0x5a, 0x28, 0x1b, 0xa3, 0x01, 0x71, 0x1e, 0xef, - 0x84, 0xc4, 0x06, 0xf8, 0x3d, 0x4f, 0x9f, 0x52, - 0x8c, 0x8f, 0xe4, 0x58, 0xfe, 0xba, 0x82, 0x73, - 0xee, 0x70, 0x83, 0x1e, 0xef, 0xe8, 0x36, 0x9b, - 0xd4, 0xe2, 0x6b, 0x44, 0x93, 0xb7, 0x18, 0xfc, - 0xbd, 0xc5, 0xae, 0xeb, 0xd0, 0x36, 0x27, 0xb8, - 0x91, 0xa9, 0x72, 0x75, 0x62, 0x9b, 0x2f, 0x9f, - 0x22, 0x1a, 0xdb, 0x2d, 0x92, 0xd8, 0xec, 0xcf, - 0xde, 0x07, 0x02, 0x01, 0x1c, 0xbc, 0x39, 0x15, - 0x52, 0xbd, 0x94, 0xe5, 0xde, 0xaf, 0x59, 0x02, - 0x35, 0xc2, 0x6a, 0x02, 0xc5, 0xcc, 0x34, 0x77, - 0x67, 0x5e, 0x60, 0x7c, 0x95, 0x0f, 0x2f, 0x23, - 0xb4, 0x91, 0x34, 0x20, 0x04, 0xe0, 0x43, 0x0a, - 0xd4, 0x20, 0x7a, 0xc6, 0xdb, 0xad, 0x29, 0xae, - 0xf7, 0x3f, 0xa6, 0xe0, 0x47, 0x79, 0xff, 0xe3, - 0x02, 0xe5, 0x9e, 0x90, 0xe1, 0xf5, 0x25, 0xb2, - 0xf2, 0x1d, 0x2f, 0x07, 0x40, 0xf0, 0x0f, 0xf0, - 0xde, 0x63, 0xad, 0x45, 0xd9, 0x5e, 0x8a, 0x61, - 0x81, 0xc2, 0xf0, 0x3c, 0x3b, 0x99, 0x07, 0xb4, - 0xc3, 0x39, 0xda, 0x7a, 0x93, 0x47, 0x4b, 0xe7, - 0x98, 0x5b, 0x9b, 0xc5, 0x1a, 0x45, 0xe0, 0x6d, - 0xba, 0x81, 0xd3, 0x82, 0xd1, 0x86, 0x7c, 0x3e, - 0xe4, 0xe6, 0xe5, 0x19, 0xce, 0x27, 0x57, 0x88, - 0xd4, 0x06, 0xf5, 0xf8, 0x39, 0x66, 0x6f, 0x9e, - 0xd3, 0xa3, 0x53, 0x78, 0xfb, 0x0e, 0x5d, 0xb5, - 0x38, 0xdb, 0x93, 0x06, 0xb4, 0x78, 0x70, 0x9e, - 0xc9, 0x95, 0x2e, 0x04, 0x75, 0xda, 0xf5, 0x06, - 0x26, 0x71, 0xe4, 0x24, 0x46, 0xf5, 0x6d, 0x32, - 0x79, 0xf2, 0x33, 0xed, 0xb5, 0x06, 0xca, 0x0f, - 0x21, 0x81, 0x4a, 0x03, 0x46, 0x84, 0xa1, 0xcc, - 0x20, 0xe3, 0x1b, 0x4d, 0xf4, 0xc2, 0x02, 0xc5, - 0xb3, 0x17, 0xc9, 0x4e, 0x64, 0xc1, 0x6a, 0x5a, - 0xab, 0x1d, 0xb6, 0x5f, 0x2d, 0x32, 0x36, 0x90, - 0x65, 0x78, 0x2c, 0xc7, 0xcf, 0x56, 0xeb, 0x30, - 0xe0, 0x9c, 0xa3, 0xdb, 0xed, 0x12, 0xaf, 0x6f, - 0xa0, 0x13, 0x87, 0x89, 0x2d, 0x3b, 0xcb, 0x8b, - 0xf0, 0x2d, 0xc0, 0x59, 0x47, 0xb2, 0x6b, 0xd0, - 0xc9, 0x2e, 0x68, 0x45, 0xbd, 0x13, 0x11, 0x27, - 0x49, 0xfa, 0x0f, 0xa6, 0xef, 0x3f, 0xfd, 0xaf, - 0x17, 0x4e, 0x4d, 0x38, 0x6a, 0x42, 0x80, 0x5a, - 0xad, 0x76, 0x64, 0xe0, 0x0f, 0xab, 0x27, 0x2b, - 0x35, 0x0f, 0xfc, 0x3e, 0x97, 0x00, 0x00, 0x00, - 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, - 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xdd, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0xd2, + 0x4d, 0x4b, 0x54, 0x61, 0x18, 0xc6, 0xf1, 0xff, + 0x73, 0x3c, 0xbe, 0x34, 0xa3, 0x8e, 0x22, 0x83, + 0xa5, 0xcc, 0x04, 0x59, 0x50, 0x66, 0x2d, 0x82, + 0x22, 0x5a, 0xb9, 0xad, 0x88, 0x88, 0x59, 0xd7, + 0x37, 0xe9, 0x03, 0xf4, 0x05, 0x82, 0x21, 0xd7, + 0xed, 0x66, 0x13, 0x2d, 0x5a, 0x14, 0x14, 0xcd, + 0xa2, 0x81, 0x5c, 0xf4, 0xa2, 0x91, 0x88, 0x6f, + 0x99, 0x43, 0x36, 0xce, 0x9c, 0xc9, 0x69, 0x3c, + 0xe7, 0x79, 0xb9, 0x9f, 0x16, 0x91, 0x22, 0x67, + 0x95, 0x5e, 0xfb, 0xfb, 0xc7, 0x75, 0xc1, 0xad, + 0xca, 0xe5, 0xb2, 0xe7, 0x18, 0x09, 0x01, 0x4a, + 0xa5, 0xd2, 0x91, 0x8e, 0x2b, 0x95, 0xca, 0x5f, + 0x40, 0x44, 0x8e, 0xd7, 0x40, 0x44, 0xf8, 0xf8, + 0xe4, 0x0e, 0xbd, 0x03, 0xfd, 0x28, 0xe5, 0x51, + 0x5e, 0x00, 0x85, 0x17, 0x8f, 0x88, 0x47, 0x5b, + 0xd0, 0xd6, 0xe1, 0x9c, 0xa0, 0x8d, 0xd0, 0xe9, + 0xec, 0x71, 0xfb, 0xe1, 0xeb, 0x03, 0xc0, 0x39, + 0x47, 0x98, 0x19, 0x20, 0x7f, 0xa6, 0x88, 0xb4, + 0x5a, 0x28, 0x1b, 0xa3, 0x01, 0x71, 0x1e, 0xef, + 0x84, 0xc4, 0x06, 0xf8, 0x3d, 0x4f, 0x9f, 0x52, + 0x8c, 0x8f, 0xe4, 0x58, 0xfe, 0xba, 0x82, 0x73, + 0xee, 0x70, 0x83, 0x1e, 0xef, 0xe8, 0x36, 0x9b, + 0xd4, 0xe2, 0x6b, 0x44, 0x93, 0xb7, 0x18, 0xfc, + 0xbd, 0xc5, 0xae, 0xeb, 0xd0, 0x36, 0x27, 0xb8, + 0x91, 0xa9, 0x72, 0x75, 0x62, 0x9b, 0x2f, 0x9f, + 0x22, 0x1a, 0xdb, 0x2d, 0x92, 0xd8, 0xec, 0xcf, + 0xde, 0x07, 0x02, 0x01, 0x1c, 0xbc, 0x39, 0x15, + 0x52, 0xbd, 0x94, 0xe5, 0xde, 0xaf, 0x59, 0x02, + 0x35, 0xc2, 0x6a, 0x02, 0xc5, 0xcc, 0x34, 0x77, + 0x67, 0x5e, 0x60, 0x7c, 0x95, 0x0f, 0x2f, 0x23, + 0xb4, 0x91, 0x34, 0x20, 0x04, 0xe0, 0x43, 0x0a, + 0xd4, 0x20, 0x7a, 0xc6, 0xdb, 0xad, 0x29, 0xae, + 0xf7, 0x3f, 0xa6, 0xe0, 0x47, 0x79, 0xff, 0xe3, + 0x02, 0xe5, 0x9e, 0x90, 0xe1, 0xf5, 0x25, 0xb2, + 0xf2, 0x1d, 0x2f, 0x07, 0x40, 0xf0, 0x0f, 0xf0, + 0xde, 0x63, 0xad, 0x45, 0xd9, 0x5e, 0x8a, 0x61, + 0x81, 0xc2, 0xf0, 0x3c, 0x3b, 0x99, 0x07, 0xb4, + 0xc3, 0x39, 0xda, 0x7a, 0x93, 0x47, 0x4b, 0xe7, + 0x98, 0x5b, 0x9b, 0xc5, 0x1a, 0x45, 0xe0, 0x6d, + 0xba, 0x81, 0xd3, 0x82, 0xd1, 0x86, 0x7c, 0x3e, + 0xe4, 0xe6, 0xe5, 0x19, 0xce, 0x27, 0x57, 0x88, + 0xd4, 0x06, 0xf5, 0xf8, 0x39, 0x66, 0x6f, 0x9e, + 0xd3, 0xa3, 0x53, 0x78, 0xfb, 0x0e, 0x5d, 0xb5, + 0x38, 0xdb, 0x93, 0x06, 0xb4, 0x78, 0x70, 0x9e, + 0xc9, 0x95, 0x2e, 0x04, 0x75, 0xda, 0xf5, 0x06, + 0x26, 0x71, 0xe4, 0x24, 0x46, 0xf5, 0x6d, 0x32, + 0x79, 0xf2, 0x33, 0xed, 0xb5, 0x06, 0xca, 0x0f, + 0x21, 0x81, 0x4a, 0x03, 0x46, 0x84, 0xa1, 0xcc, + 0x20, 0xe3, 0x1b, 0x4d, 0xf4, 0xc2, 0x02, 0xc5, + 0xb3, 0x17, 0xc9, 0x4e, 0x64, 0xc1, 0x6a, 0x5a, + 0xab, 0x1d, 0xb6, 0x5f, 0x2d, 0x32, 0x36, 0x90, + 0x65, 0x78, 0x2c, 0xc7, 0xcf, 0x56, 0xeb, 0x30, + 0xe0, 0x9c, 0xa3, 0xdb, 0xed, 0x12, 0xaf, 0x6f, + 0xa0, 0x13, 0x87, 0x89, 0x2d, 0x3b, 0xcb, 0x8b, + 0xf0, 0x2d, 0xc0, 0x59, 0x47, 0xb2, 0x6b, 0xd0, + 0xc9, 0x2e, 0x68, 0x45, 0xbd, 0x13, 0x11, 0x27, + 0x49, 0xfa, 0x0f, 0xa6, 0xef, 0x3f, 0xfd, 0xaf, + 0x17, 0x4e, 0x4d, 0x38, 0x6a, 0x42, 0x80, 0x5a, + 0xad, 0x76, 0x64, 0xe0, 0x0f, 0xab, 0x27, 0x2b, + 0x35, 0x0f, 0xfc, 0x3e, 0x97, 0x00, 0x00, 0x00, + 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, + 0x82 +}; /* End Of File */ /* window_normal.png - 947 bytes */ unsigned char window_normal_png[947] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, - 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x03, 0x0f, - 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x97, - 0xcd, 0x6b, 0x5c, 0x65, 0x14, 0x87, 0x9f, 0x49, - 0x05, 0x73, 0xb1, 0x4d, 0x1a, 0x33, 0xf6, 0x33, - 0x69, 0x10, 0x14, 0x12, 0xc1, 0xc9, 0x28, 0x22, - 0x08, 0x6e, 0x75, 0x63, 0x75, 0x25, 0x64, 0x61, - 0x08, 0x71, 0x91, 0x71, 0xab, 0x50, 0x70, 0x11, - 0x62, 0xff, 0x01, 0x97, 0xba, 0x98, 0x19, 0x2a, - 0x49, 0x08, 0x22, 0x08, 0x22, 0x08, 0xba, 0x90, - 0x16, 0x74, 0xe1, 0xa2, 0x2b, 0x3b, 0x22, 0xb4, - 0x85, 0x60, 0xa2, 0x45, 0xb0, 0x98, 0xc6, 0x86, - 0x0c, 0x77, 0xda, 0x79, 0xcf, 0xef, 0xb8, 0xb8, - 0x33, 0xd3, 0x7c, 0xcc, 0x57, 0x49, 0xeb, 0x74, - 0xe1, 0x81, 0x97, 0x7b, 0xcf, 0x9d, 0xf3, 0x9e, - 0xf3, 0x9c, 0x33, 0xe7, 0x3d, 0x97, 0x9b, 0xca, - 0xe7, 0xf3, 0x4e, 0x0f, 0xe5, 0x31, 0x80, 0x5c, - 0x2e, 0xd7, 0x93, 0xe0, 0x85, 0x42, 0x21, 0x01, - 0x00, 0xd8, 0xd8, 0xd8, 0xf8, 0x4f, 0x83, 0x0f, - 0x0f, 0x0f, 0x03, 0xdc, 0x03, 0x70, 0xef, 0xcd, - 0x3f, 0xf1, 0x3f, 0x40, 0x47, 0x80, 0x52, 0xf1, - 0xcd, 0x96, 0x9b, 0x25, 0x47, 0x72, 0x4c, 0x4e, - 0x30, 0x61, 0x26, 0x82, 0x89, 0x10, 0x44, 0xb0, - 0xe4, 0xd9, 0xd9, 0x8f, 0x7e, 0x38, 0x18, 0x00, - 0xc0, 0x48, 0x76, 0x02, 0x99, 0x81, 0x7b, 0x62, - 0xe7, 0x7d, 0x38, 0xe0, 0x96, 0xec, 0x73, 0x09, - 0x05, 0x21, 0x33, 0x24, 0x07, 0x81, 0xd3, 0xc7, - 0xcf, 0x97, 0xaf, 0x74, 0xac, 0x6c, 0x03, 0x40, - 0x52, 0xeb, 0x4c, 0x2d, 0xb0, 0x79, 0xe3, 0x2f, - 0xe2, 0xcd, 0xad, 0xae, 0x32, 0x3f, 0x32, 0x38, - 0xc0, 0xf1, 0x53, 0x27, 0x08, 0xa6, 0xb6, 0x7e, - 0xbb, 0xae, 0x80, 0x9b, 0x13, 0x6f, 0x6e, 0xf1, - 0xfd, 0x6b, 0x97, 0x71, 0x27, 0xc9, 0x5e, 0x24, - 0xf7, 0x35, 0xfd, 0xfc, 0xe9, 0xf7, 0x39, 0x1c, - 0x9d, 0x01, 0xc4, 0x67, 0xe7, 0x0b, 0x3c, 0x75, - 0xec, 0x18, 0x66, 0xea, 0x58, 0x81, 0xbe, 0x9d, - 0x00, 0xcd, 0x16, 0x80, 0x6a, 0x3e, 0x2e, 0x96, - 0x3f, 0xe5, 0x62, 0xf9, 0x13, 0xee, 0xa4, 0xae, - 0x61, 0x82, 0x50, 0x5b, 0x55, 0x83, 0x9f, 0x6e, - 0x4d, 0xa2, 0xb8, 0x84, 0xeb, 0x2e, 0xc1, 0x84, - 0xd7, 0x7a, 0xa0, 0x9d, 0xdf, 0xae, 0x01, 0x50, - 0x52, 0xf6, 0x17, 0x86, 0x7e, 0xe3, 0x4e, 0xea, - 0x4b, 0x2e, 0x6d, 0xe7, 0xa8, 0xea, 0x1f, 0x82, - 0x41, 0x35, 0x40, 0x08, 0x50, 0xaa, 0xbc, 0xce, - 0xb7, 0x37, 0x5f, 0x61, 0x6b, 0x7b, 0x15, 0x33, - 0x21, 0x81, 0xa9, 0xb9, 0xcf, 0xfb, 0x06, 0x50, - 0x0d, 0x20, 0x58, 0xe0, 0xa5, 0x81, 0x49, 0xcc, - 0x8c, 0x1f, 0x2b, 0x6f, 0x51, 0xe5, 0x7a, 0x02, - 0x61, 0x70, 0x6d, 0xfb, 0x34, 0x5f, 0x6f, 0xbe, - 0xc7, 0x07, 0xab, 0x17, 0x1a, 0x15, 0x50, 0x17, - 0x00, 0x1d, 0x7b, 0x40, 0x72, 0x14, 0x2c, 0x69, - 0x38, 0x55, 0xf9, 0xf5, 0x76, 0x89, 0xb3, 0x23, - 0x69, 0xfe, 0x2c, 0x57, 0x28, 0x1f, 0x7a, 0x83, - 0x5b, 0x5b, 0x59, 0x86, 0xf4, 0x36, 0x7f, 0xdc, - 0x7c, 0x95, 0xed, 0xca, 0x09, 0x14, 0x0e, 0x91, - 0x91, 0x27, 0xa7, 0x42, 0xde, 0xd2, 0xef, 0x7d, - 0x03, 0x04, 0x13, 0x93, 0xe9, 0xbf, 0x79, 0x7e, - 0xf8, 0x24, 0xa7, 0xfa, 0x9f, 0x21, 0x33, 0x28, - 0xe4, 0x19, 0x7e, 0x3f, 0x72, 0x1d, 0xf1, 0x39, - 0xcf, 0x8e, 0xac, 0x20, 0x92, 0x80, 0xba, 0xe4, - 0x58, 0xb0, 0xb6, 0x7e, 0xbb, 0x06, 0x30, 0x39, - 0x0a, 0x8e, 0x99, 0x38, 0xfe, 0xf8, 0xd3, 0xc8, - 0x45, 0xf0, 0xbb, 0xc8, 0x85, 0x23, 0x4e, 0xf6, - 0x9f, 0x49, 0xca, 0x8a, 0x10, 0x49, 0xd3, 0xdd, - 0x56, 0x09, 0x37, 0x7f, 0x30, 0x00, 0xc1, 0x84, - 0xcc, 0xe9, 0x7f, 0xe2, 0x30, 0x95, 0x8f, 0xbf, - 0xc1, 0x2d, 0x81, 0x49, 0xce, 0xfc, 0xbd, 0x19, - 0x60, 0xb5, 0xd9, 0x20, 0x39, 0xe9, 0xa3, 0x47, - 0xa9, 0xbb, 0x3b, 0x78, 0x05, 0x4c, 0xe0, 0x29, - 0x06, 0x87, 0xd2, 0x0c, 0x0c, 0x3c, 0x49, 0x7d, - 0xae, 0x3c, 0xf7, 0xce, 0x39, 0xca, 0x37, 0xbe, - 0x03, 0x44, 0x7f, 0xfa, 0x65, 0x7e, 0x59, 0xbe, - 0x80, 0xd7, 0x07, 0x8f, 0x43, 0x2a, 0xd5, 0xf7, - 0xe0, 0x2a, 0xb0, 0x7a, 0xf5, 0x6a, 0x63, 0xb6, - 0xd7, 0x33, 0xbf, 0xf2, 0xe1, 0xbb, 0x3b, 0x32, - 0xff, 0x22, 0x19, 0xc1, 0x4d, 0xe4, 0xc0, 0x00, - 0x2f, 0xe6, 0xbe, 0x6a, 0xeb, 0xa0, 0x93, 0x1c, - 0x18, 0xe0, 0x61, 0xcb, 0xa3, 0x09, 0x30, 0x3d, - 0x3d, 0x0d, 0xc0, 0xc4, 0xc4, 0x04, 0xf3, 0xf3, - 0xf3, 0x0d, 0x1d, 0x60, 0x65, 0x65, 0xa5, 0xad, - 0x1e, 0x45, 0x11, 0xc5, 0x62, 0x71, 0x9f, 0xcd, - 0xdc, 0xdc, 0x1c, 0xc5, 0x62, 0x71, 0x1f, 0x40, - 0x63, 0x14, 0x4b, 0x6a, 0xac, 0x28, 0x8a, 0x58, - 0x5e, 0x5e, 0x66, 0x6d, 0x6d, 0x6d, 0x97, 0x1e, - 0x45, 0x51, 0x4b, 0x7d, 0x6a, 0x6a, 0x8a, 0xd1, - 0xd1, 0x51, 0xc6, 0xc6, 0xc6, 0x58, 0x5a, 0x5a, - 0xda, 0x67, 0xb3, 0x37, 0x46, 0xdb, 0x0a, 0xec, - 0xd4, 0x9b, 0x5d, 0xe3, 0x38, 0x66, 0x66, 0x66, - 0x86, 0xf1, 0xf1, 0xf1, 0x7d, 0xbf, 0xef, 0xb5, - 0x69, 0xe6, 0xa3, 0x69, 0x05, 0xf6, 0xbe, 0x28, - 0xda, 0x5d, 0xa3, 0x28, 0x62, 0x71, 0x71, 0x91, - 0xf5, 0xf5, 0xf5, 0x96, 0xbd, 0x53, 0xb7, 0x89, - 0xa2, 0x68, 0xd7, 0xde, 0xae, 0xde, 0x86, 0xcd, - 0x32, 0x9e, 0x9d, 0x9d, 0x25, 0x8e, 0xe3, 0xae, - 0x00, 0xdb, 0xf9, 0x58, 0x58, 0x58, 0xd8, 0x05, - 0x90, 0xca, 0xe7, 0xf3, 0x9e, 0xcb, 0xe5, 0x28, - 0x95, 0x4a, 0x4d, 0x33, 0x79, 0x58, 0x92, 0xc9, - 0x64, 0x76, 0x7f, 0x19, 0x3d, 0x52, 0xc7, 0xb0, - 0x27, 0x00, 0xd9, 0x6c, 0xb6, 0x77, 0x00, 0x85, - 0x42, 0xa1, 0x27, 0xc1, 0x01, 0xfe, 0x05, 0xcf, - 0x6d, 0x38, 0x87, 0xb3, 0x37, 0x5f, 0x86, 0x00, - 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, - 0x42, 0x60, 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x03, 0x0f, + 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xed, 0x97, + 0xcd, 0x6b, 0x5c, 0x65, 0x14, 0x87, 0x9f, 0x49, + 0x05, 0x73, 0xb1, 0x4d, 0x1a, 0x33, 0xf6, 0x33, + 0x69, 0x10, 0x14, 0x12, 0xc1, 0xc9, 0x28, 0x22, + 0x08, 0x6e, 0x75, 0x63, 0x75, 0x25, 0x64, 0x61, + 0x08, 0x71, 0x91, 0x71, 0xab, 0x50, 0x70, 0x11, + 0x62, 0xff, 0x01, 0x97, 0xba, 0x98, 0x19, 0x2a, + 0x49, 0x08, 0x22, 0x08, 0x22, 0x08, 0xba, 0x90, + 0x16, 0x74, 0xe1, 0xa2, 0x2b, 0x3b, 0x22, 0xb4, + 0x85, 0x60, 0xa2, 0x45, 0xb0, 0x98, 0xc6, 0x86, + 0x0c, 0x77, 0xda, 0x79, 0xcf, 0xef, 0xb8, 0xb8, + 0x33, 0xd3, 0x7c, 0xcc, 0x57, 0x49, 0xeb, 0x74, + 0xe1, 0x81, 0x97, 0x7b, 0xcf, 0x9d, 0xf3, 0x9e, + 0xf3, 0x9c, 0x33, 0xe7, 0x3d, 0x97, 0x9b, 0xca, + 0xe7, 0xf3, 0x4e, 0x0f, 0xe5, 0x31, 0x80, 0x5c, + 0x2e, 0xd7, 0x93, 0xe0, 0x85, 0x42, 0x21, 0x01, + 0x00, 0xd8, 0xd8, 0xd8, 0xf8, 0x4f, 0x83, 0x0f, + 0x0f, 0x0f, 0x03, 0xdc, 0x03, 0x70, 0xef, 0xcd, + 0x3f, 0xf1, 0x3f, 0x40, 0x47, 0x80, 0x52, 0xf1, + 0xcd, 0x96, 0x9b, 0x25, 0x47, 0x72, 0x4c, 0x4e, + 0x30, 0x61, 0x26, 0x82, 0x89, 0x10, 0x44, 0xb0, + 0xe4, 0xd9, 0xd9, 0x8f, 0x7e, 0x38, 0x18, 0x00, + 0xc0, 0x48, 0x76, 0x02, 0x99, 0x81, 0x7b, 0x62, + 0xe7, 0x7d, 0x38, 0xe0, 0x96, 0xec, 0x73, 0x09, + 0x05, 0x21, 0x33, 0x24, 0x07, 0x81, 0xd3, 0xc7, + 0xcf, 0x97, 0xaf, 0x74, 0xac, 0x6c, 0x03, 0x40, + 0x52, 0xeb, 0x4c, 0x2d, 0xb0, 0x79, 0xe3, 0x2f, + 0xe2, 0xcd, 0xad, 0xae, 0x32, 0x3f, 0x32, 0x38, + 0xc0, 0xf1, 0x53, 0x27, 0x08, 0xa6, 0xb6, 0x7e, + 0xbb, 0xae, 0x80, 0x9b, 0x13, 0x6f, 0x6e, 0xf1, + 0xfd, 0x6b, 0x97, 0x71, 0x27, 0xc9, 0x5e, 0x24, + 0xf7, 0x35, 0xfd, 0xfc, 0xe9, 0xf7, 0x39, 0x1c, + 0x9d, 0x01, 0xc4, 0x67, 0xe7, 0x0b, 0x3c, 0x75, + 0xec, 0x18, 0x66, 0xea, 0x58, 0x81, 0xbe, 0x9d, + 0x00, 0xcd, 0x16, 0x80, 0x6a, 0x3e, 0x2e, 0x96, + 0x3f, 0xe5, 0x62, 0xf9, 0x13, 0xee, 0xa4, 0xae, + 0x61, 0x82, 0x50, 0x5b, 0x55, 0x83, 0x9f, 0x6e, + 0x4d, 0xa2, 0xb8, 0x84, 0xeb, 0x2e, 0xc1, 0x84, + 0xd7, 0x7a, 0xa0, 0x9d, 0xdf, 0xae, 0x01, 0x50, + 0x52, 0xf6, 0x17, 0x86, 0x7e, 0xe3, 0x4e, 0xea, + 0x4b, 0x2e, 0x6d, 0xe7, 0xa8, 0xea, 0x1f, 0x82, + 0x41, 0x35, 0x40, 0x08, 0x50, 0xaa, 0xbc, 0xce, + 0xb7, 0x37, 0x5f, 0x61, 0x6b, 0x7b, 0x15, 0x33, + 0x21, 0x81, 0xa9, 0xb9, 0xcf, 0xfb, 0x06, 0x50, + 0x0d, 0x20, 0x58, 0xe0, 0xa5, 0x81, 0x49, 0xcc, + 0x8c, 0x1f, 0x2b, 0x6f, 0x51, 0xe5, 0x7a, 0x02, + 0x61, 0x70, 0x6d, 0xfb, 0x34, 0x5f, 0x6f, 0xbe, + 0xc7, 0x07, 0xab, 0x17, 0x1a, 0x15, 0x50, 0x17, + 0x00, 0x1d, 0x7b, 0x40, 0x72, 0x14, 0x2c, 0x69, + 0x38, 0x55, 0xf9, 0xf5, 0x76, 0x89, 0xb3, 0x23, + 0x69, 0xfe, 0x2c, 0x57, 0x28, 0x1f, 0x7a, 0x83, + 0x5b, 0x5b, 0x59, 0x86, 0xf4, 0x36, 0x7f, 0xdc, + 0x7c, 0x95, 0xed, 0xca, 0x09, 0x14, 0x0e, 0x91, + 0x91, 0x27, 0xa7, 0x42, 0xde, 0xd2, 0xef, 0x7d, + 0x03, 0x04, 0x13, 0x93, 0xe9, 0xbf, 0x79, 0x7e, + 0xf8, 0x24, 0xa7, 0xfa, 0x9f, 0x21, 0x33, 0x28, + 0xe4, 0x19, 0x7e, 0x3f, 0x72, 0x1d, 0xf1, 0x39, + 0xcf, 0x8e, 0xac, 0x20, 0x92, 0x80, 0xba, 0xe4, + 0x58, 0xb0, 0xb6, 0x7e, 0xbb, 0x06, 0x30, 0x39, + 0x0a, 0x8e, 0x99, 0x38, 0xfe, 0xf8, 0xd3, 0xc8, + 0x45, 0xf0, 0xbb, 0xc8, 0x85, 0x23, 0x4e, 0xf6, + 0x9f, 0x49, 0xca, 0x8a, 0x10, 0x49, 0xd3, 0xdd, + 0x56, 0x09, 0x37, 0x7f, 0x30, 0x00, 0xc1, 0x84, + 0xcc, 0xe9, 0x7f, 0xe2, 0x30, 0x95, 0x8f, 0xbf, + 0xc1, 0x2d, 0x81, 0x49, 0xce, 0xfc, 0xbd, 0x19, + 0x60, 0xb5, 0xd9, 0x20, 0x39, 0xe9, 0xa3, 0x47, + 0xa9, 0xbb, 0x3b, 0x78, 0x05, 0x4c, 0xe0, 0x29, + 0x06, 0x87, 0xd2, 0x0c, 0x0c, 0x3c, 0x49, 0x7d, + 0xae, 0x3c, 0xf7, 0xce, 0x39, 0xca, 0x37, 0xbe, + 0x03, 0x44, 0x7f, 0xfa, 0x65, 0x7e, 0x59, 0xbe, + 0x80, 0xd7, 0x07, 0x8f, 0x43, 0x2a, 0xd5, 0xf7, + 0xe0, 0x2a, 0xb0, 0x7a, 0xf5, 0x6a, 0x63, 0xb6, + 0xd7, 0x33, 0xbf, 0xf2, 0xe1, 0xbb, 0x3b, 0x32, + 0xff, 0x22, 0x19, 0xc1, 0x4d, 0xe4, 0xc0, 0x00, + 0x2f, 0xe6, 0xbe, 0x6a, 0xeb, 0xa0, 0x93, 0x1c, + 0x18, 0xe0, 0x61, 0xcb, 0xa3, 0x09, 0x30, 0x3d, + 0x3d, 0x0d, 0xc0, 0xc4, 0xc4, 0x04, 0xf3, 0xf3, + 0xf3, 0x0d, 0x1d, 0x60, 0x65, 0x65, 0xa5, 0xad, + 0x1e, 0x45, 0x11, 0xc5, 0x62, 0x71, 0x9f, 0xcd, + 0xdc, 0xdc, 0x1c, 0xc5, 0x62, 0x71, 0x1f, 0x40, + 0x63, 0x14, 0x4b, 0x6a, 0xac, 0x28, 0x8a, 0x58, + 0x5e, 0x5e, 0x66, 0x6d, 0x6d, 0x6d, 0x97, 0x1e, + 0x45, 0x51, 0x4b, 0x7d, 0x6a, 0x6a, 0x8a, 0xd1, + 0xd1, 0x51, 0xc6, 0xc6, 0xc6, 0x58, 0x5a, 0x5a, + 0xda, 0x67, 0xb3, 0x37, 0x46, 0xdb, 0x0a, 0xec, + 0xd4, 0x9b, 0x5d, 0xe3, 0x38, 0x66, 0x66, 0x66, + 0x86, 0xf1, 0xf1, 0xf1, 0x7d, 0xbf, 0xef, 0xb5, + 0x69, 0xe6, 0xa3, 0x69, 0x05, 0xf6, 0xbe, 0x28, + 0xda, 0x5d, 0xa3, 0x28, 0x62, 0x71, 0x71, 0x91, + 0xf5, 0xf5, 0xf5, 0x96, 0xbd, 0x53, 0xb7, 0x89, + 0xa2, 0x68, 0xd7, 0xde, 0xae, 0xde, 0x86, 0xcd, + 0x32, 0x9e, 0x9d, 0x9d, 0x25, 0x8e, 0xe3, 0xae, + 0x00, 0xdb, 0xf9, 0x58, 0x58, 0x58, 0xd8, 0x05, + 0x90, 0xca, 0xe7, 0xf3, 0x9e, 0xcb, 0xe5, 0x28, + 0x95, 0x4a, 0x4d, 0x33, 0x79, 0x58, 0x92, 0xc9, + 0x64, 0x76, 0x7f, 0x19, 0x3d, 0x52, 0xc7, 0xb0, + 0x27, 0x00, 0xd9, 0x6c, 0xb6, 0x77, 0x00, 0x85, + 0x42, 0xa1, 0x27, 0xc1, 0x01, 0xfe, 0x05, 0xcf, + 0x6d, 0x38, 0x87, 0xb3, 0x37, 0x5f, 0x86, 0x00, + 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, + 0x42, 0x60, 0x82 +}; /* End Of File */ /* window_normal_small.png - 641 bytes */ unsigned char window_normal_small_png[641] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, - 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, - 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, - 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, - 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, - 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, - 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, - 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, - 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, - 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, - 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, - 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, - 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xdd, - 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0xd2, - 0x4d, 0x4b, 0x54, 0x61, 0x18, 0xc6, 0xf1, 0xff, - 0x73, 0x3c, 0xbe, 0x34, 0xa3, 0x8e, 0x22, 0x83, - 0xa5, 0xcc, 0x04, 0x59, 0x50, 0x66, 0x2d, 0x82, - 0x22, 0x5a, 0xb9, 0xad, 0x88, 0x88, 0x59, 0xd7, - 0x37, 0xe9, 0x03, 0xf4, 0x05, 0x82, 0x21, 0xd7, - 0xed, 0x66, 0x13, 0x2d, 0x5a, 0x14, 0x14, 0xcd, - 0xa2, 0x81, 0x5c, 0xf4, 0xa2, 0x91, 0x88, 0x6f, - 0x99, 0x43, 0x36, 0xce, 0x9c, 0xc9, 0x69, 0x3c, - 0xe7, 0x79, 0xb9, 0x9f, 0x16, 0x91, 0x22, 0x67, - 0x95, 0x5e, 0xfb, 0xfb, 0xc7, 0x75, 0xc1, 0xad, - 0xca, 0xe5, 0xb2, 0xe7, 0x18, 0x09, 0x01, 0x4a, - 0xa5, 0xd2, 0x91, 0x8e, 0x2b, 0x95, 0xca, 0x5f, - 0x40, 0x44, 0x8e, 0xd7, 0x40, 0x44, 0xf8, 0xf8, - 0xe4, 0x0e, 0xbd, 0x03, 0xfd, 0x28, 0xe5, 0x51, - 0x5e, 0x00, 0x85, 0x17, 0x8f, 0x88, 0x47, 0x5b, - 0xd0, 0xd6, 0xe1, 0x9c, 0xa0, 0x8d, 0xd0, 0xe9, - 0xec, 0x71, 0xfb, 0xe1, 0xeb, 0x03, 0xc0, 0x39, - 0x47, 0x98, 0x19, 0x20, 0x7f, 0xa6, 0x88, 0xb4, - 0x5a, 0x28, 0x1b, 0xa3, 0x01, 0x71, 0x1e, 0xef, - 0x84, 0xc4, 0x06, 0xf8, 0x3d, 0x4f, 0x9f, 0x52, - 0x8c, 0x8f, 0xe4, 0x58, 0xfe, 0xba, 0x82, 0x73, - 0xee, 0x70, 0x83, 0x1e, 0xef, 0xe8, 0x36, 0x9b, - 0xd4, 0xe2, 0x6b, 0x44, 0x93, 0xb7, 0x18, 0xfc, - 0xbd, 0xc5, 0xae, 0xeb, 0xd0, 0x36, 0x27, 0xb8, - 0x91, 0xa9, 0x72, 0x75, 0x62, 0x9b, 0x2f, 0x9f, - 0x22, 0x1a, 0xdb, 0x2d, 0x92, 0xd8, 0xec, 0xcf, - 0xde, 0x07, 0x02, 0x01, 0x1c, 0xbc, 0x39, 0x15, - 0x52, 0xbd, 0x94, 0xe5, 0xde, 0xaf, 0x59, 0x02, - 0x35, 0xc2, 0x6a, 0x02, 0xc5, 0xcc, 0x34, 0x77, - 0x67, 0x5e, 0x60, 0x7c, 0x95, 0x0f, 0x2f, 0x23, - 0xb4, 0x91, 0x34, 0x20, 0x04, 0xe0, 0x43, 0x0a, - 0xd4, 0x20, 0x7a, 0xc6, 0xdb, 0xad, 0x29, 0xae, - 0xf7, 0x3f, 0xa6, 0xe0, 0x47, 0x79, 0xff, 0xe3, - 0x02, 0xe5, 0x9e, 0x90, 0xe1, 0xf5, 0x25, 0xb2, - 0xf2, 0x1d, 0x2f, 0x07, 0x40, 0xf0, 0x0f, 0xf0, - 0xde, 0x63, 0xad, 0x45, 0xd9, 0x5e, 0x8a, 0x61, - 0x81, 0xc2, 0xf0, 0x3c, 0x3b, 0x99, 0x07, 0xb4, - 0xc3, 0x39, 0xda, 0x7a, 0x93, 0x47, 0x4b, 0xe7, - 0x98, 0x5b, 0x9b, 0xc5, 0x1a, 0x45, 0xe0, 0x6d, - 0xba, 0x81, 0xd3, 0x82, 0xd1, 0x86, 0x7c, 0x3e, - 0xe4, 0xe6, 0xe5, 0x19, 0xce, 0x27, 0x57, 0x88, - 0xd4, 0x06, 0xf5, 0xf8, 0x39, 0x66, 0x6f, 0x9e, - 0xd3, 0xa3, 0x53, 0x78, 0xfb, 0x0e, 0x5d, 0xb5, - 0x38, 0xdb, 0x93, 0x06, 0xb4, 0x78, 0x70, 0x9e, - 0xc9, 0x95, 0x2e, 0x04, 0x75, 0xda, 0xf5, 0x06, - 0x26, 0x71, 0xe4, 0x24, 0x46, 0xf5, 0x6d, 0x32, - 0x79, 0xf2, 0x33, 0xed, 0xb5, 0x06, 0xca, 0x0f, - 0x21, 0x81, 0x4a, 0x03, 0x46, 0x84, 0xa1, 0xcc, - 0x20, 0xe3, 0x1b, 0x4d, 0xf4, 0xc2, 0x02, 0xc5, - 0xb3, 0x17, 0xc9, 0x4e, 0x64, 0xc1, 0x6a, 0x5a, - 0xab, 0x1d, 0xb6, 0x5f, 0x2d, 0x32, 0x36, 0x90, - 0x65, 0x78, 0x2c, 0xc7, 0xcf, 0x56, 0xeb, 0x30, - 0xe0, 0x9c, 0xa3, 0xdb, 0xed, 0x12, 0xaf, 0x6f, - 0xa0, 0x13, 0x87, 0x89, 0x2d, 0x3b, 0xcb, 0x8b, - 0xf0, 0x2d, 0xc0, 0x59, 0x47, 0xb2, 0x6b, 0xd0, - 0xc9, 0x2e, 0x68, 0x45, 0xbd, 0x13, 0x11, 0x27, - 0x49, 0xfa, 0x0f, 0xa6, 0xef, 0x3f, 0xfd, 0xaf, - 0x17, 0x4e, 0x4d, 0x38, 0x6a, 0x42, 0x80, 0x5a, - 0xad, 0x76, 0x64, 0xe0, 0x0f, 0xab, 0x27, 0x2b, - 0x35, 0x0f, 0xfc, 0x3e, 0x97, 0x00, 0x00, 0x00, - 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, - 0x82}; + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff, + 0x61, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, + 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, + 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, + 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, 0x00, 0x0b, + 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, 0x00, 0x00, + 0x00, 0x16, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x54, + 0x69, 0x6d, 0x65, 0x00, 0x31, 0x32, 0x2f, 0x31, + 0x38, 0x2f, 0x30, 0x37, 0x23, 0x58, 0x62, 0x2b, + 0x00, 0x00, 0x00, 0x18, 0x74, 0x45, 0x58, 0x74, + 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, + 0x00, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x4f, 0xb3, 0x1f, 0x4e, 0x00, 0x00, 0x01, 0xdd, + 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xa5, 0xd2, + 0x4d, 0x4b, 0x54, 0x61, 0x18, 0xc6, 0xf1, 0xff, + 0x73, 0x3c, 0xbe, 0x34, 0xa3, 0x8e, 0x22, 0x83, + 0xa5, 0xcc, 0x04, 0x59, 0x50, 0x66, 0x2d, 0x82, + 0x22, 0x5a, 0xb9, 0xad, 0x88, 0x88, 0x59, 0xd7, + 0x37, 0xe9, 0x03, 0xf4, 0x05, 0x82, 0x21, 0xd7, + 0xed, 0x66, 0x13, 0x2d, 0x5a, 0x14, 0x14, 0xcd, + 0xa2, 0x81, 0x5c, 0xf4, 0xa2, 0x91, 0x88, 0x6f, + 0x99, 0x43, 0x36, 0xce, 0x9c, 0xc9, 0x69, 0x3c, + 0xe7, 0x79, 0xb9, 0x9f, 0x16, 0x91, 0x22, 0x67, + 0x95, 0x5e, 0xfb, 0xfb, 0xc7, 0x75, 0xc1, 0xad, + 0xca, 0xe5, 0xb2, 0xe7, 0x18, 0x09, 0x01, 0x4a, + 0xa5, 0xd2, 0x91, 0x8e, 0x2b, 0x95, 0xca, 0x5f, + 0x40, 0x44, 0x8e, 0xd7, 0x40, 0x44, 0xf8, 0xf8, + 0xe4, 0x0e, 0xbd, 0x03, 0xfd, 0x28, 0xe5, 0x51, + 0x5e, 0x00, 0x85, 0x17, 0x8f, 0x88, 0x47, 0x5b, + 0xd0, 0xd6, 0xe1, 0x9c, 0xa0, 0x8d, 0xd0, 0xe9, + 0xec, 0x71, 0xfb, 0xe1, 0xeb, 0x03, 0xc0, 0x39, + 0x47, 0x98, 0x19, 0x20, 0x7f, 0xa6, 0x88, 0xb4, + 0x5a, 0x28, 0x1b, 0xa3, 0x01, 0x71, 0x1e, 0xef, + 0x84, 0xc4, 0x06, 0xf8, 0x3d, 0x4f, 0x9f, 0x52, + 0x8c, 0x8f, 0xe4, 0x58, 0xfe, 0xba, 0x82, 0x73, + 0xee, 0x70, 0x83, 0x1e, 0xef, 0xe8, 0x36, 0x9b, + 0xd4, 0xe2, 0x6b, 0x44, 0x93, 0xb7, 0x18, 0xfc, + 0xbd, 0xc5, 0xae, 0xeb, 0xd0, 0x36, 0x27, 0xb8, + 0x91, 0xa9, 0x72, 0x75, 0x62, 0x9b, 0x2f, 0x9f, + 0x22, 0x1a, 0xdb, 0x2d, 0x92, 0xd8, 0xec, 0xcf, + 0xde, 0x07, 0x02, 0x01, 0x1c, 0xbc, 0x39, 0x15, + 0x52, 0xbd, 0x94, 0xe5, 0xde, 0xaf, 0x59, 0x02, + 0x35, 0xc2, 0x6a, 0x02, 0xc5, 0xcc, 0x34, 0x77, + 0x67, 0x5e, 0x60, 0x7c, 0x95, 0x0f, 0x2f, 0x23, + 0xb4, 0x91, 0x34, 0x20, 0x04, 0xe0, 0x43, 0x0a, + 0xd4, 0x20, 0x7a, 0xc6, 0xdb, 0xad, 0x29, 0xae, + 0xf7, 0x3f, 0xa6, 0xe0, 0x47, 0x79, 0xff, 0xe3, + 0x02, 0xe5, 0x9e, 0x90, 0xe1, 0xf5, 0x25, 0xb2, + 0xf2, 0x1d, 0x2f, 0x07, 0x40, 0xf0, 0x0f, 0xf0, + 0xde, 0x63, 0xad, 0x45, 0xd9, 0x5e, 0x8a, 0x61, + 0x81, 0xc2, 0xf0, 0x3c, 0x3b, 0x99, 0x07, 0xb4, + 0xc3, 0x39, 0xda, 0x7a, 0x93, 0x47, 0x4b, 0xe7, + 0x98, 0x5b, 0x9b, 0xc5, 0x1a, 0x45, 0xe0, 0x6d, + 0xba, 0x81, 0xd3, 0x82, 0xd1, 0x86, 0x7c, 0x3e, + 0xe4, 0xe6, 0xe5, 0x19, 0xce, 0x27, 0x57, 0x88, + 0xd4, 0x06, 0xf5, 0xf8, 0x39, 0x66, 0x6f, 0x9e, + 0xd3, 0xa3, 0x53, 0x78, 0xfb, 0x0e, 0x5d, 0xb5, + 0x38, 0xdb, 0x93, 0x06, 0xb4, 0x78, 0x70, 0x9e, + 0xc9, 0x95, 0x2e, 0x04, 0x75, 0xda, 0xf5, 0x06, + 0x26, 0x71, 0xe4, 0x24, 0x46, 0xf5, 0x6d, 0x32, + 0x79, 0xf2, 0x33, 0xed, 0xb5, 0x06, 0xca, 0x0f, + 0x21, 0x81, 0x4a, 0x03, 0x46, 0x84, 0xa1, 0xcc, + 0x20, 0xe3, 0x1b, 0x4d, 0xf4, 0xc2, 0x02, 0xc5, + 0xb3, 0x17, 0xc9, 0x4e, 0x64, 0xc1, 0x6a, 0x5a, + 0xab, 0x1d, 0xb6, 0x5f, 0x2d, 0x32, 0x36, 0x90, + 0x65, 0x78, 0x2c, 0xc7, 0xcf, 0x56, 0xeb, 0x30, + 0xe0, 0x9c, 0xa3, 0xdb, 0xed, 0x12, 0xaf, 0x6f, + 0xa0, 0x13, 0x87, 0x89, 0x2d, 0x3b, 0xcb, 0x8b, + 0xf0, 0x2d, 0xc0, 0x59, 0x47, 0xb2, 0x6b, 0xd0, + 0xc9, 0x2e, 0x68, 0x45, 0xbd, 0x13, 0x11, 0x27, + 0x49, 0xfa, 0x0f, 0xa6, 0xef, 0x3f, 0xfd, 0xaf, + 0x17, 0x4e, 0x4d, 0x38, 0x6a, 0x42, 0x80, 0x5a, + 0xad, 0x76, 0x64, 0xe0, 0x0f, 0xab, 0x27, 0x2b, + 0x35, 0x0f, 0xfc, 0x3e, 0x97, 0x00, 0x00, 0x00, + 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, + 0x82 +}; /* End Of File */ diff --git a/source/position.h b/source/position.h index 2e5eacb2..32d1fe7f 100644 --- a/source/position.h +++ b/source/position.h @@ -30,81 +30,98 @@ class Position { // cases int x, y, z; - Position() : x(0), y(0), z(0) {} - Position(int x, int y, int z) : x(x), y(y), z(z) {} + Position() : + x(0), y(0), z(0) { } + Position(int x, int y, int z) : + x(x), y(y), z(z) { } - bool operator<(const Position& other) const noexcept { - if(z < other.z) + bool operator<(const Position &other) const noexcept { + if (z < other.z) { return true; - if(z > other.z) + } + if (z > other.z) { return false; + } - if(y < other.y) + if (y < other.y) { return true; - if(y > other.y) + } + if (y > other.y) { return false; + } - if(x < other.x) + if (x < other.x) { return true; - //if(x > p.x) + } + // if(x > p.x) // return false; - return false; } - bool operator>(const Position& other) const noexcept { + bool operator>(const Position &other) const noexcept { return !(*this < other); } - Position operator-(const Position& other) const noexcept { + Position operator-(const Position &other) const noexcept { return Position(x - other.x, y - other.y, z - other.z); } - Position operator+(const Position& other) const noexcept { + Position operator+(const Position &other) const noexcept { return Position(x + other.x, y + other.y, z + other.z); } - Position& operator+=(const Position& other) { + Position &operator+=(const Position &other) { *this = *this + other; return *this; } - bool operator==(const Position& other) const noexcept { + bool operator==(const Position &other) const noexcept { return other.z == z && other.x == x && other.y == y; } - bool operator!=(const Position& other) const noexcept { + bool operator!=(const Position &other) const noexcept { return !(*this == other); } bool isValid() const noexcept { - if(x == 0 && y == 0 && z == 0) + if (x == 0 && y == 0 && z == 0) { return false; + } return (z >= rme::MapMinLayer && z <= rme::MapMaxLayer) && (x >= 0 && x <= rme::MapMaxWidth) && (y >= 0 && y <= rme::MapMaxHeight); } }; -inline std::ostream& operator<<(std::ostream& os, const Position& pos) { +inline std::ostream &operator<<(std::ostream &os, const Position &pos) { os << pos.x << ':' << pos.y << ':' << pos.z; return os; } -inline std::istream& operator>>(std::istream& is, Position& pos) { +inline std::istream &operator>>(std::istream &is, Position &pos) { char a, b; int x, y, z; is >> x; - if(!is) return is; + if (!is) { + return is; + } is >> a; - if(!is || a != ':') return is; + if (!is || a != ':') { + return is; + } is >> y; - if(!is) return is; + if (!is) { + return is; + } is >> b; - if(!is || b != ':') return is; + if (!is || b != ':') { + return is; + } is >> z; - if(!is) return is; + if (!is) { + return is; + } pos.x = x; pos.y = y; @@ -113,7 +130,7 @@ inline std::istream& operator>>(std::istream& is, Position& pos) { return is; } -inline Position abs(const Position& position) { +inline Position abs(const Position &position) { return Position( std::abs(position.x), std::abs(position.y), diff --git a/source/positionctrl.cpp b/source/positionctrl.cpp index d964d33b..22a88497 100644 --- a/source/positionctrl.cpp +++ b/source/positionctrl.cpp @@ -20,10 +20,8 @@ #include "numbertextctrl.h" #include "position.h" -PositionCtrl::PositionCtrl(wxWindow* parent, const wxString& label, int x, int y, int z, - int maxx /*= rme::MapMaxWidth*/, int maxy /*= rme::MapMaxHeight*/, int maxz /*= rme::MapMaxLayer*/) : -wxStaticBoxSizer(wxHORIZONTAL, parent, label) -{ +PositionCtrl::PositionCtrl(wxWindow* parent, const wxString &label, int x, int y, int z, int maxx /*= rme::MapMaxWidth*/, int maxy /*= rme::MapMaxHeight*/, int maxz /*= rme::MapMaxLayer*/) : + wxStaticBoxSizer(wxHORIZONTAL, parent, label) { x_field = newd NumberTextCtrl(parent, wxID_ANY, x, 0, maxx, wxTE_PROCESS_ENTER, "X", wxDefaultPosition, wxSize(60, 20)); x_field->Bind(wxEVT_TEXT_PASTE, &PositionCtrl::OnClipboardText, this); Add(x_field, 2, wxEXPAND | wxLEFT | wxBOTTOM, 5); @@ -37,13 +35,11 @@ wxStaticBoxSizer(wxHORIZONTAL, parent, label) Add(z_field, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); } -PositionCtrl::~PositionCtrl() -{ +PositionCtrl::~PositionCtrl() { //// } -Position PositionCtrl::GetPosition() const -{ +Position PositionCtrl::GetPosition() const { Position pos; pos.x = x_field->GetIntValue(); pos.y = y_field->GetIntValue(); @@ -51,22 +47,19 @@ Position PositionCtrl::GetPosition() const return pos; } -void PositionCtrl::SetPosition(Position pos) -{ +void PositionCtrl::SetPosition(Position pos) { x_field->SetIntValue(pos.x); y_field->SetIntValue(pos.y); z_field->SetIntValue(pos.z); } -bool PositionCtrl::Enable(bool enable) -{ +bool PositionCtrl::Enable(bool enable) { return (x_field->Enable(enable) && y_field->Enable(enable) && z_field->Enable(enable)); } -void PositionCtrl::OnClipboardText(wxClipboardTextEvent& evt) -{ +void PositionCtrl::OnClipboardText(wxClipboardTextEvent &evt) { Position position; - if(posFromClipboard(position.x, position.y, position.z)) { + if (posFromClipboard(position.x, position.y, position.z)) { x_field->SetIntValue(position.x); y_field->SetIntValue(position.y); z_field->SetIntValue(position.z); diff --git a/source/positionctrl.h b/source/positionctrl.h index 9b634409..5c740162 100644 --- a/source/positionctrl.h +++ b/source/positionctrl.h @@ -20,26 +20,36 @@ #include "numbertextctrl.h" -class PositionCtrl : public wxStaticBoxSizer -{ +class PositionCtrl : public wxStaticBoxSizer { public: - PositionCtrl(wxWindow* parent, const wxString& label, int x, int y, int z, - int maxx = rme::MapMaxWidth, int maxy = rme::MapMaxHeight, int maxz = rme::MapMaxLayer); + PositionCtrl(wxWindow* parent, const wxString &label, int x, int y, int z, int maxx = rme::MapMaxWidth, int maxy = rme::MapMaxHeight, int maxz = rme::MapMaxLayer); ~PositionCtrl(); - long GetX() const { return x_field->GetIntValue(); } - long GetY() const { return y_field->GetIntValue(); } - long GetZ() const { return z_field->GetIntValue(); } + long GetX() const { + return x_field->GetIntValue(); + } + long GetY() const { + return y_field->GetIntValue(); + } + long GetZ() const { + return z_field->GetIntValue(); + } Position GetPosition() const; - void SetX(long value) { x_field->SetIntValue(value); } - void SetY(long value) { y_field->SetIntValue(value); } - void SetZ(long value) { z_field->SetIntValue(value); } + void SetX(long value) { + x_field->SetIntValue(value); + } + void SetY(long value) { + y_field->SetIntValue(value); + } + void SetZ(long value) { + z_field->SetIntValue(value); + } void SetPosition(Position pos); bool Enable(bool enable = true); - void OnClipboardText(wxClipboardTextEvent&); + void OnClipboardText(wxClipboardTextEvent &); protected: NumberTextCtrl* x_field; diff --git a/source/preferences.cpp b/source/preferences.cpp index 83d44e18..358bd722 100644 --- a/source/preferences.cpp +++ b/source/preferences.cpp @@ -15,7 +15,6 @@ // along with this program. If not, see . ////////////////////////////////////////////////////////////////////// - #include "main.h" #include "settings.h" @@ -27,45 +26,43 @@ #include "preferences.h" BEGIN_EVENT_TABLE(PreferencesWindow, wxDialog) - EVT_BUTTON(wxID_OK, PreferencesWindow::OnClickOK) - EVT_BUTTON(wxID_CANCEL, PreferencesWindow::OnClickCancel) - EVT_BUTTON(wxID_APPLY, PreferencesWindow::OnClickApply) - EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY, PreferencesWindow::OnCollapsiblePane) +EVT_BUTTON(wxID_OK, PreferencesWindow::OnClickOK) +EVT_BUTTON(wxID_CANCEL, PreferencesWindow::OnClickCancel) +EVT_BUTTON(wxID_APPLY, PreferencesWindow::OnClickApply) +EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY, PreferencesWindow::OnCollapsiblePane) END_EVENT_TABLE() -PreferencesWindow::PreferencesWindow(wxWindow *parent, bool clientVersionSelected = false) - : wxDialog(parent, wxID_ANY, "Preferences", wxDefaultPosition, wxSize(400, 400), wxCAPTION | wxCLOSE_BOX) { - wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); +PreferencesWindow::PreferencesWindow(wxWindow* parent, bool clientVersionSelected = false) : + wxDialog(parent, wxID_ANY, "Preferences", wxDefaultPosition, wxSize(400, 400), wxCAPTION | wxCLOSE_BOX) { + wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); - book = newd wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_TOP); - //book->SetPadding(4); + book = newd wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_TOP); + // book->SetPadding(4); - book->AddPage(CreateGeneralPage(), "General", true); - book->AddPage(CreateEditorPage(), "Editor"); - book->AddPage(CreateGraphicsPage(), "Graphics"); - book->AddPage(CreateUIPage(), "Interface"); - book->AddPage(CreateClientPage(), "Client Version", clientVersionSelected); + book->AddPage(CreateGeneralPage(), "General", true); + book->AddPage(CreateEditorPage(), "Editor"); + book->AddPage(CreateGraphicsPage(), "Graphics"); + book->AddPage(CreateUIPage(), "Interface"); + book->AddPage(CreateClientPage(), "Client Version", clientVersionSelected); - sizer->Add(book, 1, wxEXPAND | wxALL, 10); + sizer->Add(book, 1, wxEXPAND | wxALL, 10); - wxSizer* subsizer = newd wxBoxSizer(wxHORIZONTAL); - subsizer->Add(newd wxButton(this, wxID_OK, "OK"), wxSizerFlags(1).Center()); - subsizer->Add(newd wxButton(this, wxID_CANCEL, "Cancel"), wxSizerFlags(1).Border(wxALL, 5).Left().Center()); - subsizer->Add(newd wxButton(this, wxID_APPLY, "Apply"), wxSizerFlags(1).Center()); - sizer->Add(subsizer, 0, wxCENTER | wxLEFT | wxBOTTOM | wxRIGHT, 10); + wxSizer* subsizer = newd wxBoxSizer(wxHORIZONTAL); + subsizer->Add(newd wxButton(this, wxID_OK, "OK"), wxSizerFlags(1).Center()); + subsizer->Add(newd wxButton(this, wxID_CANCEL, "Cancel"), wxSizerFlags(1).Border(wxALL, 5).Left().Center()); + subsizer->Add(newd wxButton(this, wxID_APPLY, "Apply"), wxSizerFlags(1).Center()); + sizer->Add(subsizer, 0, wxCENTER | wxLEFT | wxBOTTOM | wxRIGHT, 10); - SetSizerAndFit(sizer); - Centre(wxBOTH); - // FindWindowById(PANE_ADVANCED_GRAPHICS, this)->GetParent()->Fit(); + SetSizerAndFit(sizer); + Centre(wxBOTH); + // FindWindowById(PANE_ADVANCED_GRAPHICS, this)->GetParent()->Fit(); } -PreferencesWindow::~PreferencesWindow() -{ +PreferencesWindow::~PreferencesWindow() { //// } -wxNotebookPage* PreferencesWindow::CreateGeneralPage() -{ +wxNotebookPage* PreferencesWindow::CreateGeneralPage() { wxNotebookPage* general_page = newd wxPanel(book, wxID_ANY); wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); @@ -91,7 +88,7 @@ wxNotebookPage* PreferencesWindow::CreateGeneralPage() sizer->AddSpacer(10); - auto * grid_sizer = newd wxFlexGridSizer(2, 10, 10); + auto* grid_sizer = newd wxFlexGridSizer(2, 10, 10); grid_sizer->AddGrowableCol(1); grid_sizer->Add(tmptext = newd wxStaticText(general_page, wxID_ANY, "Undo queue size: "), 0); @@ -118,7 +115,7 @@ wxNotebookPage* PreferencesWindow::CreateGeneralPage() sizer->AddSpacer(10); wxString position_choices[] = { " {x = 0, y = 0, z = 0}", - R"( {"x":0,"y":0,"z":0})", + R"( {"x":0,"y":0,"z":0})", " x, y, z", " (x, y, z)", " Position(x, y, z)" }; @@ -133,8 +130,7 @@ wxNotebookPage* PreferencesWindow::CreateGeneralPage() return general_page; } -wxNotebookPage* PreferencesWindow::CreateEditorPage() -{ +wxNotebookPage* PreferencesWindow::CreateEditorPage() { wxNotebookPage* editor_page = newd wxPanel(book, wxID_ANY); wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); @@ -201,8 +197,7 @@ wxNotebookPage* PreferencesWindow::CreateEditorPage() return editor_page; } -wxNotebookPage* PreferencesWindow::CreateGraphicsPage() -{ +wxNotebookPage* PreferencesWindow::CreateGraphicsPage() { wxWindow* tmp; wxNotebookPage* graphics_page = newd wxPanel(book, wxID_ANY); @@ -225,7 +220,7 @@ wxNotebookPage* PreferencesWindow::CreateGraphicsPage() sizer->AddSpacer(10); - auto * subsizer = newd wxFlexGridSizer(2, 10, 10); + auto* subsizer = newd wxFlexGridSizer(2, 10, 10); subsizer->AddGrowableCol(1); // Icon background color @@ -233,9 +228,9 @@ wxNotebookPage* PreferencesWindow::CreateGraphicsPage() icon_background_choice->Append("Black background"); icon_background_choice->Append("Gray background"); icon_background_choice->Append("White background"); - if(g_settings.getInteger(Config::ICON_BACKGROUND) == 255) { + if (g_settings.getInteger(Config::ICON_BACKGROUND) == 255) { icon_background_choice->SetSelection(2); - } else if(g_settings.getInteger(Config::ICON_BACKGROUND) == 88) { + } else if (g_settings.getInteger(Config::ICON_BACKGROUND) == 88) { icon_background_choice->SetSelection(1); } else { icon_background_choice->SetSelection(0); @@ -247,22 +242,12 @@ wxNotebookPage* PreferencesWindow::CreateGraphicsPage() // Cursor colors subsizer->Add(tmp = newd wxStaticText(graphics_page, wxID_ANY, "Cursor color: "), 0); - subsizer->Add(cursor_color_pick = newd wxColourPickerCtrl(graphics_page, wxID_ANY, wxColor( - g_settings.getInteger(Config::CURSOR_RED), - g_settings.getInteger(Config::CURSOR_GREEN), - g_settings.getInteger(Config::CURSOR_BLUE), - g_settings.getInteger(Config::CURSOR_ALPHA) - )), 0); + subsizer->Add(cursor_color_pick = newd wxColourPickerCtrl(graphics_page, wxID_ANY, wxColor(g_settings.getInteger(Config::CURSOR_RED), g_settings.getInteger(Config::CURSOR_GREEN), g_settings.getInteger(Config::CURSOR_BLUE), g_settings.getInteger(Config::CURSOR_ALPHA))), 0); SetWindowToolTip(icon_background_choice, tmp, "The color of the main cursor on the map (while in drawing mode)."); // Alternate cursor color subsizer->Add(tmp = newd wxStaticText(graphics_page, wxID_ANY, "Secondary cursor color: "), 0); - subsizer->Add(cursor_alt_color_pick = newd wxColourPickerCtrl(graphics_page, wxID_ANY, wxColor( - g_settings.getInteger(Config::CURSOR_ALT_RED), - g_settings.getInteger(Config::CURSOR_ALT_GREEN), - g_settings.getInteger(Config::CURSOR_ALT_BLUE), - g_settings.getInteger(Config::CURSOR_ALT_ALPHA) - )), 0); + subsizer->Add(cursor_alt_color_pick = newd wxColourPickerCtrl(graphics_page, wxID_ANY, wxColor(g_settings.getInteger(Config::CURSOR_ALT_RED), g_settings.getInteger(Config::CURSOR_ALT_GREEN), g_settings.getInteger(Config::CURSOR_ALT_BLUE), g_settings.getInteger(Config::CURSOR_ALT_ALPHA))), 0); SetWindowToolTip(icon_background_choice, tmp, "The color of the secondary cursor on the map (for houses and flags)."); // Screenshot dir @@ -279,13 +264,13 @@ wxNotebookPage* PreferencesWindow::CreateGraphicsPage() screenshot_format_choice->Append("JPG"); screenshot_format_choice->Append("TGA"); screenshot_format_choice->Append("BMP"); - if(g_settings.getString(Config::SCREENSHOT_FORMAT) == "png") { + if (g_settings.getString(Config::SCREENSHOT_FORMAT) == "png") { screenshot_format_choice->SetSelection(0); - } else if(g_settings.getString(Config::SCREENSHOT_FORMAT) == "jpg") { + } else if (g_settings.getString(Config::SCREENSHOT_FORMAT) == "jpg") { screenshot_format_choice->SetSelection(1); - } else if(g_settings.getString(Config::SCREENSHOT_FORMAT) == "tga") { + } else if (g_settings.getString(Config::SCREENSHOT_FORMAT) == "tga") { screenshot_format_choice->SetSelection(2); - } else if(g_settings.getString(Config::SCREENSHOT_FORMAT) == "bmp") { + } else if (g_settings.getString(Config::SCREENSHOT_FORMAT) == "bmp") { screenshot_format_choice->SetSelection(3); } else { screenshot_format_choice->SetSelection(0); @@ -351,8 +336,7 @@ wxNotebookPage* PreferencesWindow::CreateGraphicsPage() return graphics_page; } -wxChoice* PreferencesWindow::AddPaletteStyleChoice(wxWindow* parent, wxSizer* sizer, const wxString& short_description, const wxString& description, const std::string& setting) -{ +wxChoice* PreferencesWindow::AddPaletteStyleChoice(wxWindow* parent, wxSizer* sizer, const wxString &short_description, const wxString &description, const std::string &setting) { wxStaticText* text; sizer->Add(text = newd wxStaticText(parent, wxID_ANY, short_description), 0); @@ -366,56 +350,58 @@ wxChoice* PreferencesWindow::AddPaletteStyleChoice(wxWindow* parent, wxSizer* si text->SetToolTip(description); choice->SetToolTip(description); - if(setting == "large icons") { + if (setting == "large icons") { choice->SetSelection(0); - } else if(setting == "small icons") { + } else if (setting == "small icons") { choice->SetSelection(1); - } else if(setting == "listbox") { + } else if (setting == "listbox") { choice->SetSelection(2); } return choice; } -void PreferencesWindow::SetPaletteStyleChoice(wxChoice* ctrl, int key) -{ - if(ctrl->GetSelection() == 0) { +void PreferencesWindow::SetPaletteStyleChoice(wxChoice* ctrl, int key) { + if (ctrl->GetSelection() == 0) { g_settings.setString(key, "large icons"); - } else if(ctrl->GetSelection() == 1) { + } else if (ctrl->GetSelection() == 1) { g_settings.setString(key, "small icons"); - } else if(ctrl->GetSelection() == 2) { + } else if (ctrl->GetSelection() == 2) { g_settings.setString(key, "listbox"); } } -wxNotebookPage* PreferencesWindow::CreateUIPage() -{ +wxNotebookPage* PreferencesWindow::CreateUIPage() { wxNotebookPage* ui_page = newd wxPanel(book, wxID_ANY); wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); - auto * subsizer = newd wxFlexGridSizer(2, 10, 10); + auto* subsizer = newd wxFlexGridSizer(2, 10, 10); subsizer->AddGrowableCol(1); terrain_palette_style_choice = AddPaletteStyleChoice( ui_page, subsizer, "Terrain Palette Style:", "Configures the look of the terrain palette.", - g_settings.getString(Config::PALETTE_TERRAIN_STYLE)); + g_settings.getString(Config::PALETTE_TERRAIN_STYLE) + ); doodad_palette_style_choice = AddPaletteStyleChoice( ui_page, subsizer, "Doodad Palette Style:", "Configures the look of the doodad palette.", - g_settings.getString(Config::PALETTE_DOODAD_STYLE)); + g_settings.getString(Config::PALETTE_DOODAD_STYLE) + ); item_palette_style_choice = AddPaletteStyleChoice( ui_page, subsizer, "Item Palette Style:", "Configures the look of the item palette.", - g_settings.getString(Config::PALETTE_ITEM_STYLE)); + g_settings.getString(Config::PALETTE_ITEM_STYLE) + ); raw_palette_style_choice = AddPaletteStyleChoice( ui_page, subsizer, "RAW Palette Style:", "Configures the look of the raw palette.", - g_settings.getString(Config::PALETTE_RAW_STYLE)); + g_settings.getString(Config::PALETTE_RAW_STYLE) + ); sizer->Add(subsizer, 0, wxALL, 5); @@ -470,14 +456,14 @@ wxNotebookPage* PreferencesWindow::CreateUIPage() sizer->Add(newd wxStaticText(ui_page, wxID_ANY, "Scroll speed: "), 0, wxLEFT | wxTOP, 5); - auto true_scrollspeed = int(std::abs(g_settings.getFloat(Config::SCROLL_SPEED)) * 10); + auto true_scrollspeed = int(std::abs(g_settings.getFloat(Config::SCROLL_SPEED)) * 10); scroll_speed_slider = newd wxSlider(ui_page, wxID_ANY, true_scrollspeed, 1, std::max(true_scrollspeed, 100)); scroll_speed_slider->SetToolTip("This controls how fast the map will scroll when you hold down the center mouse button and move it around."); sizer->Add(scroll_speed_slider, 0, wxEXPAND, 5); sizer->Add(newd wxStaticText(ui_page, wxID_ANY, "Zoom speed: "), 0, wxLEFT | wxTOP, 5); - auto true_zoomspeed = int(g_settings.getFloat(Config::ZOOM_SPEED) * 10); + auto true_zoomspeed = int(g_settings.getFloat(Config::ZOOM_SPEED) * 10); zoom_speed_slider = newd wxSlider(ui_page, wxID_ANY, true_zoomspeed, 1, std::max(true_zoomspeed, 100)); zoom_speed_slider->SetToolTip("This controls how fast you will zoom when you scroll the center mouse button."); sizer->Add(zoom_speed_slider, 0, wxEXPAND, 5); @@ -487,8 +473,7 @@ wxNotebookPage* PreferencesWindow::CreateUIPage() return ui_page; } -wxNotebookPage* PreferencesWindow::CreateClientPage() -{ +wxNotebookPage* PreferencesWindow::CreateClientPage() { wxNotebookPage* client_page = newd wxPanel(book, wxID_ANY); // Refresh g_settings @@ -497,7 +482,7 @@ wxNotebookPage* PreferencesWindow::CreateClientPage() wxSizer* topsizer = newd wxBoxSizer(wxVERTICAL); - auto * options_sizer = newd wxFlexGridSizer(2, 10, 10); + auto* options_sizer = newd wxFlexGridSizer(2, 10, 10); options_sizer->AddGrowableCol(1); // Default client version choice control @@ -517,19 +502,20 @@ wxNotebookPage* PreferencesWindow::CreateClientPage() topsizer->Add(options_sizer, wxSizerFlags(0).Expand()); topsizer->AddSpacer(10); - wxScrolledWindow *client_list_window = newd wxScrolledWindow(client_page, wxID_ANY, wxDefaultPosition, wxDefaultSize); + wxScrolledWindow* client_list_window = newd wxScrolledWindow(client_page, wxID_ANY, wxDefaultPosition, wxDefaultSize); client_list_window->SetMinSize(FROM_DIP(this, wxSize(450, 450))); - auto * client_list_sizer = newd wxFlexGridSizer(2, 10, 10); + auto* client_list_sizer = newd wxFlexGridSizer(2, 10, 10); client_list_sizer->AddGrowableCol(1); - int version_counter = 0; + int version_counter = 0; for (auto version : versions) { - if(!version->isVisible()) + if (!version->isVisible()) { continue; + } default_version_choice->Append(wxstr(version->getName())); - wxStaticText *tmp_text = newd wxStaticText(client_list_window, wxID_ANY, wxString(version->getName())); + wxStaticText* tmp_text = newd wxStaticText(client_list_window, wxID_ANY, wxString(version->getName())); client_list_sizer->Add(tmp_text, wxSizerFlags(0).Expand()); wxDirPickerCtrl* dir_picker = newd wxDirPickerCtrl(client_list_window, wxID_ANY, version->getClientPath().GetFullPath()); @@ -541,8 +527,9 @@ wxNotebookPage* PreferencesWindow::CreateClientPage() tmp_text->SetToolTip(tooltip); dir_picker->SetToolTip(tooltip); - if(version->getID() == g_settings.getInteger(Config::DEFAULT_CLIENT_VERSION)) + if (version->getID() == g_settings.getInteger(Config::DEFAULT_CLIENT_VERSION)) { default_version_choice->SetSelection(version_counter); + } version_counter++; } @@ -559,32 +546,27 @@ wxNotebookPage* PreferencesWindow::CreateClientPage() // Event handlers! -void PreferencesWindow::OnClickOK(wxCommandEvent& WXUNUSED(event)) -{ +void PreferencesWindow::OnClickOK(wxCommandEvent &WXUNUSED(event)) { Apply(); EndModal(0); } -void PreferencesWindow::OnClickCancel(wxCommandEvent& WXUNUSED(event)) -{ +void PreferencesWindow::OnClickCancel(wxCommandEvent &WXUNUSED(event)) { EndModal(0); } -void PreferencesWindow::OnClickApply(wxCommandEvent& WXUNUSED(event)) -{ +void PreferencesWindow::OnClickApply(wxCommandEvent &WXUNUSED(event)) { Apply(); } -void PreferencesWindow::OnCollapsiblePane(wxCollapsiblePaneEvent& event) -{ - auto * win = (wxWindow*)event.GetEventObject(); +void PreferencesWindow::OnCollapsiblePane(wxCollapsiblePaneEvent &event) { + auto* win = (wxWindow*)event.GetEventObject(); win->GetParent()->Fit(); } // Stuff -void PreferencesWindow::Apply() -{ +void PreferencesWindow::Apply() { bool must_restart = false; // General g_settings.setInteger(Config::WELCOME_DIALOG, show_welcome_dialog_chkbox->GetValue()); @@ -612,22 +594,22 @@ void PreferencesWindow::Apply() // Graphics g_settings.setInteger(Config::USE_GUI_SELECTION_SHADOW, icon_selection_shadow_chkbox->GetValue()); - if(g_settings.getBoolean(Config::USE_MEMCACHED_SPRITES) != use_memcached_chkbox->GetValue()) { + if (g_settings.getBoolean(Config::USE_MEMCACHED_SPRITES) != use_memcached_chkbox->GetValue()) { must_restart = true; } g_settings.setInteger(Config::USE_MEMCACHED_SPRITES_TO_SAVE, use_memcached_chkbox->GetValue()); - if(icon_background_choice->GetSelection() == 0) { - if(g_settings.getInteger(Config::ICON_BACKGROUND) != 0) { + if (icon_background_choice->GetSelection() == 0) { + if (g_settings.getInteger(Config::ICON_BACKGROUND) != 0) { g_gui.gfx.cleanSoftwareSprites(); } g_settings.setInteger(Config::ICON_BACKGROUND, 0); - } else if(icon_background_choice->GetSelection() == 1) { - if(g_settings.getInteger(Config::ICON_BACKGROUND) != 88) { + } else if (icon_background_choice->GetSelection() == 1) { + if (g_settings.getInteger(Config::ICON_BACKGROUND) != 88) { g_gui.gfx.cleanSoftwareSprites(); } g_settings.setInteger(Config::ICON_BACKGROUND, 88); - } else if(icon_background_choice->GetSelection() == 2) { - if(g_settings.getInteger(Config::ICON_BACKGROUND) != 255) { + } else if (icon_background_choice->GetSelection() == 2) { + if (g_settings.getInteger(Config::ICON_BACKGROUND) != 255) { g_gui.gfx.cleanSoftwareSprites(); } g_settings.setInteger(Config::ICON_BACKGROUND, 255); @@ -637,27 +619,27 @@ void PreferencesWindow::Apply() g_settings.setString(Config::SCREENSHOT_DIRECTORY, nstr(screenshot_directory_picker->GetPath())); std::string new_format = nstr(screenshot_format_choice->GetStringSelection()); - if(new_format == "PNG") { + if (new_format == "PNG") { g_settings.setString(Config::SCREENSHOT_FORMAT, "png"); - } else if(new_format == "TGA") { + } else if (new_format == "TGA") { g_settings.setString(Config::SCREENSHOT_FORMAT, "tga"); - } else if(new_format == "JPG") { + } else if (new_format == "JPG") { g_settings.setString(Config::SCREENSHOT_FORMAT, "jpg"); - } else if(new_format == "BMP") { + } else if (new_format == "BMP") { g_settings.setString(Config::SCREENSHOT_FORMAT, "bmp"); } wxColor clr = cursor_color_pick->GetColour(); - g_settings.setInteger(Config::CURSOR_RED, clr.Red()); - g_settings.setInteger(Config::CURSOR_GREEN, clr.Green()); - g_settings.setInteger(Config::CURSOR_BLUE, clr.Blue()); - //g_settings.setInteger(Config::CURSOR_ALPHA, clr.Alpha()); + g_settings.setInteger(Config::CURSOR_RED, clr.Red()); + g_settings.setInteger(Config::CURSOR_GREEN, clr.Green()); + g_settings.setInteger(Config::CURSOR_BLUE, clr.Blue()); + // g_settings.setInteger(Config::CURSOR_ALPHA, clr.Alpha()); clr = cursor_alt_color_pick->GetColour(); - g_settings.setInteger(Config::CURSOR_ALT_RED, clr.Red()); - g_settings.setInteger(Config::CURSOR_ALT_GREEN, clr.Green()); - g_settings.setInteger(Config::CURSOR_ALT_BLUE, clr.Blue()); - //g_settings.setInteger(Config::CURSOR_ALT_ALPHA, clr.Alpha()); + g_settings.setInteger(Config::CURSOR_ALT_RED, clr.Red()); + g_settings.setInteger(Config::CURSOR_ALT_GREEN, clr.Green()); + g_settings.setInteger(Config::CURSOR_ALT_BLUE, clr.Blue()); + // g_settings.setInteger(Config::CURSOR_ALT_ALPHA, clr.Alpha()); g_settings.setInteger(Config::HIDE_ITEMS_WHEN_ZOOMED, hide_items_when_zoomed_chkbox->GetValue()); /* @@ -682,28 +664,29 @@ void PreferencesWindow::Apply() g_settings.setInteger(Config::USE_LARGE_CONTAINER_ICONS, large_container_icons_chkbox->GetValue()); g_settings.setInteger(Config::USE_LARGE_CHOOSE_ITEM_ICONS, large_pick_item_icons_chkbox->GetValue()); - g_settings.setInteger(Config::SWITCH_MOUSEBUTTONS, switch_mousebtn_chkbox->GetValue()); g_settings.setInteger(Config::DOUBLECLICK_PROPERTIES, doubleclick_properties_chkbox->GetValue()); float scroll_mul = 1.0; - if(inversed_scroll_chkbox->GetValue()) { + if (inversed_scroll_chkbox->GetValue()) { scroll_mul = -1.0; } - g_settings.setFloat(Config::SCROLL_SPEED, scroll_mul * scroll_speed_slider->GetValue()/10.f); - g_settings.setFloat(Config::ZOOM_SPEED, zoom_speed_slider->GetValue()/10.f); + g_settings.setFloat(Config::SCROLL_SPEED, scroll_mul * scroll_speed_slider->GetValue() / 10.f); + g_settings.setFloat(Config::ZOOM_SPEED, zoom_speed_slider->GetValue() / 10.f); // Client ClientVersionList versions = ClientVersion::getAllVisible(); int version_counter = 0; for (auto version : versions) { - wxString dir = version_dir_pickers[version_counter]->GetPath(); - if(dir.Length() > 0 && dir.Last() != '/' && dir.Last() != '\\') + wxString dir = version_dir_pickers[version_counter]->GetPath(); + if (dir.Length() > 0 && dir.Last() != '/' && dir.Last() != '\\') { dir.Append("/"); + } version->setClientPath(FileName(dir)); - if(version->getName() == default_version_choice->GetStringSelection()) + if (version->getName() == default_version_choice->GetStringSelection()) { g_settings.setInteger(Config::DEFAULT_CLIENT_VERSION, version->getID()); + } version_counter++; } @@ -715,7 +698,7 @@ void PreferencesWindow::Apply() g_settings.save(); - if(must_restart) { + if (must_restart) { g_gui.PopupDialog(this, "Notice", "You must restart the editor for the changes to take effect.", wxOK); } g_gui.RebuildPalettes(); diff --git a/source/preferences.h b/source/preferences.h index dbe61200..3ffb9cc3 100644 --- a/source/preferences.h +++ b/source/preferences.h @@ -15,25 +15,24 @@ // along with this program. If not, see . ////////////////////////////////////////////////////////////////////// - #ifndef RME_PREFERENCES_WINDOW_H_ #define RME_PREFERENCES_WINDOW_H_ #include "main.h" -class PreferencesWindow : public wxDialog -{ +class PreferencesWindow : public wxDialog { public: - explicit PreferencesWindow(wxWindow* parent) : PreferencesWindow(parent, false) {}; - PreferencesWindow(wxWindow* parent, bool clientVersionSelected); + explicit PreferencesWindow(wxWindow* parent) : + PreferencesWindow(parent, false) {}; + PreferencesWindow(wxWindow* parent, bool clientVersionSelected); virtual ~PreferencesWindow(); - void OnClickDefaults(wxCommandEvent&); - void OnClickApply(wxCommandEvent&); - void OnClickOK(wxCommandEvent&); - void OnClickCancel(wxCommandEvent&); + void OnClickDefaults(wxCommandEvent &); + void OnClickApply(wxCommandEvent &); + void OnClickOK(wxCommandEvent &); + void OnClickCancel(wxCommandEvent &); - void OnCollapsiblePane(wxCollapsiblePaneEvent&); + void OnCollapsiblePane(wxCollapsiblePaneEvent &); protected: void SetDefaults(); @@ -110,7 +109,7 @@ class PreferencesWindow : public wxDialog wxCheckBox* check_sigs_chkbox; // Create controls - wxChoice* AddPaletteStyleChoice(wxWindow* parent, wxSizer* sizer, const wxString& short_description, const wxString& description, const std::string& setting); + wxChoice* AddPaletteStyleChoice(wxWindow* parent, wxSizer* sizer, const wxString &short_description, const wxString &description, const std::string &setting); void SetPaletteStyleChoice(wxChoice* ctrl, int key); // Create windows diff --git a/source/process_com.cpp b/source/process_com.cpp index 5e1ebfbb..228e8891 100644 --- a/source/process_com.cpp +++ b/source/process_com.cpp @@ -19,66 +19,56 @@ #ifdef _USE_PROCESS_COM -#include "gui.h" -#include "process_com.h" + #include "gui.h" + #include "process_com.h" +// Server -//Server - -RMEProcessServer::RMEProcessServer() -{ +RMEProcessServer::RMEProcessServer() { //// } -RMEProcessServer::~RMEProcessServer() -{ +RMEProcessServer::~RMEProcessServer() { //// } -wxConnectionBase* RMEProcessServer::OnAcceptConnection(const wxString& topic) -{ - if(topic.Lower() == "rme_talk") { - g_gui.root->Iconize(false); //Show application if minimized - g_gui.root->Raise(); //Request the window manager to raise this application to the top of Z-order +wxConnectionBase* RMEProcessServer::OnAcceptConnection(const wxString &topic) { + if (topic.Lower() == "rme_talk") { + g_gui.root->Iconize(false); // Show application if minimized + g_gui.root->Raise(); // Request the window manager to raise this application to the top of Z-order return newd RMEProcessConnection(); } return nullptr; } +// Client -//Client - -RMEProcessClient::RMEProcessClient() : proc(nullptr) -{ +RMEProcessClient::RMEProcessClient() : + proc(nullptr) { //// } -RMEProcessClient::~RMEProcessClient() -{ +RMEProcessClient::~RMEProcessClient() { delete proc; } -wxConnectionBase* RMEProcessClient::OnMakeConnection() -{ +wxConnectionBase* RMEProcessClient::OnMakeConnection() { return proc = newd RMEProcessConnection(); } +// Connection -//Connection - -RMEProcessConnection::RMEProcessConnection() : wxConnection() -{ +RMEProcessConnection::RMEProcessConnection() : + wxConnection() { //// } -RMEProcessConnection::~RMEProcessConnection() -{ +RMEProcessConnection::~RMEProcessConnection() { //// } -bool RMEProcessConnection::OnExec(const wxString& topic, const wxString& fileName) -{ - if(topic.Lower() == "rme_talk" && fileName != wxEmptyString) { +bool RMEProcessConnection::OnExec(const wxString &topic, const wxString &fileName) { + if (topic.Lower() == "rme_talk" && fileName != wxEmptyString) { g_gui.LoadMap(FileName(fileName)); return true; } diff --git a/source/process_com.h b/source/process_com.h index 3045d0a7..389ffbad 100644 --- a/source/process_com.h +++ b/source/process_com.h @@ -15,20 +15,19 @@ // along with this program. If not, see . ////////////////////////////////////////////////////////////////////// - #ifdef _USE_PROCESS_COM -#ifndef RME_PROCESS_COMMUNICATION_H_ -#define RME_PROCESS_COMMUNICATION_H_ + #ifndef RME_PROCESS_COMMUNICATION_H_ + #define RME_PROCESS_COMMUNICATION_H_ -#include "wx/ipc.h" + #include "wx/ipc.h" class RMEProcessConnection : public wxConnection { public: RMEProcessConnection(); ~RMEProcessConnection(); - bool OnExec(const wxString& topic, const wxString& fileName); + bool OnExec(const wxString &topic, const wxString &fileName); }; class RMEProcessServer : public wxServer { @@ -36,11 +35,12 @@ class RMEProcessServer : public wxServer { RMEProcessServer(); ~RMEProcessServer(); - wxConnectionBase* OnAcceptConnection(const wxString& topic); + wxConnectionBase* OnAcceptConnection(const wxString &topic); }; class RMEProcessClient : public wxClient { wxConnectionBase* proc; + public: RMEProcessClient(); ~RMEProcessClient(); @@ -48,6 +48,6 @@ class RMEProcessClient : public wxClient { wxConnectionBase* OnMakeConnection(); }; -#endif + #endif #endif diff --git a/source/properties_window.cpp b/source/properties_window.cpp index ff0e395a..bc19743b 100644 --- a/source/properties_window.cpp +++ b/source/properties_window.cpp @@ -23,28 +23,26 @@ #include "complexitem.h" #include "container_properties_window.h" - BEGIN_EVENT_TABLE(PropertiesWindow, wxDialog) - EVT_BUTTON(wxID_OK, PropertiesWindow::OnClickOK) - EVT_BUTTON(wxID_CANCEL, PropertiesWindow::OnClickCancel) +EVT_BUTTON(wxID_OK, PropertiesWindow::OnClickOK) +EVT_BUTTON(wxID_CANCEL, PropertiesWindow::OnClickCancel) - EVT_BUTTON(ITEM_PROPERTIES_ADD_ATTRIBUTE, PropertiesWindow::OnClickAddAttribute) - EVT_BUTTON(ITEM_PROPERTIES_REMOVE_ATTRIBUTE, PropertiesWindow::OnClickRemoveAttribute) +EVT_BUTTON(ITEM_PROPERTIES_ADD_ATTRIBUTE, PropertiesWindow::OnClickAddAttribute) +EVT_BUTTON(ITEM_PROPERTIES_REMOVE_ATTRIBUTE, PropertiesWindow::OnClickRemoveAttribute) - EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, PropertiesWindow::OnNotebookPageChanged) +EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, PropertiesWindow::OnNotebookPageChanged) - EVT_GRID_CELL_CHANGED(PropertiesWindow::OnGridValueChanged) +EVT_GRID_CELL_CHANGED(PropertiesWindow::OnGridValueChanged) END_EVENT_TABLE() PropertiesWindow::PropertiesWindow(wxWindow* parent, const Map* map, const Tile* tile_parent, Item* item, wxPoint pos) : ObjectPropertiesWindowBase(parent, "Item Properties", map, tile_parent, item, pos), - currentPanel(nullptr) -{ + currentPanel(nullptr) { ASSERT(edit_item); notebook = newd wxNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(600, 300)); notebook->AddPage(createGeneralPanel(notebook), "Simple", true); - if(dynamic_cast(item)) { + if (dynamic_cast(item)) { notebook->AddPage(createContainerPanel(notebook), "Contents"); } notebook->AddPage(createAttributesPanel(notebook), "Advanced"); @@ -61,24 +59,21 @@ PropertiesWindow::PropertiesWindow(wxWindow* parent, const Map* map, const Tile* Centre(wxBOTH); } -PropertiesWindow::~PropertiesWindow() -{ +PropertiesWindow::~PropertiesWindow() { ; } -void PropertiesWindow::Update() -{ +void PropertiesWindow::Update() { Container* container = dynamic_cast(edit_item); - if(container) { - for(uint32_t i = 0; i < container->getVolume(); ++i) { + if (container) { + for (uint32_t i = 0; i < container->getVolume(); ++i) { container_items[i]->setItem(container->getItem(i)); } } wxDialog::Update(); } -wxWindow* PropertiesWindow::createGeneralPanel(wxWindow* parent) -{ +wxWindow* PropertiesWindow::createGeneralPanel(wxWindow* parent) { wxPanel* panel = newd wxPanel(parent, ITEM_PROPERTIES_GENERAL_TAB); wxFlexGridSizer* gridsizer = newd wxFlexGridSizer(2, 10, 10); gridsizer->AddGrowableCol(1); @@ -99,8 +94,7 @@ wxWindow* PropertiesWindow::createGeneralPanel(wxWindow* parent) return panel; } -wxWindow* PropertiesWindow::createContainerPanel(wxWindow* parent) -{ +wxWindow* PropertiesWindow::createContainerPanel(wxWindow* parent) { Container* container = (Container*)edit_item; wxPanel* panel = newd wxPanel(parent, ITEM_PROPERTIES_CONTAINER_TAB); wxSizer* topSizer = newd wxBoxSizer(wxVERTICAL); @@ -108,7 +102,7 @@ wxWindow* PropertiesWindow::createContainerPanel(wxWindow* parent) wxSizer* gridSizer = newd wxGridSizer(6, 5, 5); bool use_large_sprites = g_settings.getBoolean(Config::USE_LARGE_CONTAINER_ICONS); - for(uint32_t i = 0; i < container->getVolume(); ++i) { + for (uint32_t i = 0; i < container->getVolume(); ++i) { Item* item = container->getItem(i); ContainerItemButton* containerItemButton = newd ContainerItemButton(panel, use_large_sprites, i, edit_map, item); @@ -129,8 +123,7 @@ wxWindow* PropertiesWindow::createContainerPanel(wxWindow* parent) return panel; } -wxWindow* PropertiesWindow::createAttributesPanel(wxWindow* parent) -{ +wxWindow* PropertiesWindow::createAttributesPanel(wxWindow* parent) { wxPanel* panel = newd wxPanel(parent, wxID_ANY); wxSizer* topSizer = newd wxBoxSizer(wxVERTICAL); @@ -144,8 +137,8 @@ wxWindow* PropertiesWindow::createAttributesPanel(wxWindow* parent) attributesGrid->DisableDragColSize(); attributesGrid->SetSelectionMode(wxGrid::wxGridSelectRows); attributesGrid->SetRowLabelSize(0); - //log->SetColLabelSize(0); - //log->EnableGridLines(false); + // log->SetColLabelSize(0); + // log->EnableGridLines(false); attributesGrid->EnableEditing(true); attributesGrid->SetColLabelValue(0, "Key"); @@ -159,8 +152,9 @@ wxWindow* PropertiesWindow::createAttributesPanel(wxWindow* parent) ItemAttributeMap attrs = edit_item->getAttributes(); attributesGrid->AppendRows(attrs.size()); int i = 0; - for(ItemAttributeMap::iterator aiter = attrs.begin(); aiter != attrs.end(); ++aiter, ++i) + for (ItemAttributeMap::iterator aiter = attrs.begin(); aiter != attrs.end(); ++aiter, ++i) { SetGridValue(attributesGrid, i, aiter->first, aiter->second); + } wxSizer* optSizer = newd wxBoxSizer(wxHORIZONTAL); optSizer->Add(newd wxButton(panel, ITEM_PROPERTIES_ADD_ATTRIBUTE, "Add Attribute"), wxSizerFlags(0).Center()); @@ -172,8 +166,7 @@ wxWindow* PropertiesWindow::createAttributesPanel(wxWindow* parent) return panel; } -void PropertiesWindow::SetGridValue(wxGrid* grid, int rowIndex, std::string label, const ItemAttribute& attr) -{ +void PropertiesWindow::SetGridValue(wxGrid* grid, int rowIndex, std::string label, const ItemAttribute &attr) { wxArrayString types; types.Add("Number"); types.Add("Float"); @@ -221,8 +214,7 @@ void PropertiesWindow::SetGridValue(wxGrid* grid, int rowIndex, std::string labe grid->SetCellEditor(rowIndex, 1, new wxGridCellChoiceEditor(types)); } -void PropertiesWindow::OnResize(wxSizeEvent& evt) -{ +void PropertiesWindow::OnResize(wxSizeEvent &evt) { /* if(wxGrid* grid = (wxGrid*)currentPanel->FindWindowByName("AdvancedGrid")) { int tWidth = 0; @@ -236,19 +228,18 @@ void PropertiesWindow::OnResize(wxSizeEvent& evt) */ } -void PropertiesWindow::OnNotebookPageChanged(wxNotebookEvent& evt) -{ +void PropertiesWindow::OnNotebookPageChanged(wxNotebookEvent &evt) { wxWindow* page = notebook->GetCurrentPage(); // TODO: Save switch (page->GetId()) { case ITEM_PROPERTIES_GENERAL_TAB: { - //currentPanel = createGeneralPanel(page); + // currentPanel = createGeneralPanel(page); break; } case ITEM_PROPERTIES_ADVANCED_TAB: { - //currentPanel = createAttributesPanel(page); + // currentPanel = createAttributesPanel(page); break; } default: @@ -256,35 +247,32 @@ void PropertiesWindow::OnNotebookPageChanged(wxNotebookEvent& evt) } } -void PropertiesWindow::saveGeneralPanel() -{ +void PropertiesWindow::saveGeneralPanel() { //// } -void PropertiesWindow::saveContainerPanel() -{ +void PropertiesWindow::saveContainerPanel() { //// } -void PropertiesWindow::saveAttributesPanel() -{ +void PropertiesWindow::saveAttributesPanel() { edit_item->clearAllAttributes(); - for(int32_t rowIndex = 0; rowIndex < attributesGrid->GetNumberRows(); ++rowIndex) { + for (int32_t rowIndex = 0; rowIndex < attributesGrid->GetNumberRows(); ++rowIndex) { ItemAttribute attr; wxString type = attributesGrid->GetCellValue(rowIndex, 1); - if(type == "String") { + if (type == "String") { attr.set(nstr(attributesGrid->GetCellValue(rowIndex, 2))); - } else if(type == "Float") { + } else if (type == "Float") { double value; - if(attributesGrid->GetCellValue(rowIndex, 2).ToDouble(&value)) { + if (attributesGrid->GetCellValue(rowIndex, 2).ToDouble(&value)) { attr.set(value); } - } else if(type == "Number") { + } else if (type == "Number") { long value; - if(attributesGrid->GetCellValue(rowIndex, 2).ToLong(&value)) { + if (attributesGrid->GetCellValue(rowIndex, 2).ToLong(&value)) { attr.set(static_cast(value)); } - } else if(type == "Boolean") { + } else if (type == "Boolean") { attr.set(attributesGrid->GetCellValue(rowIndex, 2) == "1"); } else { continue; @@ -293,52 +281,48 @@ void PropertiesWindow::saveAttributesPanel() } } -void PropertiesWindow::OnGridValueChanged(wxGridEvent& event) -{ - if(event.GetCol() == 1) { +void PropertiesWindow::OnGridValueChanged(wxGridEvent &event) { + if (event.GetCol() == 1) { wxString newType = attributesGrid->GetCellValue(event.GetRow(), 1); - if(newType == event.GetString()) { + if (newType == event.GetString()) { return; } ItemAttribute attr; - if(newType == "String") { + if (newType == "String") { attr.set(""); - } else if(newType == "Float") { + } else if (newType == "Float") { attr.set(0.0f); - } else if(newType == "Number") { + } else if (newType == "Number") { attr.set(0); - } else if(newType == "Boolean") { + } else if (newType == "Boolean") { attr.set(false); } SetGridValue(attributesGrid, event.GetRow(), nstr(attributesGrid->GetCellValue(event.GetRow(), 0)), attr); } } -void PropertiesWindow::OnClickOK(wxCommandEvent&) -{ +void PropertiesWindow::OnClickOK(wxCommandEvent &) { saveAttributesPanel(); EndModal(1); } -void PropertiesWindow::OnClickAddAttribute(wxCommandEvent&) -{ +void PropertiesWindow::OnClickAddAttribute(wxCommandEvent &) { attributesGrid->AppendRows(1); ItemAttribute attr(0); SetGridValue(attributesGrid, attributesGrid->GetNumberRows() - 1, "", attr); } -void PropertiesWindow::OnClickRemoveAttribute(wxCommandEvent&) -{ +void PropertiesWindow::OnClickRemoveAttribute(wxCommandEvent &) { wxArrayInt rowIndexes = attributesGrid->GetSelectedRows(); - if(rowIndexes.Count() != 1) + if (rowIndexes.Count() != 1) { return; + } int rowIndex = rowIndexes[0]; attributesGrid->DeleteRows(rowIndex, 1); } -void PropertiesWindow::OnClickCancel(wxCommandEvent&) -{ +void PropertiesWindow::OnClickCancel(wxCommandEvent &) { EndModal(0); } diff --git a/source/properties_window.h b/source/properties_window.h index 76739ae5..7e278fec 100644 --- a/source/properties_window.h +++ b/source/properties_window.h @@ -26,20 +26,19 @@ class ContainerItemButton; class ContainerItemPopupMenu; class ItemAttribute; -class PropertiesWindow : public ObjectPropertiesWindowBase -{ +class PropertiesWindow : public ObjectPropertiesWindowBase { public: PropertiesWindow(wxWindow* parent, const Map* map, const Tile* tile, Item* item, wxPoint position = wxDefaultPosition); ~PropertiesWindow(); - void OnClickOK(wxCommandEvent&); - void OnClickCancel(wxCommandEvent&); - void OnClickAddAttribute(wxCommandEvent&); - void OnClickRemoveAttribute(wxCommandEvent&); + void OnClickOK(wxCommandEvent &); + void OnClickCancel(wxCommandEvent &); + void OnClickAddAttribute(wxCommandEvent &); + void OnClickRemoveAttribute(wxCommandEvent &); - void OnResize(wxSizeEvent&); - void OnNotebookPageChanged(wxNotebookEvent&); - void OnGridValueChanged(wxGridEvent&); + void OnResize(wxSizeEvent &); + void OnNotebookPageChanged(wxNotebookEvent &); + void OnGridValueChanged(wxGridEvent &); void Update(); @@ -55,9 +54,9 @@ class PropertiesWindow : public ObjectPropertiesWindowBase // Advanced pane wxGrid* attributesGrid; - wxWindow* createAttributesPanel(wxWindow *parent); + wxWindow* createAttributesPanel(wxWindow* parent); void saveAttributesPanel(); - void SetGridValue(wxGrid* grid, int rowIndex, std::string name, const ItemAttribute& attr); + void SetGridValue(wxGrid* grid, int rowIndex, std::string name, const ItemAttribute &attr); protected: wxNotebook* notebook; diff --git a/source/raw_brush.cpp b/source/raw_brush.cpp index 932efadf..efdb7a02 100644 --- a/source/raw_brush.cpp +++ b/source/raw_brush.cpp @@ -26,50 +26,47 @@ // RAW brush RAWBrush::RAWBrush(uint16_t itemid) : - Brush() -{ + Brush() { itemtype = g_items.getRawItemType(itemid); } -RAWBrush::~RAWBrush() -{ +RAWBrush::~RAWBrush() { //// } -int RAWBrush::getLookID() const -{ - if(itemtype) +int RAWBrush::getLookID() const { + if (itemtype) { return itemtype->clientID; + } return 0; } -uint16_t RAWBrush::getItemID() const -{ +uint16_t RAWBrush::getItemID() const { return itemtype->id; } -std::string RAWBrush::getName() const -{ - if(!itemtype) +std::string RAWBrush::getName() const { + if (!itemtype) { return "RAWBrush"; + } - if(itemtype->hookSouth) + if (itemtype->hookSouth) { return i2s(itemtype->id) + " - " + itemtype->name + " (Hook South)"; - else if(itemtype->hookEast) + } else if (itemtype->hookEast) { return i2s(itemtype->id) + " - " + itemtype->name + " (Hook East)"; + } return i2s(itemtype->id) + " - " + itemtype->name + itemtype->editorsuffix; } -void RAWBrush::undraw(BaseMap* map, Tile* tile) -{ - if(tile->ground && tile->ground->getID() == itemtype->id) { +void RAWBrush::undraw(BaseMap* map, Tile* tile) { + if (tile->ground && tile->ground->getID() == itemtype->id) { delete tile->ground; tile->ground = nullptr; } - for(ItemVector::iterator iter = tile->items.begin(); iter != tile->items.end();) { + for (ItemVector::iterator iter = tile->items.begin(); iter != tile->items.end();) { Item* item = *iter; - if(item->getID() == itemtype->id) { + if (item->getID() == itemtype->id) { delete item; iter = tile->items.erase(iter); } else { @@ -78,20 +75,21 @@ void RAWBrush::undraw(BaseMap* map, Tile* tile) } } -void RAWBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ - if(!itemtype) return; +void RAWBrush::draw(BaseMap* map, Tile* tile, void* parameter) { + if (!itemtype) { + return; + } - bool b = parameter? *reinterpret_cast(parameter) : false; - if((g_settings.getInteger(Config::RAW_LIKE_SIMONE) && !b) && itemtype->alwaysOnBottom && itemtype->alwaysOnTopOrder == 2) { - for(ItemVector::iterator iter = tile->items.begin(); iter != tile->items.end();) { + bool b = parameter ? *reinterpret_cast(parameter) : false; + if ((g_settings.getInteger(Config::RAW_LIKE_SIMONE) && !b) && itemtype->alwaysOnBottom && itemtype->alwaysOnTopOrder == 2) { + for (ItemVector::iterator iter = tile->items.begin(); iter != tile->items.end();) { Item* item = *iter; - if(item->getTopOrder() == itemtype->alwaysOnTopOrder) { + if (item->getTopOrder() == itemtype->alwaysOnTopOrder) { delete item; iter = tile->items.erase(iter); - } - else + } else { ++iter; + } } } tile->addItem(Item::Create(itemtype->id)); diff --git a/source/raw_brush.h b/source/raw_brush.h index 71f176f0..c070980a 100644 --- a/source/raw_brush.h +++ b/source/raw_brush.h @@ -23,23 +23,32 @@ //============================================================================= // RAWBrush, draw items like SimOne's editor -class RAWBrush : public Brush -{ +class RAWBrush : public Brush { public: RAWBrush(uint16_t itemid); // Create a RAWBrush of the specified type virtual ~RAWBrush(); - bool isRaw() const { return true; } - RAWBrush* asRaw() { return static_cast(this); } + bool isRaw() const { + return true; + } + RAWBrush* asRaw() { + return static_cast(this); + } - virtual bool canDraw(BaseMap* map, const Position& position) const { return true; } + virtual bool canDraw(BaseMap* map, const Position &position) const { + return true; + } virtual void draw(BaseMap* map, Tile* tile, void* parameter); virtual void undraw(BaseMap* map, Tile* tile); - virtual bool canDrag() const { return true; } + virtual bool canDrag() const { + return true; + } virtual int getLookID() const; virtual std::string getName() const; - ItemType* getItemType() const { return itemtype; } + ItemType* getItemType() const { + return itemtype; + } uint16_t getItemID() const; protected: diff --git a/source/replace_items_window.cpp b/source/replace_items_window.cpp index f1dfc9e0..0053fdab 100644 --- a/source/replace_items_window.cpp +++ b/source/replace_items_window.cpp @@ -28,31 +28,30 @@ ReplaceItemsButton::ReplaceItemsButton(wxWindow* parent) : DCButton(parent, wxID_ANY, wxDefaultPosition, DC_BTN_TOGGLE, RENDER_SIZE_32x32, 0), - m_id(0) -{ + m_id(0) { //// } -ItemGroup_t ReplaceItemsButton::GetGroup() const -{ - if(m_id != 0) { - const ItemType& it = g_items.getItemType(m_id); - if(it.id != 0) +ItemGroup_t ReplaceItemsButton::GetGroup() const { + if (m_id != 0) { + const ItemType &it = g_items.getItemType(m_id); + if (it.id != 0) { return it.group; + } } return ITEM_GROUP_NONE; } -void ReplaceItemsButton::SetItemId(uint16_t id) -{ - if(m_id == id) +void ReplaceItemsButton::SetItemId(uint16_t id) { + if (m_id == id) { return; + } m_id = id; - if(m_id != 0) { - const ItemType& it = g_items.getItemType(m_id); - if(it.id != 0) { + if (m_id != 0) { + const ItemType &it = g_items.getItemType(m_id); + if (it.id != 0) { SetSprite(it.clientID); return; } @@ -65,16 +64,15 @@ void ReplaceItemsButton::SetItemId(uint16_t id) // ReplaceItemsListBox ReplaceItemsListBox::ReplaceItemsListBox(wxWindow* parent) : - wxVListBox(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLB_SINGLE) -{ + wxVListBox(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLB_SINGLE) { m_arrow_bitmap = wxArtProvider::GetBitmap(ART_POSITION_GO, wxART_TOOLBAR, wxSize(16, 16)); m_flag_bitmap = wxArtProvider::GetBitmap(ART_PZ_BRUSH, wxART_TOOLBAR, wxSize(16, 16)); } -bool ReplaceItemsListBox::AddItem(const ReplacingItem& item) -{ - if(item.replaceId == 0 || item.withId == 0 || item.replaceId == item.withId) +bool ReplaceItemsListBox::AddItem(const ReplacingItem &item) { + if (item.replaceId == 0 || item.withId == 0 || item.replaceId == item.withId) { return false; + } SetItemCount(GetItemCount() + 1); m_items.push_back(item); @@ -83,53 +81,53 @@ bool ReplaceItemsListBox::AddItem(const ReplacingItem& item) return true; } -void ReplaceItemsListBox::MarkAsComplete(const ReplacingItem& item, uint32_t total) -{ +void ReplaceItemsListBox::MarkAsComplete(const ReplacingItem &item, uint32_t total) { auto it = std::find(m_items.begin(), m_items.end(), item); - if(it != m_items.end()) { + if (it != m_items.end()) { it->total = total; it->complete = true; Refresh(); } } -void ReplaceItemsListBox::RemoveSelected() -{ - if(m_items.empty()) +void ReplaceItemsListBox::RemoveSelected() { + if (m_items.empty()) { return; + } const int index = GetSelection(); - if(index == wxNOT_FOUND) + if (index == wxNOT_FOUND) { return; + } m_items.erase(m_items.begin() + index); SetItemCount(GetItemCount() - 1); Refresh(); } -bool ReplaceItemsListBox::CanAdd(uint16_t replaceId, uint16_t withId) const -{ - if(replaceId == 0 || withId == 0 || replaceId == withId) +bool ReplaceItemsListBox::CanAdd(uint16_t replaceId, uint16_t withId) const { + if (replaceId == 0 || withId == 0 || replaceId == withId) { return false; + } - for(const ReplacingItem& item : m_items) { - if(replaceId == item.replaceId) + for (const ReplacingItem &item : m_items) { + if (replaceId == item.replaceId) { return false; + } } return true; } -void ReplaceItemsListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t index) const -{ +void ReplaceItemsListBox::OnDrawItem(wxDC &dc, const wxRect &rect, size_t index) const { ASSERT(index < m_items.size()); - const ReplacingItem& item = m_items.at(index); - const ItemType& type1 = g_items.getItemType(item.replaceId); + const ReplacingItem &item = m_items.at(index); + const ItemType &type1 = g_items.getItemType(item.replaceId); Sprite* sprite1 = g_gui.gfx.getSprite(type1.clientID); - const ItemType& type2 = g_items.getItemType(item.withId); + const ItemType &type2 = g_items.getItemType(item.withId); Sprite* sprite2 = g_gui.gfx.getSprite(type2.clientID); - if(sprite1 && sprite2) { + if (sprite1 && sprite2) { int x = rect.GetX(); int y = rect.GetY(); sprite1->DrawTo(&dc, SPRITE_SIZE_32x32, x + 4, y + 4, rect.GetWidth(), rect.GetHeight()); @@ -137,25 +135,25 @@ void ReplaceItemsListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t index) sprite2->DrawTo(&dc, SPRITE_SIZE_32x32, x + 56, y + 4, rect.GetWidth(), rect.GetHeight()); dc.DrawText(wxString::Format("Replace: %d With: %d", item.replaceId, item.withId), x + 104, y + 10); - if(item.complete) { + if (item.complete) { x = rect.GetWidth() - 100; dc.DrawBitmap(m_flag_bitmap, x + 70, y + 10, true); dc.DrawText(wxString::Format("Total: %d", item.total), x, y + 10); } } - if(IsSelected(index)) { - if(HasFocus()) + if (IsSelected(index)) { + if (HasFocus()) { dc.SetTextForeground(wxColor(0xFF, 0xFF, 0xFF)); - else + } else { dc.SetTextForeground(wxColor(0x00, 0x00, 0xFF)); + } } else { dc.SetTextForeground(wxColor(0x00, 0x00, 0x00)); } } -wxCoord ReplaceItemsListBox::OnMeasureItem(size_t WXUNUSED(index)) const -{ +wxCoord ReplaceItemsListBox::OnMeasureItem(size_t WXUNUSED(index)) const { return 40; } @@ -163,10 +161,8 @@ wxCoord ReplaceItemsListBox::OnMeasureItem(size_t WXUNUSED(index)) const // ReplaceItemsDialog ReplaceItemsDialog::ReplaceItemsDialog(wxWindow* parent, bool selectionOnly) : - wxDialog(parent, wxID_ANY, (selectionOnly ? "Replace Items on Selection" : "Replace Items"), - wxDefaultPosition, wxSize(500, 480), wxDEFAULT_DIALOG_STYLE), - selectionOnly(selectionOnly) -{ + wxDialog(parent, wxID_ANY, (selectionOnly ? "Replace Items on Selection" : "Replace Items"), wxDefaultPosition, wxSize(500, 480), wxDEFAULT_DIALOG_STYLE), + selectionOnly(selectionOnly) { SetSizeHints(wxDefaultSize, wxDefaultSize); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); @@ -238,8 +234,7 @@ ReplaceItemsDialog::ReplaceItemsDialog(wxWindow* parent, bool selectionOnly) : close_button->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ReplaceItemsDialog::OnCancelButtonClicked), NULL, this); } -ReplaceItemsDialog::~ReplaceItemsDialog() -{ +ReplaceItemsDialog::~ReplaceItemsDialog() { // Disconnect Events list->Disconnect(wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler(ReplaceItemsDialog::OnListSelected), NULL, this); replace_button->Disconnect(wxEVT_LEFT_DOWN, wxMouseEventHandler(ReplaceItemsDialog::OnReplaceItemClicked), NULL, this); @@ -250,8 +245,7 @@ ReplaceItemsDialog::~ReplaceItemsDialog() close_button->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ReplaceItemsDialog::OnCancelButtonClicked), NULL, this); } -void ReplaceItemsDialog::UpdateWidgets() -{ +void ReplaceItemsDialog::UpdateWidgets() { const uint16_t replaceId = replace_button->GetItemId(); const uint16_t withId = with_button->GetItemId(); add_button->Enable(list->CanAdd(replaceId, withId)); @@ -259,17 +253,15 @@ void ReplaceItemsDialog::UpdateWidgets() execute_button->Enable(list->GetCount() != 0); } -void ReplaceItemsDialog::OnListSelected(wxCommandEvent& WXUNUSED(event)) -{ +void ReplaceItemsDialog::OnListSelected(wxCommandEvent &WXUNUSED(event)) { remove_button->Enable(list->GetCount() != 0 && list->GetSelection() != wxNOT_FOUND); } -void ReplaceItemsDialog::OnReplaceItemClicked(wxMouseEvent& WXUNUSED(event)) -{ +void ReplaceItemsDialog::OnReplaceItemClicked(wxMouseEvent &WXUNUSED(event)) { FindItemDialog dialog(this, "Replace Item"); - if(dialog.ShowModal() == wxID_OK) { + if (dialog.ShowModal() == wxID_OK) { uint16_t id = dialog.getResultID(); - if(id != with_button->GetItemId()) { + if (id != with_button->GetItemId()) { replace_button->SetItemId(id); UpdateWidgets(); } @@ -277,15 +269,15 @@ void ReplaceItemsDialog::OnReplaceItemClicked(wxMouseEvent& WXUNUSED(event)) dialog.Destroy(); } -void ReplaceItemsDialog::OnWithItemClicked(wxMouseEvent& WXUNUSED(event)) -{ - if(replace_button->GetItemId() == 0) +void ReplaceItemsDialog::OnWithItemClicked(wxMouseEvent &WXUNUSED(event)) { + if (replace_button->GetItemId() == 0) { return; + } FindItemDialog dialog(this, "With Item"); - if(dialog.ShowModal() == wxID_OK) { + if (dialog.ShowModal() == wxID_OK) { uint16_t id = dialog.getResultID(); - if(id != replace_button->GetItemId()) { + if (id != replace_button->GetItemId()) { with_button->SetItemId(id); UpdateWidgets(); } @@ -293,15 +285,14 @@ void ReplaceItemsDialog::OnWithItemClicked(wxMouseEvent& WXUNUSED(event)) dialog.Destroy(); } -void ReplaceItemsDialog::OnAddButtonClicked(wxCommandEvent& WXUNUSED(event)) -{ +void ReplaceItemsDialog::OnAddButtonClicked(wxCommandEvent &WXUNUSED(event)) { const uint16_t replaceId = replace_button->GetItemId(); const uint16_t withId = with_button->GetItemId(); - if(list->CanAdd(replaceId, withId)) { + if (list->CanAdd(replaceId, withId)) { ReplacingItem item; item.replaceId = replaceId; item.withId = withId; - if(list->AddItem(item)) { + if (list->AddItem(item)) { replace_button->SetItemId(0); with_button->SetItemId(0); UpdateWidgets(); @@ -309,20 +300,20 @@ void ReplaceItemsDialog::OnAddButtonClicked(wxCommandEvent& WXUNUSED(event)) } } -void ReplaceItemsDialog::OnRemoveButtonClicked(wxCommandEvent& WXUNUSED(event)) -{ +void ReplaceItemsDialog::OnRemoveButtonClicked(wxCommandEvent &WXUNUSED(event)) { list->RemoveSelected(); UpdateWidgets(); } -void ReplaceItemsDialog::OnExecuteButtonClicked(wxCommandEvent& WXUNUSED(event)) -{ - if(!g_gui.IsEditorOpen()) +void ReplaceItemsDialog::OnExecuteButtonClicked(wxCommandEvent &WXUNUSED(event)) { + if (!g_gui.IsEditorOpen()) { return; + } - const auto& items = list->GetItems(); - if(items.empty()) + const auto &items = list->GetItems(); + if (items.empty()) { return; + } replace_button->Enable(false); with_button->Enable(false); @@ -333,25 +324,26 @@ void ReplaceItemsDialog::OnExecuteButtonClicked(wxCommandEvent& WXUNUSED(event)) progress->SetValue(0); MapTab* tab = dynamic_cast(GetParent()); - if(!tab) + if (!tab) { return; + } Editor* editor = tab->GetEditor(); int done = 0; - for(const ReplacingItem& info : items) { + for (const ReplacingItem &info : items) { ItemFinder finder(info.replaceId, (uint32_t)g_settings.getInteger(Config::REPLACE_SIZE)); // search on map foreach_ItemOnMap(editor->getMap(), finder, selectionOnly); uint32_t total = 0; - const auto& result = finder.result; + const auto &result = finder.result; - if(!result.empty()) { + if (!result.empty()) { BatchAction* batch = editor->createBatch(ACTION_REPLACE_ITEMS); Action* action = editor->createAction(batch); - for(const auto& pair : result) { + for (const auto &pair : result) { Tile* new_tile = pair.first->deepCopy(editor->getMap()); int index = pair.first->getIndexOf(pair.second); ASSERT(index != wxNOT_FOUND); @@ -379,7 +371,6 @@ void ReplaceItemsDialog::OnExecuteButtonClicked(wxCommandEvent& WXUNUSED(event)) UpdateWidgets(); } -void ReplaceItemsDialog::OnCancelButtonClicked(wxCommandEvent& WXUNUSED(event)) -{ +void ReplaceItemsDialog::OnCancelButtonClicked(wxCommandEvent &WXUNUSED(event)) { Close(); } diff --git a/source/replace_items_window.h b/source/replace_items_window.h index 4b7238f2..bff2988c 100644 --- a/source/replace_items_window.h +++ b/source/replace_items_window.h @@ -22,13 +22,11 @@ #include "common_windows.h" #include "editor.h" -struct ReplacingItem -{ +struct ReplacingItem { ReplacingItem() : replaceId(0), withId(0), total(0), complete(false) { } - bool operator==(const ReplacingItem& other) const - { + bool operator==(const ReplacingItem &other) const { return replaceId == other.replaceId && withId == other.withId; } @@ -41,14 +39,15 @@ struct ReplacingItem // ============================================================================ // ReplaceItemsButton -class ReplaceItemsButton : public DCButton -{ +class ReplaceItemsButton : public DCButton { public: ReplaceItemsButton(wxWindow* parent); ~ReplaceItemsButton() { } ItemGroup_t GetGroup() const; - uint16_t GetItemId() const { return m_id; } + uint16_t GetItemId() const { + return m_id; + } void SetItemId(uint16_t id); private: @@ -58,21 +57,24 @@ class ReplaceItemsButton : public DCButton // ============================================================================ // ReplaceItemsListBox -class ReplaceItemsListBox : public wxVListBox -{ +class ReplaceItemsListBox : public wxVListBox { public: ReplaceItemsListBox(wxWindow* parent); - bool AddItem(const ReplacingItem& item); - void MarkAsComplete(const ReplacingItem& item, uint32_t total); + bool AddItem(const ReplacingItem &item); + void MarkAsComplete(const ReplacingItem &item, uint32_t total); void RemoveSelected(); bool CanAdd(uint16_t replaceId, uint16_t withId) const; - void OnDrawItem(wxDC& dc, const wxRect& rect, size_t index) const; + void OnDrawItem(wxDC &dc, const wxRect &rect, size_t index) const; wxCoord OnMeasureItem(size_t index) const; - const std::vector& GetItems() const { return m_items; } - size_t GetCount() const { return m_items.size(); } + const std::vector &GetItems() const { + return m_items; + } + size_t GetCount() const { + return m_items.size(); + } private: std::vector m_items; @@ -83,18 +85,20 @@ class ReplaceItemsListBox : public wxVListBox // ============================================================================ // ReplaceItemsDialog -struct ItemFinder -{ - ItemFinder(uint16_t itemid, int32_t limit = -1) : itemid(itemid), limit(limit), exceeded(false) {} +struct ItemFinder { + ItemFinder(uint16_t itemid, int32_t limit = -1) : + itemid(itemid), limit(limit), exceeded(false) { } - void operator()(Map& map, Tile* tile, Item* item, long long done) { - if(exceeded) + void operator()(Map &map, Tile* tile, Item* item, long long done) { + if (exceeded) { return; + } - if(item->getID() == itemid) { + if (item->getID() == itemid) { result.push_back(std::make_pair(tile, item)); - if(limit > 0 && result.size() >= size_t(limit)) + if (limit > 0 && result.size() >= size_t(limit)) { exceeded = true; + } } } @@ -106,19 +110,18 @@ struct ItemFinder bool exceeded; }; -class ReplaceItemsDialog : public wxDialog -{ +class ReplaceItemsDialog : public wxDialog { public: ReplaceItemsDialog(wxWindow* parent, bool selectionOnly); ~ReplaceItemsDialog(); - void OnListSelected(wxCommandEvent& event); - void OnReplaceItemClicked(wxMouseEvent& event); - void OnWithItemClicked(wxMouseEvent& event); - void OnAddButtonClicked(wxCommandEvent& event); - void OnRemoveButtonClicked(wxCommandEvent& event); - void OnExecuteButtonClicked(wxCommandEvent& event); - void OnCancelButtonClicked(wxCommandEvent& event); + void OnListSelected(wxCommandEvent &event); + void OnReplaceItemClicked(wxMouseEvent &event); + void OnWithItemClicked(wxMouseEvent &event); + void OnAddButtonClicked(wxCommandEvent &event); + void OnRemoveButtonClicked(wxCommandEvent &event); + void OnExecuteButtonClicked(wxCommandEvent &event); + void OnCancelButtonClicked(wxCommandEvent &event); private: void UpdateWidgets(); diff --git a/source/result_window.cpp b/source/result_window.cpp index f3a663d4..eec9492c 100644 --- a/source/result_window.cpp +++ b/source/result_window.cpp @@ -22,14 +22,13 @@ #include "position.h" BEGIN_EVENT_TABLE(SearchResultWindow, wxPanel) - EVT_LISTBOX(wxID_ANY, SearchResultWindow::OnClickResult) - EVT_BUTTON(wxID_FILE, SearchResultWindow::OnClickExport) - EVT_BUTTON(wxID_CLEAR, SearchResultWindow::OnClickClear) +EVT_LISTBOX(wxID_ANY, SearchResultWindow::OnClickResult) +EVT_BUTTON(wxID_FILE, SearchResultWindow::OnClickExport) +EVT_BUTTON(wxID_CLEAR, SearchResultWindow::OnClickClear) END_EVENT_TABLE() SearchResultWindow::SearchResultWindow(wxWindow* parent) : - wxPanel(parent, wxID_ANY) -{ + wxPanel(parent, wxID_ANY) { wxSizer* sizer = newd wxBoxSizer(wxVERTICAL); result_list = newd wxListBox(this, wxID_ANY, wxDefaultPosition, wxSize(200, 330), 0, nullptr, wxLB_SINGLE | wxLB_ALWAYS_SB); sizer->Add(result_list, wxSizerFlags(1).Expand()); @@ -41,45 +40,40 @@ SearchResultWindow::SearchResultWindow(wxWindow* parent) : SetSizerAndFit(sizer); } -SearchResultWindow::~SearchResultWindow() -{ +SearchResultWindow::~SearchResultWindow() { Clear(); } -void SearchResultWindow::Clear() -{ - for(uint32_t n = 0; n < result_list->GetCount(); ++n) { +void SearchResultWindow::Clear() { + for (uint32_t n = 0; n < result_list->GetCount(); ++n) { delete reinterpret_cast(result_list->GetClientData(n)); } result_list->Clear(); } -void SearchResultWindow::AddPosition(wxString description, Position pos) -{ +void SearchResultWindow::AddPosition(wxString description, Position pos) { result_list->Append(description << " (" << pos.x << "," << pos.y << "," << pos.z << ")", newd Position(pos)); } -void SearchResultWindow::OnClickResult(wxCommandEvent& event) -{ +void SearchResultWindow::OnClickResult(wxCommandEvent &event) { Position* pos = reinterpret_cast(event.GetClientData()); - if(pos) { + if (pos) { g_gui.SetScreenCenterPosition(*pos); } } -void SearchResultWindow::OnClickExport(wxCommandEvent& WXUNUSED(event)) -{ +void SearchResultWindow::OnClickExport(wxCommandEvent &WXUNUSED(event)) { wxFileDialog dialog(this, "Save file...", "", "", "Text Documents (*.txt) | *.txt", wxFD_SAVE); - if(dialog.ShowModal() == wxID_OK) { + if (dialog.ShowModal() == wxID_OK) { wxFile file(dialog.GetPath(), wxFile::write); - if(file.IsOpened()) { + if (file.IsOpened()) { g_gui.CreateLoadBar("Exporting search result..."); file.Write("Generated by Remere's Map Editor " + __RME_VERSION__); file.Write("\n=============================================\n\n"); wxArrayString lines = result_list->GetStrings(); size_t count = lines.Count(); - for(size_t i = 0; i < count; ++i) { + for (size_t i = 0; i < count; ++i) { file.Write(lines[i] + "\n"); g_gui.SetLoadScale((int32_t)i, (int32_t)count); } @@ -90,7 +84,6 @@ void SearchResultWindow::OnClickExport(wxCommandEvent& WXUNUSED(event)) } } -void SearchResultWindow::OnClickClear(wxCommandEvent& WXUNUSED(event)) -{ +void SearchResultWindow::OnClickClear(wxCommandEvent &WXUNUSED(event)) { Clear(); } diff --git a/source/result_window.h b/source/result_window.h index e43194bf..c5ce678c 100644 --- a/source/result_window.h +++ b/source/result_window.h @@ -20,8 +20,7 @@ #include "main.h" -class SearchResultWindow : public wxPanel -{ +class SearchResultWindow : public wxPanel { public: SearchResultWindow(wxWindow* parent); virtual ~SearchResultWindow(); @@ -29,9 +28,9 @@ class SearchResultWindow : public wxPanel void Clear(); void AddPosition(wxString description, Position pos); - void OnClickResult(wxCommandEvent&); - void OnClickExport(wxCommandEvent&); - void OnClickClear(wxCommandEvent&); + void OnClickResult(wxCommandEvent &); + void OnClickExport(wxCommandEvent &); + void OnClickClear(wxCommandEvent &); protected: wxListBox* result_list; diff --git a/source/rme_net.cpp b/source/rme_net.cpp index 5dd415f0..aee5e326 100644 --- a/source/rme_net.cpp +++ b/source/rme_net.cpp @@ -19,7 +19,7 @@ #if 0 -#include "rmenet.h" + #include "rmenet.h" const wxEventType EVT_RMENET_CONNECTION_ESTABLISHED = wxNewEventType(); const wxEventType EVT_RMENET_CONNECTION_LOST = wxNewEventType(); diff --git a/source/rme_net.h b/source/rme_net.h index ca23cbe1..a3dae7ef 100644 --- a/source/rme_net.h +++ b/source/rme_net.h @@ -17,10 +17,10 @@ #if 0 -#ifndef _RME_NET_H_ -#define _RME_NET_H_ + #ifndef _RME_NET_H_ + #define _RME_NET_H_ -#include "net_connection.h" + #include "net_connection.h" class RMENet : public wxEvtHandler, public NetSocket { @@ -55,31 +55,31 @@ class RMENet : public wxEvtHandler, public NetSocket extern const wxEventType EVT_RMENET_CONNECTION_ESTABLISHED; -#define EVT_RMENET_CONNECTION_ESTABLISHED(id, fn) \ - DECLARE_EVENT_TABLE_ENTRY( \ - EVT_RMENET_CONNECTION_ESTABLISHED, id, wxID_ANY, \ - (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, &fn ), \ - (wxObject *) nullptr \ - ), + #define EVT_RMENET_CONNECTION_ESTABLISHED(id, fn) \ + DECLARE_EVENT_TABLE_ENTRY( \ + EVT_RMENET_CONNECTION_ESTABLISHED, id, wxID_ANY, \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCommandEventFunction, &fn), \ + (wxObject*)nullptr \ + ), extern const wxEventType EVT_RMENET_CONNECTION_LOST; -#define EVT_RMENET_CONNECTION_LOST(id, fn) \ - DECLARE_EVENT_TABLE_ENTRY( \ - EVT_RMENET_CONNECTION_LOST, id, wxID_ANY, \ - (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, &fn ), \ - (wxObject *) nullptr \ - ), + #define EVT_RMENET_CONNECTION_LOST(id, fn) \ + DECLARE_EVENT_TABLE_ENTRY( \ + EVT_RMENET_CONNECTION_LOST, id, wxID_ANY, \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCommandEventFunction, &fn), \ + (wxObject*)nullptr \ + ), extern const wxEventType EVT_RMENET_SHOW_SERVLIST; -#define EVT_RMENET_SHOW_SERVLIST(id, fn) \ - DECLARE_EVENT_TABLE_ENTRY( \ - EVT_RMENET_SHOW_SERVLIST, id, wxID_ANY, \ - (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, &fn ), \ - (wxObject *) nullptr \ - ), + #define EVT_RMENET_SHOW_SERVLIST(id, fn) \ + DECLARE_EVENT_TABLE_ENTRY( \ + EVT_RMENET_SHOW_SERVLIST, id, wxID_ANY, \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCommandEventFunction, &fn), \ + (wxObject*)nullptr \ + ), -#endif + #endif #endif diff --git a/source/selection.cpp b/source/selection.cpp index 6661d1d9..0ad18993 100644 --- a/source/selection.cpp +++ b/source/selection.cpp @@ -25,83 +25,92 @@ #include "editor.h" #include "gui.h" -Selection::Selection(Editor& editor) : +Selection::Selection(Editor &editor) : editor(editor), session(nullptr), subsession(nullptr), - busy(false) -{ + busy(false) { //// } -Selection::~Selection() -{ +Selection::~Selection() { tiles.clear(); delete subsession; delete session; } -Position Selection::minPosition() const -{ +Position Selection::minPosition() const { Position min_pos(0x10000, 0x10000, 0x10); - for(const Tile* tile : tiles) { - if(!tile) continue; - const Position& tile_pos = tile->getPosition(); - if(min_pos.x > tile_pos.x) + for (const Tile* tile : tiles) { + if (!tile) { + continue; + } + const Position &tile_pos = tile->getPosition(); + if (min_pos.x > tile_pos.x) { min_pos.x = tile_pos.x; - if(min_pos.y > tile_pos.y) + } + if (min_pos.y > tile_pos.y) { min_pos.y = tile_pos.y; - if(min_pos.z > tile_pos.z) + } + if (min_pos.z > tile_pos.z) { min_pos.z = tile_pos.z; + } } return min_pos; } -Position Selection::maxPosition() const -{ +Position Selection::maxPosition() const { Position max_pos; - for(const Tile* tile : tiles) { - if(!tile) continue; - const Position& tile_pos = tile->getPosition(); - if(max_pos.x < tile_pos.x) + for (const Tile* tile : tiles) { + if (!tile) { + continue; + } + const Position &tile_pos = tile->getPosition(); + if (max_pos.x < tile_pos.x) { max_pos.x = tile_pos.x; - if(max_pos.y < tile_pos.y) + } + if (max_pos.y < tile_pos.y) { max_pos.y = tile_pos.y; - if(max_pos.z < tile_pos.z) + } + if (max_pos.z < tile_pos.z) { max_pos.z = tile_pos.z; + } } return max_pos; } -void Selection::add(const Tile* tile, Item* item) -{ +void Selection::add(const Tile* tile, Item* item) { ASSERT(subsession); ASSERT(tile); ASSERT(item); - if(item->isSelected()) return; + if (item->isSelected()) { + return; + } // Make a copy of the tile with the item selected item->select(); Tile* new_tile = tile->deepCopy(editor.getMap()); item->deselect(); - if(g_settings.getInteger(Config::BORDER_IS_GROUND)) { - if(item->isBorder()) + if (g_settings.getInteger(Config::BORDER_IS_GROUND)) { + if (item->isBorder()) { new_tile->selectGround(); + } } subsession->addChange(newd Change(new_tile)); } -void Selection::add(const Tile* tile, SpawnMonster* spawnMonster) -{ +void Selection::add(const Tile* tile, SpawnMonster* spawnMonster) { ASSERT(subsession); ASSERT(tile); ASSERT(spawnMonster); - if(spawnMonster->isSelected()) return; + if (spawnMonster->isSelected()) { + return; + } // Make a copy of the tile with the item selected spawnMonster->select(); @@ -111,13 +120,14 @@ void Selection::add(const Tile* tile, SpawnMonster* spawnMonster) subsession->addChange(newd Change(new_tile)); } -void Selection::add(const Tile* tile, SpawnNpc* spawnNpc) -{ +void Selection::add(const Tile* tile, SpawnNpc* spawnNpc) { ASSERT(subsession); ASSERT(tile); ASSERT(spawnNpc); - if(spawnNpc->isSelected()) return; + if (spawnNpc->isSelected()) { + return; + } // Make a copy of the tile with the item selected spawnNpc->select(); @@ -127,13 +137,14 @@ void Selection::add(const Tile* tile, SpawnNpc* spawnNpc) subsession->addChange(newd Change(new_tile)); } -void Selection::add(const Tile* tile, Monster* monster) -{ +void Selection::add(const Tile* tile, Monster* monster) { ASSERT(subsession); ASSERT(tile); ASSERT(monster); - if(monster->isSelected()) return; + if (monster->isSelected()) { + return; + } // Make a copy of the tile with the item selected monster->select(); @@ -143,13 +154,14 @@ void Selection::add(const Tile* tile, Monster* monster) subsession->addChange(newd Change(new_tile)); } -void Selection::add(const Tile* tile, Npc* npc) -{ +void Selection::add(const Tile* tile, Npc* npc) { ASSERT(subsession); ASSERT(tile); ASSERT(npc); - if(npc->isSelected()) return; + if (npc->isSelected()) { + return; + } // Make a copy of the tile with the item selected npc->select(); @@ -159,8 +171,7 @@ void Selection::add(const Tile* tile, Npc* npc) subsession->addChange(newd Change(new_tile)); } -void Selection::add(const Tile* tile) -{ +void Selection::add(const Tile* tile) { ASSERT(subsession); ASSERT(tile); @@ -170,8 +181,7 @@ void Selection::add(const Tile* tile) subsession->addChange(newd Change(new_tile)); } -void Selection::remove(Tile* tile, Item* item) -{ +void Selection::remove(Tile* tile, Item* item) { ASSERT(subsession); ASSERT(tile); ASSERT(item); @@ -179,14 +189,17 @@ void Selection::remove(Tile* tile, Item* item) bool selected = item->isSelected(); item->deselect(); Tile* new_tile = tile->deepCopy(editor.getMap()); - if(selected) item->select(); - if(item->isBorder() && g_settings.getInteger(Config::BORDER_IS_GROUND)) new_tile->deselectGround(); + if (selected) { + item->select(); + } + if (item->isBorder() && g_settings.getInteger(Config::BORDER_IS_GROUND)) { + new_tile->deselectGround(); + } subsession->addChange(newd Change(new_tile)); } -void Selection::remove(Tile* tile, SpawnMonster* spawnMonster) -{ +void Selection::remove(Tile* tile, SpawnMonster* spawnMonster) { ASSERT(subsession); ASSERT(tile); ASSERT(spawnMonster); @@ -194,13 +207,14 @@ void Selection::remove(Tile* tile, SpawnMonster* spawnMonster) bool selected = spawnMonster->isSelected(); spawnMonster->deselect(); Tile* new_tile = tile->deepCopy(editor.getMap()); - if(selected) spawnMonster->select(); + if (selected) { + spawnMonster->select(); + } subsession->addChange(newd Change(new_tile)); } -void Selection::remove(Tile* tile, SpawnNpc* spawnNpc) -{ +void Selection::remove(Tile* tile, SpawnNpc* spawnNpc) { ASSERT(subsession); ASSERT(tile); ASSERT(spawnNpc); @@ -208,13 +222,14 @@ void Selection::remove(Tile* tile, SpawnNpc* spawnNpc) bool selected = spawnNpc->isSelected(); spawnNpc->deselect(); Tile* new_tile = tile->deepCopy(editor.getMap()); - if(selected) spawnNpc->select(); + if (selected) { + spawnNpc->select(); + } subsession->addChange(newd Change(new_tile)); } -void Selection::remove(Tile* tile, Monster* monster) -{ +void Selection::remove(Tile* tile, Monster* monster) { ASSERT(subsession); ASSERT(tile); ASSERT(monster); @@ -222,13 +237,14 @@ void Selection::remove(Tile* tile, Monster* monster) bool selected = monster->isSelected(); monster->deselect(); Tile* new_tile = tile->deepCopy(editor.getMap()); - if(selected) monster->select(); + if (selected) { + monster->select(); + } subsession->addChange(newd Change(new_tile)); } -void Selection::remove(Tile* tile, Npc* npc) -{ +void Selection::remove(Tile* tile, Npc* npc) { ASSERT(subsession); ASSERT(tile); ASSERT(npc); @@ -236,13 +252,14 @@ void Selection::remove(Tile* tile, Npc* npc) bool selected = npc->isSelected(); npc->deselect(); Tile* new_tile = tile->deepCopy(editor.getMap()); - if(selected) npc->select(); + if (selected) { + npc->select(); + } subsession->addChange(newd Change(new_tile)); } -void Selection::remove(Tile* tile) -{ +void Selection::remove(Tile* tile) { ASSERT(subsession); Tile* new_tile = tile->deepCopy(editor.getMap()); @@ -251,39 +268,35 @@ void Selection::remove(Tile* tile) subsession->addChange(newd Change(new_tile)); } -void Selection::addInternal(Tile* tile) -{ +void Selection::addInternal(Tile* tile) { ASSERT(tile); tiles.insert(tile); } -void Selection::removeInternal(Tile* tile) -{ +void Selection::removeInternal(Tile* tile) { ASSERT(tile); tiles.erase(tile); } -void Selection::clear() -{ - if(session) { - for(Tile* tile : tiles) { +void Selection::clear() { + if (session) { + for (Tile* tile : tiles) { Tile* new_tile = tile->deepCopy(editor.getMap()); new_tile->deselect(); subsession->addChange(newd Change(new_tile)); } } else { - for(Tile* tile : tiles) { + for (Tile* tile : tiles) { tile->deselect(); } tiles.clear(); } } -void Selection::start(SessionFlags flags, ActionIdentifier identifier) -{ - if(!(flags & INTERNAL)) { - if(!(flags & SUBTHREAD)) { +void Selection::start(SessionFlags flags, ActionIdentifier identifier) { + if (!(flags & INTERNAL)) { + if (!(flags & SUBTHREAD)) { session = editor.createBatch(identifier); } subsession = editor.createAction(identifier); @@ -291,9 +304,8 @@ void Selection::start(SessionFlags flags, ActionIdentifier identifier) busy = true; } -void Selection::commit() -{ - if(session) { +void Selection::commit() { + if (session) { ASSERT(subsession); // We need to step out of the session before we do the action, else peril awaits us! BatchAction* batch = session; @@ -308,10 +320,9 @@ void Selection::commit() } } -void Selection::finish(SessionFlags flags) -{ - if(!(flags & INTERNAL)) { - if(flags & SUBTHREAD) { +void Selection::finish(SessionFlags flags) { + if (!(flags & INTERNAL)) { + if (flags & SUBTHREAD) { ASSERT(subsession); subsession = nullptr; } else { @@ -332,11 +343,10 @@ void Selection::finish(SessionFlags flags) busy = false; } -void Selection::updateSelectionCount() -{ - if(size() > 0) { +void Selection::updateSelectionCount() { + if (size() > 0) { wxString ss; - if(size() == 1) { + if (size() == 1) { ss << "One tile selected."; } else { ss << size() << " tiles selected."; @@ -345,8 +355,7 @@ void Selection::updateSelectionCount() } } -void Selection::join(SelectionThread* thread) -{ +void Selection::join(SelectionThread* thread) { thread->Wait(); ASSERT(session); @@ -356,40 +365,40 @@ void Selection::join(SelectionThread* thread) delete thread; } -SelectionThread::SelectionThread(Editor& editor, Position start, Position end) : +SelectionThread::SelectionThread(Editor &editor, Position start, Position end) : wxThread(wxTHREAD_JOINABLE), editor(editor), start(start), end(end), selection(editor), - result(nullptr) -{ + result(nullptr) { //// } -void SelectionThread::Execute() -{ +void SelectionThread::Execute() { Create(); Run(); } -wxThread::ExitCode SelectionThread::Entry() -{ +wxThread::ExitCode SelectionThread::Entry() { selection.start(Selection::SUBTHREAD); bool compesated = g_settings.getInteger(Config::COMPENSATED_SELECT); - for(int z = start.z; z >= end.z; --z) { - for(int x = start.x; x <= end.x; ++x) { - for(int y = start.y; y <= end.y; ++y) { + for (int z = start.z; z >= end.z; --z) { + for (int x = start.x; x <= end.x; ++x) { + for (int y = start.y; y <= end.y; ++y) { Tile* tile = editor.getMap().getTile(x, y, z); - if(!tile) + if (!tile) { continue; + } selection.add(tile); } } - if(compesated && z <= rme::MapGroundLayer) { - ++start.x; ++start.y; - ++end.x; ++end.y; + if (compesated && z <= rme::MapGroundLayer) { + ++start.x; + ++start.y; + ++end.x; + ++end.y; } } result = selection.subsession; diff --git a/source/selection.h b/source/selection.h index f19cde86..1f15d926 100644 --- a/source/selection.h +++ b/source/selection.h @@ -28,10 +28,9 @@ class BatchAction; class SelectionThread; -class Selection -{ +class Selection { public: - Selection(Editor& editor); + Selection(Editor &editor); ~Selection(); // Selects the items on the tile/tiles @@ -57,7 +56,9 @@ class Selection void clear(); // Returns true when inside a session - bool isBusy() const noexcept { return busy; } + bool isBusy() const noexcept { + return busy; + } // Position minPosition() const; @@ -82,16 +83,29 @@ class Selection // This deletes the thread void join(SelectionThread* thread); - size_t size() const noexcept { return tiles.size(); } - bool empty() const noexcept { return tiles.empty(); } + size_t size() const noexcept { + return tiles.size(); + } + bool empty() const noexcept { + return tiles.empty(); + } void updateSelectionCount(); - TileSet::iterator begin() noexcept { return tiles.begin(); } - TileSet::iterator end() noexcept { return tiles.end(); } - const TileSet& getTiles() const noexcept { return tiles; } - Tile* getSelectedTile() { ASSERT(size() == 1); return *tiles.begin(); } + TileSet::iterator begin() noexcept { + return tiles.begin(); + } + TileSet::iterator end() noexcept { + return tiles.end(); + } + const TileSet &getTiles() const noexcept { + return tiles; + } + Tile* getSelectedTile() { + ASSERT(size() == 1); + return *tiles.begin(); + } private: - Editor& editor; + Editor &editor; BatchAction* session; Action* subsession; TileSet tiles; @@ -100,16 +114,15 @@ class Selection friend class SelectionThread; }; -class SelectionThread : public wxThread -{ +class SelectionThread : public wxThread { public: - SelectionThread(Editor& editor, Position start, Position end); + SelectionThread(Editor &editor, Position start, Position end); void Execute(); // Calls "Create" and then "Run" protected: virtual ExitCode Entry(); - Editor& editor; + Editor &editor; Position start, end; Selection selection; Action* result; diff --git a/source/settings.cpp b/source/settings.cpp index 858aedde..839add4d 100644 --- a/source/settings.cpp +++ b/source/settings.cpp @@ -23,164 +23,175 @@ Settings g_settings; -Settings::Settings() : store(Config::LAST) +Settings::Settings() : + store(Config::LAST) #ifdef __WINDOWS__ - , use_file_cfg(false) + , + use_file_cfg(false) #endif { setDefaults(); } -Settings::~Settings() -{ +Settings::~Settings() { //// } -wxConfigBase& Settings::getConfigObject() -{ +wxConfigBase &Settings::getConfigObject() { return *dynamic_cast(wxConfig::Get()); } -bool Settings::getBoolean(uint32_t key) const -{ - if(key > Config::LAST) { +bool Settings::getBoolean(uint32_t key) const { + if (key > Config::LAST) { return false; } - const DynamicValue& dv = store[key]; - if(dv.type == TYPE_INT) { + const DynamicValue &dv = store[key]; + if (dv.type == TYPE_INT) { return dv.intval != 0; } return false; } -int Settings::getInteger(uint32_t key) const -{ - if(key > Config::LAST) return 0; - const DynamicValue& dv = store[key]; - if(dv.type == TYPE_INT) +int Settings::getInteger(uint32_t key) const { + if (key > Config::LAST) { + return 0; + } + const DynamicValue &dv = store[key]; + if (dv.type == TYPE_INT) { return dv.intval; + } return 0; } -float Settings::getFloat(uint32_t key) const -{ - if(key > Config::LAST) return 0.0; - const DynamicValue& dv = store[key]; - if(dv.type == TYPE_FLOAT) { +float Settings::getFloat(uint32_t key) const { + if (key > Config::LAST) { + return 0.0; + } + const DynamicValue &dv = store[key]; + if (dv.type == TYPE_FLOAT) { return dv.floatval; } return 0.0; } -std::string Settings::getString(uint32_t key) const -{ - if(key > Config::LAST) return ""; - const DynamicValue& dv = store[key]; - if(dv.type == TYPE_STR && dv.strval != nullptr) +std::string Settings::getString(uint32_t key) const { + if (key > Config::LAST) { + return ""; + } + const DynamicValue &dv = store[key]; + if (dv.type == TYPE_STR && dv.strval != nullptr) { return *dv.strval; + } return ""; } -void Settings::setInteger(uint32_t key, int newval) -{ - if(key > Config::LAST) return; - DynamicValue& dv = store[key]; - if(dv.type == TYPE_INT) { +void Settings::setInteger(uint32_t key, int newval) { + if (key > Config::LAST) { + return; + } + DynamicValue &dv = store[key]; + if (dv.type == TYPE_INT) { dv.intval = newval; - } else if(dv.type == TYPE_NONE) { + } else if (dv.type == TYPE_NONE) { dv.type = TYPE_INT; dv.intval = newval; } } -void Settings::setFloat(uint32_t key, float newval) -{ - if(key > Config::LAST) return; - DynamicValue& dv = store[key]; - if(dv.type == TYPE_FLOAT) { +void Settings::setFloat(uint32_t key, float newval) { + if (key > Config::LAST) { + return; + } + DynamicValue &dv = store[key]; + if (dv.type == TYPE_FLOAT) { dv.floatval = newval; - } else if(dv.type == TYPE_NONE) { + } else if (dv.type == TYPE_NONE) { dv.type = TYPE_FLOAT; dv.floatval = newval; } } -void Settings::setString(uint32_t key, std::string newval) -{ - if(key > Config::LAST) return; - DynamicValue& dv = store[key]; - if(dv.type == TYPE_STR) { +void Settings::setString(uint32_t key, std::string newval) { + if (key > Config::LAST) { + return; + } + DynamicValue &dv = store[key]; + if (dv.type == TYPE_STR) { delete dv.strval; dv.strval = newd std::string(newval); - } else if(dv.type == TYPE_NONE) { + } else if (dv.type == TYPE_NONE) { dv.type = TYPE_STR; dv.strval = newd std::string(newval); } } -std::string Settings::DynamicValue::str() -{ - switch(type) { - case TYPE_FLOAT:return f2s(floatval); - case TYPE_STR: return std::string(*strval); - case TYPE_INT: return i2s(intval); +std::string Settings::DynamicValue::str() { + switch (type) { + case TYPE_FLOAT: + return f2s(floatval); + case TYPE_STR: + return std::string(*strval); + case TYPE_INT: + return i2s(intval); default: - case TYPE_NONE: return ""; + case TYPE_NONE: + return ""; } } -void Settings::IO(IOMode mode) -{ - wxConfigBase* conf = (mode == DEFAULT? nullptr : dynamic_cast(wxConfig::Get())); +void Settings::IO(IOMode mode) { + wxConfigBase* conf = (mode == DEFAULT ? nullptr : dynamic_cast(wxConfig::Get())); using namespace Config; -#define section(s) if(conf) conf->SetPath("/" s) -#define Int(key, dflt) \ - do { \ - if(mode == DEFAULT) { \ - setInteger(key, dflt); \ - } else if(mode == SAVE) { \ - conf->Write(#key, getInteger(key)); \ - } else if(mode == LOAD) { \ +#define section(s) \ + if (conf) \ + conf->SetPath("/" s) +#define Int(key, dflt) \ + do { \ + if (mode == DEFAULT) { \ + setInteger(key, dflt); \ + } else if (mode == SAVE) { \ + conf->Write(#key, getInteger(key)); \ + } else if (mode == LOAD) { \ setInteger(key, conf->Read(#key, long(dflt))); \ - } \ - } while(false) -#define IntToSave(key, dflt) \ - do { \ - if(mode == DEFAULT) { \ - setInteger(key, dflt); \ - } else if(mode == SAVE) { \ - conf->Write(#key, getInteger(key##_TO_SAVE)); \ - } else if(mode == LOAD) { \ + } \ + } while (false) +#define IntToSave(key, dflt) \ + do { \ + if (mode == DEFAULT) { \ + setInteger(key, dflt); \ + } else if (mode == SAVE) { \ + conf->Write(#key, getInteger(key##_TO_SAVE)); \ + } else if (mode == LOAD) { \ setInteger(key, conf->Read(#key, (long)dflt)); \ - setInteger(key##_TO_SAVE , getInteger(key)); \ - } \ - } while(false) -#define Float(key, dflt) \ - do {\ - if(mode == DEFAULT) { \ - setFloat(key, dflt); \ - } else if(mode == SAVE) { \ - conf->Write(#key, getFloat(key)); \ - } else if(mode == LOAD) { \ - double tmp_float;\ + setInteger(key##_TO_SAVE, getInteger(key)); \ + } \ + } while (false) +#define Float(key, dflt) \ + do { \ + if (mode == DEFAULT) { \ + setFloat(key, dflt); \ + } else if (mode == SAVE) { \ + conf->Write(#key, getFloat(key)); \ + } else if (mode == LOAD) { \ + double tmp_float; \ conf->Read(#key, &tmp_float, dflt); \ - setFloat(key, tmp_float); \ - } \ - } while(false) -#define String(key, dflt) \ - do { \ - if(mode == DEFAULT) { \ - setString(key, dflt); \ - } else if(mode == SAVE) { \ + setFloat(key, tmp_float); \ + } \ + } while (false) +#define String(key, dflt) \ + do { \ + if (mode == DEFAULT) { \ + setString(key, dflt); \ + } else if (mode == SAVE) { \ conf->Write(#key, wxstr(getString(key))); \ - } else if(mode == LOAD) { \ - wxString str; \ - conf->Read(#key, &str, dflt); \ - setString(key, nstr(str)); \ - } \ - } while(false) + } else if (mode == LOAD) { \ + wxString str; \ + conf->Read(#key, &str, dflt); \ + setString(key, nstr(str)); \ + } \ + } while (false) section("View"); Int(TRANSPARENT_FLOORS, 0); @@ -341,12 +352,11 @@ void Settings::IO(IOMode mode) #undef String } -void Settings::load() -{ +void Settings::load() { wxConfigBase* conf; #ifdef __WINDOWS__ FileName filename("rme.cfg"); - if(filename.FileExists()) { // Use local file if it exists + if (filename.FileExists()) { // Use local file if it exists wxFileInputStream file(filename.GetFullPath()); conf = newd wxFileConfig(file); use_file_cfg = true; @@ -357,13 +367,13 @@ void Settings::load() } #else FileName filename("./rme.cfg"); - if(filename.FileExists()) { // Use local file if it exists + if (filename.FileExists()) { // Use local file if it exists wxFileInputStream file(filename.GetFullPath()); conf = newd wxFileConfig(file); g_settings.setInteger(Config::INDIRECTORY_INSTALLATION, 1); } else { // Else use global (user-specific) conf filename.Assign(wxStandardPaths::Get().GetUserConfigDir() + "/.rme/rme.cfg"); - if(filename.FileExists()) { + if (filename.FileExists()) { wxFileInputStream file(filename.GetFullPath()); conf = newd wxFileConfig(file); } else { @@ -377,24 +387,25 @@ void Settings::load() IO(LOAD); } -void Settings::save(bool endoftheworld) -{ +void Settings::save(bool endoftheworld) { IO(SAVE); #ifdef __WINDOWS__ - if(use_file_cfg) { + if (use_file_cfg) { wxFileConfig* conf = dynamic_cast(wxConfig::Get()); - if(!conf) + if (!conf) { return; + } FileName filename("rme.cfg"); wxFileOutputStream file(filename.GetFullPath()); conf->Save(file); } #else wxFileConfig* conf = dynamic_cast(wxConfig::Get()); - if(!conf) + if (!conf) { return; + } FileName filename("./rme.cfg"); - if(filename.FileExists()) { // Use local file if it exists + if (filename.FileExists()) { // Use local file if it exists wxFileOutputStream file(filename.GetFullPath()); conf->Save(file); } else { // Else use global (user-specific) conf @@ -405,10 +416,9 @@ void Settings::save(bool endoftheworld) conf->Save(file); } #endif - if(endoftheworld) { + if (endoftheworld) { wxConfigBase* conf = dynamic_cast(wxConfig::Get()); wxConfig::Set(nullptr); delete conf; } } - diff --git a/source/settings.h b/source/settings.h index 2bf70c4f..c678920c 100644 --- a/source/settings.h +++ b/source/settings.h @@ -198,8 +198,10 @@ class Settings { void setFloat(uint32_t key, float newval); void setString(uint32_t key, std::string newval); - wxConfigBase& getConfigObject(); - void setDefaults() {IO(DEFAULT);} + wxConfigBase &getConfigObject(); + void setDefaults() { + IO(DEFAULT); + } void load(); void save(bool endoftheworld = false); @@ -212,27 +214,42 @@ class Settings { }; class DynamicValue { public: - DynamicValue() : type(TYPE_NONE) { + DynamicValue() : + type(TYPE_NONE) { intval = 0; }; - DynamicValue(DynamicType t) : type(t) { - if(t == TYPE_STR) strval = nullptr; - else if(t == TYPE_INT) intval = 0; - else if(t == TYPE_FLOAT) floatval = 0.0; - else intval = 0; + DynamicValue(DynamicType t) : + type(t) { + if (t == TYPE_STR) { + strval = nullptr; + } else if (t == TYPE_INT) { + intval = 0; + } else if (t == TYPE_FLOAT) { + floatval = 0.0; + } else { + intval = 0; + } }; ~DynamicValue() { - if(type == TYPE_STR) + if (type == TYPE_STR) { delete strval; + } } - DynamicValue(const DynamicValue& dv) : type(dv.type) { - if(dv.type == TYPE_STR) strval = newd std::string(*dv.strval); - else if(dv.type == TYPE_INT) intval = dv.intval; - else if(dv.type == TYPE_FLOAT) floatval = dv.floatval; - else intval = 0; + DynamicValue(const DynamicValue &dv) : + type(dv.type) { + if (dv.type == TYPE_STR) { + strval = newd std::string(*dv.strval); + } else if (dv.type == TYPE_INT) { + intval = dv.intval; + } else if (dv.type == TYPE_FLOAT) { + floatval = dv.floatval; + } else { + intval = 0; + } }; std::string str(); + private: DynamicType type; union { @@ -243,6 +260,7 @@ class Settings { friend class Settings; }; + private: enum IOMode { DEFAULT, diff --git a/source/spawn_monster.cpp b/source/spawn_monster.cpp index 922efa58..112d7f3b 100644 --- a/source/spawn_monster.cpp +++ b/source/spawn_monster.cpp @@ -22,20 +22,17 @@ SpawnMonster::SpawnMonster(int size) : size(0), - selected(false) -{ + selected(false) { setSize(size); } -SpawnMonster* SpawnMonster::deepCopy() const -{ +SpawnMonster* SpawnMonster::deepCopy() const { SpawnMonster* copy = new SpawnMonster(size); copy->selected = selected; return copy; } -void SpawnsMonster::addSpawnMonster(Tile* tile) -{ +void SpawnsMonster::addSpawnMonster(Tile* tile) { ASSERT(tile->spawnMonster); auto it = spawnsMonster.insert(tile->getPosition()); @@ -58,7 +55,7 @@ void SpawnsMonster::removeSpawnMonster(Tile* tile) { #endif } -std::ostream& operator<<(std::ostream& os, const SpawnMonster& spawnMonster) { +std::ostream &operator<<(std::ostream &os, const SpawnMonster &spawnMonster) { os << &spawnMonster << ":: -> " << spawnMonster.getSize() << std::endl; return os; } diff --git a/source/spawn_monster.h b/source/spawn_monster.h index 2e5558b1..b6a5408d 100644 --- a/source/spawn_monster.h +++ b/source/spawn_monster.h @@ -26,20 +26,33 @@ class SpawnMonster { SpawnMonster* deepCopy() const; - bool isSelected() const noexcept { return selected; } - void select() noexcept { selected = true; } - void deselect() noexcept { selected = false; } + bool isSelected() const noexcept { + return selected; + } + void select() noexcept { + selected = true; + } + void deselect() noexcept { + selected = false; + } - int getSize() const noexcept { return size; } + int getSize() const noexcept { + return size; + } // Does not compare selection! - bool operator==(const SpawnMonster& other) {return size == other.size;} - bool operator!=(const SpawnMonster& other) {return size != other.size;} + bool operator==(const SpawnMonster &other) { + return size == other.size; + } + bool operator!=(const SpawnMonster &other) { + return size != other.size; + } void setSize(int newsize) { ASSERT(size < 100); size = newsize; } + protected: int size; bool selected; @@ -50,19 +63,30 @@ typedef std::list SpawnMonsterList; class SpawnsMonster { public: - void addSpawnMonster(Tile* tile); void removeSpawnMonster(Tile* tile); - SpawnMonsterPositionList::iterator begin() noexcept { return spawnsMonster.begin(); } - SpawnMonsterPositionList::const_iterator begin() const noexcept { return spawnsMonster.begin(); } - SpawnMonsterPositionList::iterator end() noexcept { return spawnsMonster.end(); } - SpawnMonsterPositionList::const_iterator end() const noexcept { return spawnsMonster.end(); } - void erase(SpawnMonsterPositionList::iterator iter) noexcept { spawnsMonster.erase(iter); } - SpawnMonsterPositionList::iterator find(Position& pos) {return spawnsMonster.find(pos);} + SpawnMonsterPositionList::iterator begin() noexcept { + return spawnsMonster.begin(); + } + SpawnMonsterPositionList::const_iterator begin() const noexcept { + return spawnsMonster.begin(); + } + SpawnMonsterPositionList::iterator end() noexcept { + return spawnsMonster.end(); + } + SpawnMonsterPositionList::const_iterator end() const noexcept { + return spawnsMonster.end(); + } + void erase(SpawnMonsterPositionList::iterator iter) noexcept { + spawnsMonster.erase(iter); + } + SpawnMonsterPositionList::iterator find(Position &pos) { + return spawnsMonster.find(pos); + } + private: SpawnMonsterPositionList spawnsMonster; }; - #endif diff --git a/source/spawn_monster_brush.cpp b/source/spawn_monster_brush.cpp index ac556353..018bc4bf 100644 --- a/source/spawn_monster_brush.cpp +++ b/source/spawn_monster_brush.cpp @@ -25,48 +25,41 @@ // SpawnMonster brush SpawnMonsterBrush::SpawnMonsterBrush() : - Brush() -{ + Brush() { //// } -SpawnMonsterBrush::~SpawnMonsterBrush() -{ +SpawnMonsterBrush::~SpawnMonsterBrush() { //// } -int SpawnMonsterBrush::getLookID() const -{ +int SpawnMonsterBrush::getLookID() const { return 0; } -std::string SpawnMonsterBrush::getName() const -{ +std::string SpawnMonsterBrush::getName() const { return "SpawnMonster Brush"; } -bool SpawnMonsterBrush::canDraw(BaseMap* map, const Position& position) const -{ +bool SpawnMonsterBrush::canDraw(BaseMap* map, const Position &position) const { Tile* tile = map->getTile(position); - if(tile) { - if(tile->spawnMonster) { + if (tile) { + if (tile->spawnMonster) { return false; } } return true; } -void SpawnMonsterBrush::undraw(BaseMap* map, Tile* tile) -{ +void SpawnMonsterBrush::undraw(BaseMap* map, Tile* tile) { delete tile->spawnMonster; tile->spawnMonster = nullptr; } -void SpawnMonsterBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void SpawnMonsterBrush::draw(BaseMap* map, Tile* tile, void* parameter) { ASSERT(tile); ASSERT(parameter); // Should contain an int which is the size of the newd monster spawn - if(tile->spawnMonster == nullptr) { + if (tile->spawnMonster == nullptr) { tile->spawnMonster = newd SpawnMonster(std::max(1, *(int*)parameter)); } } diff --git a/source/spawn_monster_brush.h b/source/spawn_monster_brush.h index 3d0b9254..894aa6e6 100644 --- a/source/spawn_monster_brush.h +++ b/source/spawn_monster_brush.h @@ -23,24 +23,33 @@ //============================================================================= // SpawnMonsterBrush, place monster spawn -class SpawnMonsterBrush : public Brush -{ +class SpawnMonsterBrush : public Brush { public: SpawnMonsterBrush(); // Create a RAWBrush of the specified type virtual ~SpawnMonsterBrush(); - bool isSpawnMonster() const { return true; } - SpawnMonsterBrush* asSpawnMonster() { return static_cast(this); } + bool isSpawnMonster() const { + return true; + } + SpawnMonsterBrush* asSpawnMonster() { + return static_cast(this); + } - virtual bool canDraw(BaseMap* map, const Position& position) const; + virtual bool canDraw(BaseMap* map, const Position &position) const; virtual void draw(BaseMap* map, Tile* tile, void* parameter); // parameter is brush size virtual void undraw(BaseMap* map, Tile* tile); virtual int getLookID() const; // We don't have a look, sorry! virtual std::string getName() const; - virtual bool canDrag() const { return true; } - virtual bool canSmear() const { return false; } - virtual bool oneSizeFitsAll() const { return true; } + virtual bool canDrag() const { + return true; + } + virtual bool canSmear() const { + return false; + } + virtual bool oneSizeFitsAll() const { + return true; + } }; #endif diff --git a/source/spawn_npc.cpp b/source/spawn_npc.cpp index 1fdf6cd5..bc0628c9 100644 --- a/source/spawn_npc.cpp +++ b/source/spawn_npc.cpp @@ -22,20 +22,17 @@ SpawnNpc::SpawnNpc(int size) : size(0), - selected(false) -{ + selected(false) { setSize(size); } -SpawnNpc* SpawnNpc::deepCopy() const -{ +SpawnNpc* SpawnNpc::deepCopy() const { SpawnNpc* copy = new SpawnNpc(size); copy->selected = selected; return copy; } -void SpawnsNpc::addSpawnNpc(Tile* tile) -{ +void SpawnsNpc::addSpawnNpc(Tile* tile) { ASSERT(tile->spawnNpc); auto it = spawnsNpc.insert(tile->getPosition()); @@ -58,7 +55,7 @@ void SpawnsNpc::removeSpawnNpc(Tile* tile) { #endif } -std::ostream& operator<<(std::ostream& os, const SpawnNpc& spawnNpc) { +std::ostream &operator<<(std::ostream &os, const SpawnNpc &spawnNpc) { os << &spawnNpc << ":: -> " << spawnNpc.getSize() << std::endl; return os; } diff --git a/source/spawn_npc.h b/source/spawn_npc.h index 95a52f63..43490354 100644 --- a/source/spawn_npc.h +++ b/source/spawn_npc.h @@ -26,15 +26,27 @@ class SpawnNpc { SpawnNpc* deepCopy() const; - bool isSelected() const noexcept { return selected; } - void select() noexcept { selected = true; } - void deselect() noexcept { selected = false; } + bool isSelected() const noexcept { + return selected; + } + void select() noexcept { + selected = true; + } + void deselect() noexcept { + selected = false; + } - int getSize() const noexcept { return size; } + int getSize() const noexcept { + return size; + } // Does not compare selection! - bool operator==(const SpawnNpc& other) {return size == other.size;} - bool operator!=(const SpawnNpc& other) {return size != other.size;} + bool operator==(const SpawnNpc &other) { + return size == other.size; + } + bool operator!=(const SpawnNpc &other) { + return size != other.size; + } void setSize(int newsize) { ASSERT(size < 100); @@ -51,16 +63,28 @@ typedef std::list SpawnNpcList; class SpawnsNpc { public: - void addSpawnNpc(Tile* tile); void removeSpawnNpc(Tile* tile); - SpawnNpcPositionList::iterator begin() noexcept { return spawnsNpc.begin(); } - SpawnNpcPositionList::const_iterator begin() const noexcept { return spawnsNpc.begin(); } - SpawnNpcPositionList::iterator end() noexcept { return spawnsNpc.end(); } - SpawnNpcPositionList::const_iterator end() const noexcept { return spawnsNpc.end(); } - void erase(SpawnNpcPositionList::iterator iter) noexcept { spawnsNpc.erase(iter); } - SpawnNpcPositionList::iterator find(Position& pos) {return spawnsNpc.find(pos);} + SpawnNpcPositionList::iterator begin() noexcept { + return spawnsNpc.begin(); + } + SpawnNpcPositionList::const_iterator begin() const noexcept { + return spawnsNpc.begin(); + } + SpawnNpcPositionList::iterator end() noexcept { + return spawnsNpc.end(); + } + SpawnNpcPositionList::const_iterator end() const noexcept { + return spawnsNpc.end(); + } + void erase(SpawnNpcPositionList::iterator iter) noexcept { + spawnsNpc.erase(iter); + } + SpawnNpcPositionList::iterator find(Position &pos) { + return spawnsNpc.find(pos); + } + private: SpawnNpcPositionList spawnsNpc; }; diff --git a/source/spawn_npc_brush.cpp b/source/spawn_npc_brush.cpp index 6c3cb12c..7c5c4067 100644 --- a/source/spawn_npc_brush.cpp +++ b/source/spawn_npc_brush.cpp @@ -25,48 +25,41 @@ // Spawn npc brush SpawnNpcBrush::SpawnNpcBrush() : - Brush() -{ + Brush() { //// } -SpawnNpcBrush::~SpawnNpcBrush() -{ +SpawnNpcBrush::~SpawnNpcBrush() { //// } -int SpawnNpcBrush::getLookID() const -{ +int SpawnNpcBrush::getLookID() const { return 0; } -std::string SpawnNpcBrush::getName() const -{ +std::string SpawnNpcBrush::getName() const { return "Spawn Npc Brush"; } -bool SpawnNpcBrush::canDraw(BaseMap* map, const Position& position) const -{ +bool SpawnNpcBrush::canDraw(BaseMap* map, const Position &position) const { Tile* tile = map->getTile(position); - if(tile) { - if(tile->spawnNpc) { + if (tile) { + if (tile->spawnNpc) { return false; } } return true; } -void SpawnNpcBrush::undraw(BaseMap* map, Tile* tile) -{ +void SpawnNpcBrush::undraw(BaseMap* map, Tile* tile) { delete tile->spawnNpc; tile->spawnNpc = nullptr; } -void SpawnNpcBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void SpawnNpcBrush::draw(BaseMap* map, Tile* tile, void* parameter) { ASSERT(tile); ASSERT(parameter); // Should contain an int which is the size of the newd spawn npc - if(tile->spawnNpc == nullptr) { + if (tile->spawnNpc == nullptr) { tile->spawnNpc = newd SpawnNpc(std::max(1, *(int*)parameter)); } } diff --git a/source/spawn_npc_brush.h b/source/spawn_npc_brush.h index a2efc13b..3e6c111c 100644 --- a/source/spawn_npc_brush.h +++ b/source/spawn_npc_brush.h @@ -23,24 +23,33 @@ //============================================================================= // SpawnNpcBrush, place spawns npc -class SpawnNpcBrush : public Brush -{ +class SpawnNpcBrush : public Brush { public: SpawnNpcBrush(); // Create a RAWBrush of the specified type virtual ~SpawnNpcBrush(); - bool isSpawnNpc() const { return true; } - SpawnNpcBrush* asSpawnNpc() { return static_cast(this); } + bool isSpawnNpc() const { + return true; + } + SpawnNpcBrush* asSpawnNpc() { + return static_cast(this); + } - virtual bool canDraw(BaseMap* map, const Position& position) const; + virtual bool canDraw(BaseMap* map, const Position &position) const; virtual void draw(BaseMap* map, Tile* tile, void* parameter); // parameter is brush size virtual void undraw(BaseMap* map, Tile* tile); virtual int getLookID() const; // We don't have a look, sorry! virtual std::string getName() const; - virtual bool canDrag() const { return true; } - virtual bool canSmear() const { return false; } - virtual bool oneSizeFitsAll() const { return true; } + virtual bool canDrag() const { + return true; + } + virtual bool canSmear() const { + return false; + } + virtual bool oneSizeFitsAll() const { + return true; + } }; #endif diff --git a/source/sprites.h b/source/sprites.h index cb54f8ef..82652ccd 100644 --- a/source/sprites.h +++ b/source/sprites.h @@ -62,7 +62,7 @@ enum { EDITOR_SPRITE_PICKUPABLE_ITEM, EDITOR_SPRITE_MOVEABLE_ITEM, EDITOR_SPRITE_PICKUPABLE_MOVEABLE_ITEM, - + EDITOR_SPRITE_LAST }; diff --git a/source/table_brush.cpp b/source/table_brush.cpp index 7532df5e..a6709fa4 100644 --- a/source/table_brush.cpp +++ b/source/table_brush.cpp @@ -28,72 +28,70 @@ uint32_t TableBrush::table_types[256]; // Table brush TableBrush::TableBrush() : - look_id(0) -{ + look_id(0) { //// } -TableBrush::~TableBrush() -{ +TableBrush::~TableBrush() { //// } -bool TableBrush::load(pugi::xml_node node, wxArrayString& warnings) -{ - if(const pugi::xml_attribute attribute = node.attribute("server_lookid")) +bool TableBrush::load(pugi::xml_node node, wxArrayString &warnings) { + if (const pugi::xml_attribute attribute = node.attribute("server_lookid")) { look_id = g_items.getItemType(attribute.as_uint()).clientID; + } - if(look_id == 0) { + if (look_id == 0) { look_id = node.attribute("lookid").as_uint(); } - for(pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { - if(as_lower_str(childNode.name()) != "table") { + for (pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { + if (as_lower_str(childNode.name()) != "table") { continue; } - const std::string& alignString = childNode.attribute("align").as_string(); - if(alignString.empty()) { + const std::string &alignString = childNode.attribute("align").as_string(); + if (alignString.empty()) { warnings.push_back("Could not read type tag of table node\n"); continue; } uint32_t alignment; - if(alignString == "vertical") { + if (alignString == "vertical") { alignment = TABLE_VERTICAL; - } else if(alignString == "horizontal") { + } else if (alignString == "horizontal") { alignment = TABLE_HORIZONTAL; - } else if(alignString == "south") { + } else if (alignString == "south") { alignment = TABLE_SOUTH_END; - } else if(alignString == "east") { + } else if (alignString == "east") { alignment = TABLE_EAST_END; - } else if(alignString == "north") { + } else if (alignString == "north") { alignment = TABLE_NORTH_END; - } else if(alignString == "west") { + } else if (alignString == "west") { alignment = TABLE_WEST_END; - } else if(alignString == "alone") { + } else if (alignString == "alone") { alignment = TABLE_ALONE; } else { warnings.push_back("Unknown table alignment '" + wxstr(alignString) + "'\n"); continue; } - for(pugi::xml_node subChildNode = childNode.first_child(); subChildNode; subChildNode = subChildNode.next_sibling()) { - if(as_lower_str(subChildNode.name()) != "item") { + for (pugi::xml_node subChildNode = childNode.first_child(); subChildNode; subChildNode = subChildNode.next_sibling()) { + if (as_lower_str(subChildNode.name()) != "item") { continue; } uint16_t id = subChildNode.attribute("id").as_uint(); - if(id == 0) { + if (id == 0) { warnings.push_back("Could not read id tag of item node\n"); break; } ItemType* type = g_items.getRawItemType(id); - if(!type) { + if (!type) { warnings.push_back("There is no itemtype with id " + std::to_string(id)); return false; - } else if(type->brush && type->brush != this) { + } else if (type->brush && type->brush != this) { warnings.push_back("Itemtype id " + std::to_string(id) + " already has a brush"); return false; } @@ -112,18 +110,16 @@ bool TableBrush::load(pugi::xml_node node, wxArrayString& warnings) return true; } -bool TableBrush::canDraw(BaseMap* map, const Position& position) const -{ +bool TableBrush::canDraw(BaseMap* map, const Position &position) const { return true; } -void TableBrush::undraw(BaseMap* map, Tile* t) -{ +void TableBrush::undraw(BaseMap* map, Tile* t) { ItemVector::iterator it = t->items.begin(); - while(it != t->items.end()) { - if((*it)->isTable()) { + while (it != t->items.end()) { + if ((*it)->isTable()) { TableBrush* tb = (*it)->getTableBrush(); - if(tb == this) { + if (tb == this) { delete *it; it = t->items.erase(it); } else { @@ -135,40 +131,39 @@ void TableBrush::undraw(BaseMap* map, Tile* t) } } -void TableBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void TableBrush::draw(BaseMap* map, Tile* tile, void* parameter) { undraw(map, tile); // Remove old - TableNode& tn = table_items[0]; - if(tn.total_chance <= 0) { + TableNode &tn = table_items[0]; + if (tn.total_chance <= 0) { return; } int chance = random(1, tn.total_chance); uint16_t type = 0; - for(std::vector::const_iterator table_iter = tn.items.begin(); table_iter != tn.items.end(); ++table_iter) { - if(chance <= table_iter->chance) { + for (std::vector::const_iterator table_iter = tn.items.begin(); table_iter != tn.items.end(); ++table_iter) { + if (chance <= table_iter->chance) { type = table_iter->item_id; break; } chance -= table_iter->chance; } - if(type != 0) { + if (type != 0) { tile->addItem(Item::Create(type)); } } - -bool hasMatchingTableBrushAtTile(BaseMap* map, TableBrush* table_brush, uint32_t x, uint32_t y, uint32_t z) -{ +bool hasMatchingTableBrushAtTile(BaseMap* map, TableBrush* table_brush, uint32_t x, uint32_t y, uint32_t z) { Tile* t = map->getTile(x, y, z); - if(!t) return false; + if (!t) { + return false; + } ItemVector::const_iterator it = t->items.begin(); - for(; it != t->items.end(); ++it) { + for (; it != t->items.end(); ++it) { TableBrush* tb = (*it)->getTableBrush(); - if(tb == table_brush) { + if (tb == table_brush) { return true; } } @@ -176,94 +171,93 @@ bool hasMatchingTableBrushAtTile(BaseMap* map, TableBrush* table_brush, uint32_t return false; } -void TableBrush::doTables(BaseMap* map, Tile* tile) -{ +void TableBrush::doTables(BaseMap* map, Tile* tile) { ASSERT(tile); - if(!tile->hasTable()) { + if (!tile->hasTable()) { return; } - const Position& position = tile->getPosition(); + const Position &position = tile->getPosition(); int32_t x = position.x; int32_t y = position.y; int32_t z = position.z; - for(Item* item : tile->items) { + for (Item* item : tile->items) { ASSERT(item); TableBrush* table_brush = item->getTableBrush(); - if(!table_brush) { + if (!table_brush) { continue; } bool neighbours[8]; - if(x == 0) { - if(y == 0) { + if (x == 0) { + if (y == 0) { neighbours[0] = false; neighbours[1] = false; neighbours[2] = false; neighbours[3] = false; neighbours[4] = hasMatchingTableBrushAtTile(map, table_brush, x + 1, y, z); neighbours[5] = false; - neighbours[6] = hasMatchingTableBrushAtTile(map, table_brush, x, y + 1, z); + neighbours[6] = hasMatchingTableBrushAtTile(map, table_brush, x, y + 1, z); neighbours[7] = hasMatchingTableBrushAtTile(map, table_brush, x + 1, y + 1, z); } else { neighbours[0] = false; - neighbours[1] = hasMatchingTableBrushAtTile(map, table_brush, x, y - 1, z); + neighbours[1] = hasMatchingTableBrushAtTile(map, table_brush, x, y - 1, z); neighbours[2] = hasMatchingTableBrushAtTile(map, table_brush, x + 1, y - 1, z); neighbours[3] = false; neighbours[4] = hasMatchingTableBrushAtTile(map, table_brush, x + 1, y, z); neighbours[5] = false; - neighbours[6] = hasMatchingTableBrushAtTile(map, table_brush, x, y + 1, z); + neighbours[6] = hasMatchingTableBrushAtTile(map, table_brush, x, y + 1, z); neighbours[7] = hasMatchingTableBrushAtTile(map, table_brush, x + 1, y + 1, z); } - } else if(y == 0) { + } else if (y == 0) { neighbours[0] = false; neighbours[1] = false; neighbours[2] = false; neighbours[3] = hasMatchingTableBrushAtTile(map, table_brush, x - 1, y, z); neighbours[4] = hasMatchingTableBrushAtTile(map, table_brush, x + 1, y, z); neighbours[5] = hasMatchingTableBrushAtTile(map, table_brush, x - 1, y + 1, z); - neighbours[6] = hasMatchingTableBrushAtTile(map, table_brush, x, y + 1, z); + neighbours[6] = hasMatchingTableBrushAtTile(map, table_brush, x, y + 1, z); neighbours[7] = hasMatchingTableBrushAtTile(map, table_brush, x + 1, y + 1, z); } else { neighbours[0] = hasMatchingTableBrushAtTile(map, table_brush, x - 1, y - 1, z); - neighbours[1] = hasMatchingTableBrushAtTile(map, table_brush, x, y - 1, z); + neighbours[1] = hasMatchingTableBrushAtTile(map, table_brush, x, y - 1, z); neighbours[2] = hasMatchingTableBrushAtTile(map, table_brush, x + 1, y - 1, z); neighbours[3] = hasMatchingTableBrushAtTile(map, table_brush, x - 1, y, z); neighbours[4] = hasMatchingTableBrushAtTile(map, table_brush, x + 1, y, z); neighbours[5] = hasMatchingTableBrushAtTile(map, table_brush, x - 1, y + 1, z); - neighbours[6] = hasMatchingTableBrushAtTile(map, table_brush, x, y + 1, z); + neighbours[6] = hasMatchingTableBrushAtTile(map, table_brush, x, y + 1, z); neighbours[7] = hasMatchingTableBrushAtTile(map, table_brush, x + 1, y + 1, z); } uint32_t tiledata = 0; - for(int32_t i = 0; i < 8; ++i) { - if(neighbours[i]) { + for (int32_t i = 0; i < 8; ++i) { + if (neighbours[i]) { // Same table as this one, calculate what border tiledata |= 1 << i; } } BorderType bt = static_cast(table_types[tiledata]); - TableNode& tn = table_brush->table_items[static_cast(bt)]; - if(tn.total_chance == 0) { + TableNode &tn = table_brush->table_items[static_cast(bt)]; + if (tn.total_chance == 0) { return; } int32_t chance = random(1, tn.total_chance); uint16_t id = 0; - for(const TableType& tableType : tn.items) { - if(chance <= tableType.chance) { + for (const TableType &tableType : tn.items) { + if (chance <= tableType.chance) { id = tableType.item_id; break; } chance -= tableType.chance; } - if(id != 0) { + if (id != 0) { item->setID(id); } } diff --git a/source/table_brush.h b/source/table_brush.h index 44cc2056..9238efbc 100644 --- a/source/table_brush.h +++ b/source/table_brush.h @@ -24,43 +24,54 @@ // Tablebrush, for tables, and some things that behave like tables // and with tables I really mean counters. -class TableBrush : public Brush -{ +class TableBrush : public Brush { public: static void init(); TableBrush(); virtual ~TableBrush(); - bool isTable() const { return true; } - TableBrush* asTable() { return static_cast(this); } + bool isTable() const { + return true; + } + TableBrush* asTable() { + return static_cast(this); + } - virtual bool load(pugi::xml_node node, wxArrayString& warnings); + virtual bool load(pugi::xml_node node, wxArrayString &warnings); - virtual bool canDraw(BaseMap* map, const Position& position) const; + virtual bool canDraw(BaseMap* map, const Position &position) const; virtual void draw(BaseMap* map, Tile* tile, void* parameter); virtual void undraw(BaseMap* map, Tile* tile); static void doTables(BaseMap* map, Tile* tile); - virtual int getLookID() const { return look_id; } + virtual int getLookID() const { + return look_id; + } - virtual std::string getName() const { return name; } - virtual void setName(const std::string& newName) { name = newName; } + virtual std::string getName() const { + return name; + } + virtual void setName(const std::string &newName) { + name = newName; + } - virtual bool needBorders() const { return true; } + virtual bool needBorders() const { + return true; + } protected: - struct TableType - { - TableType() : chance(0), item_id(0) {} + struct TableType { + TableType() : + chance(0), item_id(0) { } int chance; uint16_t item_id; }; - struct TableNode - { - TableNode() : total_chance(0) {} + struct TableNode { + TableNode() : + total_chance(0) { } int total_chance; std::vector items; }; diff --git a/source/templatemap76-74.cpp b/source/templatemap76-74.cpp index 00dcd465..79afaac7 100644 --- a/source/templatemap76-74.cpp +++ b/source/templatemap76-74.cpp @@ -17,7 +17,6 @@ #include "main.h" - #include "templates.h" ConversionMap getReplacementMapFrom760To740() { diff --git a/source/templatemap81.cpp b/source/templatemap81.cpp index d1cf6885..adb3f7d4 100644 --- a/source/templatemap81.cpp +++ b/source/templatemap81.cpp @@ -17,8 +17,6 @@ #include "main.h" - - #include "templates.h" ConversionMap getReplacementMapFrom800To810() { diff --git a/source/templatemap854.cpp b/source/templatemap854.cpp index d57b083b..75318fdb 100644 --- a/source/templatemap854.cpp +++ b/source/templatemap854.cpp @@ -17,7 +17,6 @@ #include "main.h" - #include "templates.h" ConversionMap getReplacementMapFrom854To854() { diff --git a/source/templates.h b/source/templates.h index 4d3b712b..ffcd0d6d 100644 --- a/source/templates.h +++ b/source/templates.h @@ -22,9 +22,9 @@ struct ConversionMap { // Many to Many - typedef std::map, std::vector > MTM; + typedef std::map, std::vector> MTM; // Single to Many - typedef std::map > STM; + typedef std::map> STM; MTM mtm; STM stm; diff --git a/source/threads.h b/source/threads.h index ce82e220..a37e2570 100644 --- a/source/threads.h +++ b/source/threads.h @@ -29,15 +29,18 @@ class Thread : public wxThread { class JoinableThread : public Thread { public: - JoinableThread() : Thread(wxTHREAD_JOINABLE) {} + JoinableThread() : + Thread(wxTHREAD_JOINABLE) { } }; class DetachedThread : public Thread { public: - DetachedThread() : Thread(wxTHREAD_DETACHED) {} + DetachedThread() : + Thread(wxTHREAD_DETACHED) { } }; -inline Thread::Thread(wxThreadKind kind) : wxThread(kind) {} +inline Thread::Thread(wxThreadKind kind) : + wxThread(kind) { } inline void Thread::Execute() { Create(); diff --git a/source/tile.cpp b/source/tile.cpp index 01c4e15a..52116357 100644 --- a/source/tile.cpp +++ b/source/tile.cpp @@ -41,12 +41,11 @@ Tile::Tile(int x, int y, int z) : house_id(0), mapflags(0), statflags(0), - minimapColor(INVALID_MINIMAP_COLOR) -{ + minimapColor(INVALID_MINIMAP_COLOR) { //// } -Tile::Tile(TileLocation& loc) : +Tile::Tile(TileLocation &loc) : location(&loc), ground(nullptr), monster(nullptr), @@ -56,49 +55,57 @@ Tile::Tile(TileLocation& loc) : house_id(0), mapflags(0), statflags(0), - minimapColor(INVALID_MINIMAP_COLOR) -{ + minimapColor(INVALID_MINIMAP_COLOR) { //// } -Tile::~Tile() -{ - while(!items.empty()) { +Tile::~Tile() { + while (!items.empty()) { delete items.back(); items.pop_back(); } delete monster; - //printf("%d,%d,%d,%p\n", tilePos.x, tilePos.y, tilePos.z, ground); + // printf("%d,%d,%d,%p\n", tilePos.x, tilePos.y, tilePos.z, ground); delete ground; delete spawnMonster; delete npc; delete spawnNpc; } -Tile* Tile::deepCopy(BaseMap& map) const -{ +Tile* Tile::deepCopy(BaseMap &map) const { Tile* copy = map.allocator.allocateTile(location); copy->flags = flags; copy->house_id = house_id; - if(spawnMonster) copy->spawnMonster = spawnMonster->deepCopy(); - if(spawnNpc) copy->spawnNpc = spawnNpc->deepCopy(); - if(monster) copy->monster = monster->deepCopy(); - if(npc) copy->npc = npc->deepCopy(); + if (spawnMonster) { + copy->spawnMonster = spawnMonster->deepCopy(); + } + if (spawnNpc) { + copy->spawnNpc = spawnNpc->deepCopy(); + } + if (monster) { + copy->monster = monster->deepCopy(); + } + if (npc) { + copy->npc = npc->deepCopy(); + } // Spawncount & exits are not transferred on copy! - if(ground) copy->ground = ground->deepCopy(); + if (ground) { + copy->ground = ground->deepCopy(); + } - for(const Item* item : items) { + for (const Item* item : items) { copy->items.push_back(item->deepCopy()); } return copy; } -uint32_t Tile::memsize() const -{ +uint32_t Tile::memsize() const { uint32_t mem = sizeof(*this); - if(ground) mem += ground->memsize(); + if (ground) { + mem += ground->memsize(); + } - for(const Item* item : items) { + for (const Item* item : items) { mem += item->memsize(); } @@ -107,121 +114,143 @@ uint32_t Tile::memsize() const return mem; } -int Tile::size() const -{ +int Tile::size() const { int sz = 0; - if(ground) ++sz; + if (ground) { + ++sz; + } sz += items.size(); - if(monster) ++sz; - if(spawnMonster) ++sz; - if(npc) ++sz; - if(spawnNpc) ++sz; - if(location) { - if(location->getHouseExits()) ++sz; - if(location->getSpawnMonsterCount()) ++sz; - if(location->getSpawnNpcCount()) ++sz; - if(location->getWaypointCount()) ++ sz; + if (monster) { + ++sz; + } + if (spawnMonster) { + ++sz; + } + if (npc) { + ++sz; + } + if (spawnNpc) { + ++sz; + } + if (location) { + if (location->getHouseExits()) { + ++sz; + } + if (location->getSpawnMonsterCount()) { + ++sz; + } + if (location->getSpawnNpcCount()) { + ++sz; + } + if (location->getWaypointCount()) { + ++sz; + } } return sz; } void Tile::merge(Tile* other) { - if(!other) return; + if (!other) { + return; + } - if(other->isPZ()) setPZ(true); - if(other->house_id) { + if (other->isPZ()) { + setPZ(true); + } + if (other->house_id) { house_id = other->house_id; } - if(other->ground) { + if (other->ground) { delete ground; ground = other->ground; other->ground = nullptr; } - if(other->monster) { + if (other->monster) { delete monster; monster = other->monster; other->monster = nullptr; } - if(other->spawnMonster) { + if (other->spawnMonster) { delete spawnMonster; spawnMonster = other->spawnMonster; other->spawnMonster = nullptr; } - if(other->npc) { + if (other->npc) { delete npc; npc = other->npc; other->npc = nullptr; } - if(other->spawnNpc) { + if (other->spawnNpc) { delete spawnNpc; spawnNpc = other->spawnNpc; other->spawnNpc = nullptr; } - if(other->monster) { + if (other->monster) { delete monster; monster = other->monster; other->monster = nullptr; } - if(other->npc) { + if (other->npc) { delete npc; npc = other->npc; other->npc = nullptr; } - for(Item* item : other->items) { + for (Item* item : other->items) { addItem(item); } other->items.clear(); } -bool Tile::hasProperty(enum ITEMPROPERTY prop) const -{ - if(prop == PROTECTIONZONE && isPZ()) +bool Tile::hasProperty(enum ITEMPROPERTY prop) const { + if (prop == PROTECTIONZONE && isPZ()) { return true; + } - if(ground && ground->hasProperty(prop)){ + if (ground && ground->hasProperty(prop)) { return true; } - for(const Item* item : items) { - if(item->hasProperty(prop)) + for (const Item* item : items) { + if (item->hasProperty(prop)) { return true; + } } return false; } -uint16_t Tile::getGroundSpeed() const noexcept -{ - if(ground && !ground->isMetaItem()) { +uint16_t Tile::getGroundSpeed() const noexcept { + if (ground && !ground->isMetaItem()) { return ground->getGroundSpeed(); } return 0; } -int Tile::getIndexOf(Item* item) const -{ - if(!item) +int Tile::getIndexOf(Item* item) const { + if (!item) { return wxNOT_FOUND; + } int index = 0; - if(ground) { - if(ground == item) + if (ground) { + if (ground == item) { return index; + } index++; } - if(!items.empty()) { + if (!items.empty()) { auto it = std::find(items.begin(), items.end(), item); - if(it != items.end()) { + if (it != items.end()) { index += (it - items.begin()); return index; } @@ -229,36 +258,38 @@ int Tile::getIndexOf(Item* item) const return wxNOT_FOUND; } -Item* Tile::getTopItem() const -{ - if(!items.empty() && !items.back()->isMetaItem()) +Item* Tile::getTopItem() const { + if (!items.empty() && !items.back()->isMetaItem()) { return items.back(); - if(ground && !ground->isMetaItem()) { + } + if (ground && !ground->isMetaItem()) { return ground; } return nullptr; } -Item* Tile::getItemAt(int index) const -{ - if(index < 0) +Item* Tile::getItemAt(int index) const { + if (index < 0) { return nullptr; - if(ground) { - if(index == 0) + } + if (ground) { + if (index == 0) { return ground; + } index--; } - if(!items.empty() && index >= 0 && index < items.size()) { + if (!items.empty() && index >= 0 && index < items.size()) { return items.at(index); } return nullptr; } -void Tile::addItem(Item* item) -{ - if(!item) return; - if(item->isGroundTile()) { - //printf("ADDING GROUND\n"); +void Tile::addItem(Item* item) { + if (!item) { + return; + } + if (item->isGroundTile()) { + // printf("ADDING GROUND\n"); delete ground; ground = item; return; @@ -267,19 +298,19 @@ void Tile::addItem(Item* item) ItemVector::iterator it; uint16_t gid = item->getGroundEquivalent(); - if(gid != 0) { + if (gid != 0) { delete ground; ground = Item::Create(gid); // At the very bottom! it = items.begin(); } else { - if(item->isAlwaysOnBottom()) { + if (item->isAlwaysOnBottom()) { it = items.begin(); - while(true) { - if(it == items.end()) { + while (true) { + if (it == items.end()) { break; - } else if((*it)->isAlwaysOnBottom()) { - if(item->getTopOrder() < (*it)->getTopOrder()) { + } else if ((*it)->isAlwaysOnBottom()) { + if (item->getTopOrder() < (*it)->getTopOrder()) { break; } } else { // Always on top @@ -294,70 +325,89 @@ void Tile::addItem(Item* item) items.insert(it, item); - if(item->isSelected()) { + if (item->isSelected()) { statflags |= TILESTATE_SELECTED; } } -void Tile::select() -{ - if(size() == 0) return; - if(ground) ground->select(); - if(spawnMonster) spawnMonster->select(); - if(spawnNpc) spawnNpc->select(); - if(monster) monster->select(); - if(npc) npc->select(); +void Tile::select() { + if (size() == 0) { + return; + } + if (ground) { + ground->select(); + } + if (spawnMonster) { + spawnMonster->select(); + } + if (spawnNpc) { + spawnNpc->select(); + } + if (monster) { + monster->select(); + } + if (npc) { + npc->select(); + } - for(Item* item : items) { + for (Item* item : items) { item->select(); } statflags |= TILESTATE_SELECTED; } +void Tile::deselect() { + if (ground) { + ground->deselect(); + } + if (spawnMonster) { + spawnMonster->deselect(); + } + if (spawnNpc) { + spawnNpc->deselect(); + } + if (monster) { + monster->deselect(); + } + if (npc) { + npc->deselect(); + } -void Tile::deselect() -{ - if(ground) ground->deselect(); - if(spawnMonster) spawnMonster->deselect(); - if(spawnNpc) spawnNpc->deselect(); - if(monster) monster->deselect(); - if(npc) npc->deselect(); - - for(Item* item : items) { + for (Item* item : items) { item->deselect(); } statflags &= ~TILESTATE_SELECTED; } -Item* Tile::getTopSelectedItem() -{ - for(auto it = items.rbegin(); it != items.rend(); ++it) { - if((*it)->isSelected() && !(*it)->isMetaItem()) { +Item* Tile::getTopSelectedItem() { + for (auto it = items.rbegin(); it != items.rend(); ++it) { + if ((*it)->isSelected() && !(*it)->isMetaItem()) { return *it; } } - if(ground && ground->isSelected() && !ground->isMetaItem()) { + if (ground && ground->isSelected() && !ground->isMetaItem()) { return ground; } return nullptr; } -ItemVector Tile::popSelectedItems(bool ignoreTileSelected) -{ +ItemVector Tile::popSelectedItems(bool ignoreTileSelected) { ItemVector pop_items; - if(!ignoreTileSelected && !isSelected()) return pop_items; + if (!ignoreTileSelected && !isSelected()) { + return pop_items; + } - if(ground && ground->isSelected()) { + if (ground && ground->isSelected()) { pop_items.push_back(ground); ground = nullptr; } - for(auto it = items.begin(); it != items.end();) { + for (auto it = items.begin(); it != items.end();) { Item* item = (*it); - if(item->isSelected()) { + if (item->isSelected()) { pop_items.push_back(item); it = items.erase(it); } else { @@ -369,18 +419,19 @@ ItemVector Tile::popSelectedItems(bool ignoreTileSelected) return pop_items; } -ItemVector Tile::getSelectedItems() -{ +ItemVector Tile::getSelectedItems() { ItemVector selected_items; - if(!isSelected()) return selected_items; + if (!isSelected()) { + return selected_items; + } - if(ground && ground->isSelected()) { + if (ground && ground->isSelected()) { selected_items.push_back(ground); } - for(Item* item : items) { - if(item->isSelected()) { + for (Item* item : items) { + if (item->isSelected()) { selected_items.push_back(item); } } @@ -388,164 +439,160 @@ ItemVector Tile::getSelectedItems() return selected_items; } -uint8_t Tile::getMiniMapColor() const -{ - if(minimapColor != INVALID_MINIMAP_COLOR) +uint8_t Tile::getMiniMapColor() const { + if (minimapColor != INVALID_MINIMAP_COLOR) { return minimapColor; + } - for(auto it = items.rbegin(); it != items.rend(); ++it) { + for (auto it = items.rbegin(); it != items.rend(); ++it) { uint8_t color = (*it)->getMiniMapColor(); - if(color != 0) { + if (color != 0) { return color; } } // check ground too - if(hasGround()) { + if (hasGround()) { return ground->getMiniMapColor(); } return 0; } -void Tile::update() -{ +void Tile::update() { statflags &= TILESTATE_MODIFIED; - if(spawnMonster && spawnMonster->isSelected()) { + if (spawnMonster && spawnMonster->isSelected()) { statflags |= TILESTATE_SELECTED; } - if(spawnNpc && spawnNpc->isSelected()) { + if (spawnNpc && spawnNpc->isSelected()) { statflags |= TILESTATE_SELECTED; } - if(monster && monster->isSelected()) { + if (monster && monster->isSelected()) { statflags |= TILESTATE_SELECTED; } - if(npc && npc->isSelected()) { + if (npc && npc->isSelected()) { statflags |= TILESTATE_SELECTED; } - if(ground) { - if(ground->isSelected()) { + if (ground) { + if (ground->isSelected()) { statflags |= TILESTATE_SELECTED; } - if(ground->isBlocking()) { + if (ground->isBlocking()) { statflags |= TILESTATE_BLOCKING; } - if(ground->getUniqueID() != 0) { + if (ground->getUniqueID() != 0) { statflags |= TILESTATE_UNIQUE; } - if(ground->getMiniMapColor() != 0) { + if (ground->getMiniMapColor() != 0) { minimapColor = ground->getMiniMapColor(); } } - for(const Item* item : items) { - if(item->isSelected()) { + for (const Item* item : items) { + if (item->isSelected()) { statflags |= TILESTATE_SELECTED; } - if(item->getUniqueID() != 0) { + if (item->getUniqueID() != 0) { statflags |= TILESTATE_UNIQUE; } - if(item->getMiniMapColor() != 0) { + if (item->getMiniMapColor() != 0) { minimapColor = item->getMiniMapColor(); } - const ItemType& type = g_items.getItemType(item->getID()); + const ItemType &type = g_items.getItemType(item->getID()); - if(type.unpassable) { + if (type.unpassable) { statflags |= TILESTATE_BLOCKING; } - if(type.isOptionalBorder) { + if (type.isOptionalBorder) { statflags |= TILESTATE_OP_BORDER; } - if(type.isTable) { + if (type.isTable) { statflags |= TILESTATE_HAS_TABLE; } - if(type.isCarpet) { + if (type.isCarpet) { statflags |= TILESTATE_HAS_CARPET; } } - if((statflags & TILESTATE_BLOCKING) == 0) { - if(!ground && items.empty()) { + if ((statflags & TILESTATE_BLOCKING) == 0) { + if (!ground && items.empty()) { statflags |= TILESTATE_BLOCKING; } } } -void Tile::borderize(BaseMap* parent) -{ +void Tile::borderize(BaseMap* parent) { GroundBrush::doBorders(parent, this); } -void Tile::addBorderItem(Item* item) -{ - if(!item) return; +void Tile::addBorderItem(Item* item) { + if (!item) { + return; + } ASSERT(item->isBorder()); items.insert(items.begin(), item); } -GroundBrush* Tile::getGroundBrush() const -{ - if(ground && ground->getGroundBrush()) { +GroundBrush* Tile::getGroundBrush() const { + if (ground && ground->getGroundBrush()) { return ground->getGroundBrush(); } return nullptr; } -void Tile::cleanBorders() -{ - if(items.empty()) return; +void Tile::cleanBorders() { + if (items.empty()) { + return; + } - for(auto it = items.begin(); it != items.end();) { + for (auto it = items.begin(); it != items.end();) { Item* item = (*it); // Borders should only be on the bottom, we can ignore the rest of the items - if(!item->isBorder()) break; + if (!item->isBorder()) { + break; + } delete item; it = items.erase(it); } } -void Tile::wallize(BaseMap* parent) -{ +void Tile::wallize(BaseMap* parent) { WallBrush::doWalls(parent, this); } -Item* Tile::getWall() const -{ - for(Item* item : items) { - if(item->isWall()) { +Item* Tile::getWall() const { + for (Item* item : items) { + if (item->isWall()) { return item; } } return nullptr; } -Item* Tile::getCarpet() const -{ - for(Item* item : items) { - if(item->isCarpet()) { +Item* Tile::getCarpet() const { + for (Item* item : items) { + if (item->isCarpet()) { return item; } } return nullptr; } -Item* Tile::getTable() const -{ - for(Item* item : items) { - if(item->isTable()) { +Item* Tile::getTable() const { + for (Item* item : items) { + if (item->isTable()) { return item; } } return nullptr; } -void Tile::addWallItem(Item* item) -{ - if(!item) { +void Tile::addWallItem(Item* item) { + if (!item) { return; } ASSERT(item->isWall()); @@ -553,30 +600,30 @@ void Tile::addWallItem(Item* item) addItem(item); } -void Tile::cleanWalls(bool dontdelete) -{ - if(items.empty()) return; +void Tile::cleanWalls(bool dontdelete) { + if (items.empty()) { + return; + } - for(auto it = items.begin(); it != items.end();) { + for (auto it = items.begin(); it != items.end();) { Item* item = (*it); - if(item && item->isWall()) { - if(!dontdelete) { + if (item && item->isWall()) { + if (!dontdelete) { delete item; } it = items.erase(it); } else { - ++it; + ++it; } } } -void Tile::cleanWalls(WallBrush* brush) -{ +void Tile::cleanWalls(WallBrush* brush) { ItemVector::iterator it; - for(auto it = items.begin(); it != items.end();) { + for (auto it = items.begin(); it != items.end();) { Item* item = (*it); - if(item && item->isWall() && brush->hasWall(item)) { + if (item && item->isWall() && brush->hasWall(item)) { delete item; it = items.erase(it); } else { @@ -585,14 +632,15 @@ void Tile::cleanWalls(WallBrush* brush) } } -void Tile::cleanTables(bool dontdelete) -{ - if(items.empty()) return; +void Tile::cleanTables(bool dontdelete) { + if (items.empty()) { + return; + } - for(auto it = items.begin(); it != items.end();) { + for (auto it = items.begin(); it != items.end();) { Item* item = (*it); - if(item && item->isTable()) { - if(!dontdelete) { + if (item && item->isTable()) { + if (!dontdelete) { delete item; } it = items.erase(it); @@ -602,79 +650,82 @@ void Tile::cleanTables(bool dontdelete) } } -void Tile::tableize(BaseMap* parent) -{ +void Tile::tableize(BaseMap* parent) { TableBrush::doTables(parent, this); } -void Tile::carpetize(BaseMap* parent) -{ +void Tile::carpetize(BaseMap* parent) { CarpetBrush::doCarpets(parent, this); } -void Tile::selectGround() -{ +void Tile::selectGround() { bool selected = false; - if(ground) { + if (ground) { ground->select(); selected = true; } ItemVector::iterator it; - for(Item* item : items) { - if(!item->isBorder()) + for (Item* item : items) { + if (!item->isBorder()) { break; + } item->select(); selected = true; } - if(selected) statflags |= TILESTATE_SELECTED; + if (selected) { + statflags |= TILESTATE_SELECTED; + } } - -void Tile::deselectGround() -{ - if(ground) { +void Tile::deselectGround() { + if (ground) { ground->deselect(); } - for(Item* item : items) { - if(!item->isBorder()) + for (Item* item : items) { + if (!item->isBorder()) { break; + } item->deselect(); } } -void Tile::setHouse(House* house) -{ +void Tile::setHouse(House* house) { house_id = (house ? house->id : 0); } -void Tile::addHouseExit(House* house) -{ - if(!house) return; +void Tile::addHouseExit(House* house) { + if (!house) { + return; + } HouseExitList* exits = location->createHouseExits(); exits->push_back(house->id); } -void Tile::removeHouseExit(House* house) -{ - if(!house) return; +void Tile::removeHouseExit(House* house) { + if (!house) { + return; + } HouseExitList* exits = location->getHouseExits(); - if(!exits || exits->empty()) return; + if (!exits || exits->empty()) { + return; + } auto it = std::find(exits->begin(), exits->end(), house->id); - if(it != exits->end()) + if (it != exits->end()) { exits->erase(it); + } } -bool Tile::hasHouseExit(uint32_t houseId) const -{ +bool Tile::hasHouseExit(uint32_t houseId) const { const HouseExitList* exits = getHouseExits(); - if(!exits || exits->empty()) + if (!exits || exits->empty()) { return false; + } auto it = std::find(exits->begin(), exits->end(), houseId); return it != exits->end(); diff --git a/source/tile.h b/source/tile.h index 0c627531..92370ffe 100644 --- a/source/tile.h +++ b/source/tile.h @@ -26,29 +26,28 @@ #include enum { - TILESTATE_NONE = 0x0000, + TILESTATE_NONE = 0x0000, TILESTATE_PROTECTIONZONE = 0x0001, - TILESTATE_DEPRECATED = 0x0002, // Reserved - TILESTATE_NOPVP = 0x0004, - TILESTATE_NOLOGOUT = 0x0008, - TILESTATE_PVPZONE = 0x0010, - TILESTATE_REFRESH = 0x0020, + TILESTATE_DEPRECATED = 0x0002, // Reserved + TILESTATE_NOPVP = 0x0004, + TILESTATE_NOLOGOUT = 0x0008, + TILESTATE_PVPZONE = 0x0010, + TILESTATE_REFRESH = 0x0020, // Internal - TILESTATE_SELECTED = 0x0001, - TILESTATE_UNIQUE = 0x0002, - TILESTATE_BLOCKING = 0x0004, + TILESTATE_SELECTED = 0x0001, + TILESTATE_UNIQUE = 0x0002, + TILESTATE_BLOCKING = 0x0004, TILESTATE_OP_BORDER = 0x0008, // If this is true, gravel will be placed on the tile! TILESTATE_HAS_TABLE = 0x0010, - TILESTATE_HAS_CARPET= 0x0020, - TILESTATE_MODIFIED = 0x0040, + TILESTATE_HAS_CARPET = 0x0020, + TILESTATE_MODIFIED = 0x0040, }; enum : uint8_t { INVALID_MINIMAP_COLOR = 0xFF }; -class Tile -{ +class Tile { public: // Members TileLocation* location; Item* ground; @@ -61,51 +60,77 @@ class Tile public: // ALWAYS use this constructor if the Tile is EVER going to be placed on a map - Tile(TileLocation& location); + Tile(TileLocation &location); // Use this when the tile is only used internally by the editor (like in certain brushes) Tile(int x, int y, int z); ~Tile(); // Argument is a the map to allocate the tile from - Tile* deepCopy(BaseMap& map) const; + Tile* deepCopy(BaseMap &map) const; // The location of the tile // Stores state that remains between the tile being moved (like house exits) - void setLocation(TileLocation* where) {location = where;} - TileLocation* getLocation() {return location;} - const TileLocation* getLocation() const {return location;} + void setLocation(TileLocation* where) { + location = where; + } + TileLocation* getLocation() { + return location; + } + const TileLocation* getLocation() const { + return location; + } // Position of the tile - const Position& getPosition() const noexcept { return location->getPosition(); } - int getX() const noexcept { return location->getX(); } - int getY() const noexcept { return location->getY(); } - int getZ() const noexcept { return location->getZ(); } + const Position &getPosition() const noexcept { + return location->getPosition(); + } + int getX() const noexcept { + return location->getX(); + } + int getY() const noexcept { + return location->getY(); + } + int getZ() const noexcept { + return location->getZ(); + } uint16_t getGroundSpeed() const noexcept; - -public: //Functions + +public: // Functions // Absorb the other tile into this tile void merge(Tile* other); // Has tile been modified since the map was loaded/created? - bool isModified() const { return testFlags(statflags, TILESTATE_MODIFIED); } - void modify() { statflags |= TILESTATE_MODIFIED; } - void unmodify() { statflags &= ~TILESTATE_MODIFIED; } + bool isModified() const { + return testFlags(statflags, TILESTATE_MODIFIED); + } + void modify() { + statflags |= TILESTATE_MODIFIED; + } + void unmodify() { + statflags &= ~TILESTATE_MODIFIED; + } // Get memory footprint size uint32_t memsize() const; // Get number of items on the tile - bool empty() const { return size() == 0; } + bool empty() const { + return size() == 0; + } int size() const; // Blocking? - bool isBlocking() const { return testFlags(statflags, TILESTATE_BLOCKING); } + bool isBlocking() const { + return testFlags(statflags, TILESTATE_BLOCKING); + } // PZ - bool isPZ() const { return testFlags(mapflags, TILESTATE_PROTECTIONZONE); } + bool isPZ() const { + return testFlags(mapflags, TILESTATE_PROTECTIONZONE); + } void setPZ(bool pz) { - if(pz) { + if (pz) { mapflags |= TILESTATE_PROTECTIONZONE; } else { mapflags &= ~TILESTATE_PROTECTIONZONE; @@ -125,8 +150,12 @@ class Tile void selectGround(); void deselectGround(); - bool isSelected() const { return testFlags(statflags, TILESTATE_SELECTED); } - bool hasUniqueItem() const { return testFlags(statflags, TILESTATE_UNIQUE); } + bool isSelected() const { + return testFlags(statflags, TILESTATE_SELECTED); + } + bool hasUniqueItem() const { + return testFlags(statflags, TILESTATE_UNIQUE); + } ItemVector popSelectedItems(bool ignoreTileSelected = false); ItemVector getSelectedItems(); @@ -137,8 +166,12 @@ class Tile uint8_t getMiniMapColor() const; - bool hasItems() const noexcept { return ground || !items.empty(); } - bool hasGround() const noexcept { return ground != nullptr; } + bool hasItems() const noexcept { + return ground || !items.empty(); + } + bool hasGround() const noexcept { + return ground != nullptr; + } bool hasBorders() const { return !items.empty() && items.front()->isBorder(); } @@ -155,15 +188,21 @@ class Tile // Borderize this tile void borderize(BaseMap* parent); - bool hasTable() const noexcept { return testFlags(statflags, TILESTATE_HAS_TABLE); } + bool hasTable() const noexcept { + return testFlags(statflags, TILESTATE_HAS_TABLE); + } Item* getTable() const; - bool hasCarpet() const noexcept { return testFlags(statflags, TILESTATE_HAS_CARPET); } + bool hasCarpet() const noexcept { + return testFlags(statflags, TILESTATE_HAS_CARPET); + } Item* getCarpet() const; - bool hasOptionalBorder() const noexcept { return testFlags(statflags, TILESTATE_OP_BORDER); } + bool hasOptionalBorder() const noexcept { + return testFlags(statflags, TILESTATE_OP_BORDER); + } void setOptionalBorder(bool b) { - if(b) { + if (b) { statflags |= TILESTATE_OP_BORDER; } else { statflags &= ~TILESTATE_OP_BORDER; @@ -221,9 +260,9 @@ class Tile private: uint8_t minimapColor; - Tile(const Tile& tile); // No copy - Tile& operator=(const Tile& i);// Can't copy - Tile& operator==(const Tile& i);// Can't compare + Tile(const Tile &tile); // No copy + Tile &operator=(const Tile &i); // Can't copy + Tile &operator==(const Tile &i); // Can't compare }; typedef std::vector TileVector; @@ -238,7 +277,7 @@ inline bool Tile::isHouseTile() const noexcept { return house_id != 0; } -inline uint32_t Tile::getHouseID() const noexcept { +inline uint32_t Tile::getHouseID() const noexcept { return house_id; } diff --git a/source/tileset.cpp b/source/tileset.cpp index 3cb659ed..65581e29 100644 --- a/source/tileset.cpp +++ b/source/tileset.cpp @@ -25,41 +25,38 @@ #include "items.h" #include "raw_brush.h" -Tileset::Tileset(Brushes& brushes, const std::string& name) : +Tileset::Tileset(Brushes &brushes, const std::string &name) : name(name), - brushes(brushes) -{ + brushes(brushes) { //// } -Tileset::~Tileset() -{ - for(TilesetCategoryArray::iterator iter = categories.begin(); iter != categories.end(); ++iter) { +Tileset::~Tileset() { + for (TilesetCategoryArray::iterator iter = categories.begin(); iter != categories.end(); ++iter) { delete *iter; } } -void Tileset::clear() -{ - for(TilesetCategoryArray::iterator iter = categories.begin(); iter != categories.end(); ++iter) { +void Tileset::clear() { + for (TilesetCategoryArray::iterator iter = categories.begin(); iter != categories.end(); ++iter) { (*iter)->brushlist.clear(); } } -bool Tileset::containsBrush(Brush* brush) const -{ - for(TilesetCategoryArray::const_iterator iter = categories.begin(); iter != categories.end(); ++iter) - if((*iter)->containsBrush(brush)) +bool Tileset::containsBrush(Brush* brush) const { + for (TilesetCategoryArray::const_iterator iter = categories.begin(); iter != categories.end(); ++iter) { + if ((*iter)->containsBrush(brush)) { return true; + } + } return false; } -TilesetCategory* Tileset::getCategory(TilesetCategoryType type) -{ +TilesetCategory* Tileset::getCategory(TilesetCategoryType type) { ASSERT(type >= TILESET_UNKNOWN && type <= TILESET_HOUSE); - for(TilesetCategoryArray::iterator iter = categories.begin(); iter != categories.end(); ++iter) { - if((*iter)->getType() == type) { + for (TilesetCategoryArray::iterator iter = categories.begin(); iter != categories.end(); ++iter) { + if ((*iter)->getType() == type) { return *iter; } } @@ -68,68 +65,67 @@ TilesetCategory* Tileset::getCategory(TilesetCategoryType type) return tsc; } -bool TilesetCategory::containsBrush(Brush* brush) const -{ - for(std::vector::const_iterator iter = brushlist.begin(); iter != brushlist.end(); ++iter) - if(*iter == brush) +bool TilesetCategory::containsBrush(Brush* brush) const { + for (std::vector::const_iterator iter = brushlist.begin(); iter != brushlist.end(); ++iter) { + if (*iter == brush) { return true; + } + } return false; } -const TilesetCategory* Tileset::getCategory(TilesetCategoryType type) const -{ +const TilesetCategory* Tileset::getCategory(TilesetCategoryType type) const { ASSERT(type >= TILESET_UNKNOWN && type <= TILESET_HOUSE); - for(TilesetCategoryArray::const_iterator iter = categories.begin(); iter != categories.end(); ++iter) { - if((*iter)->getType() == type) { + for (TilesetCategoryArray::const_iterator iter = categories.begin(); iter != categories.end(); ++iter) { + if ((*iter)->getType() == type) { return *iter; } } return nullptr; } -void Tileset::loadCategory(pugi::xml_node node, wxArrayString &warnings) -{ +void Tileset::loadCategory(pugi::xml_node node, wxArrayString &warnings) { TilesetCategory* category = nullptr; TilesetCategory* subCategory = nullptr; - const std::string& nodeName = as_lower_str(node.name()); - if(nodeName == "terrain") { + const std::string &nodeName = as_lower_str(node.name()); + if (nodeName == "terrain") { category = getCategory(TILESET_TERRAIN); - } else if(nodeName == "doodad") { + } else if (nodeName == "doodad") { category = getCategory(TILESET_DOODAD); - } else if(nodeName == "items") { + } else if (nodeName == "items") { category = getCategory(TILESET_ITEM); - } else if(nodeName == "raw") { + } else if (nodeName == "raw") { category = getCategory(TILESET_RAW); - } else if(nodeName == "terrain_and_raw") { + } else if (nodeName == "terrain_and_raw") { category = getCategory(TILESET_TERRAIN); subCategory = getCategory(TILESET_RAW); - } else if(nodeName == "doodad_and_raw") { + } else if (nodeName == "doodad_and_raw") { category = getCategory(TILESET_DOODAD); subCategory = getCategory(TILESET_RAW); - } else if(nodeName == "items_and_raw") { + } else if (nodeName == "items_and_raw") { category = getCategory(TILESET_ITEM); subCategory = getCategory(TILESET_RAW); - } else if(nodeName == "monsters") { + } else if (nodeName == "monsters") { category = getCategory(TILESET_MONSTER); - for(pugi::xml_node brushNode = node.first_child(); brushNode; brushNode = brushNode.next_sibling()) { - const std::string& brushName = as_lower_str(brushNode.name()); - if(brushName != "monster") { + for (pugi::xml_node brushNode = node.first_child(); brushNode; brushNode = brushNode.next_sibling()) { + const std::string &brushName = as_lower_str(brushNode.name()); + if (brushName != "monster") { continue; } pugi::xml_attribute attribute; - if(!(attribute = brushNode.attribute("name"))) { + if (!(attribute = brushNode.attribute("name"))) { warnings.push_back("Couldn't read monster name tag of monster tileset"); continue; } - const std::string& monsterName = attribute.as_string(); + const std::string &monsterName = attribute.as_string(); MonsterType* ctype = g_monsters[monsterName]; - if(ctype) { + if (ctype) { MonsterBrush* brush; - if(ctype->brush) { + if (ctype->brush) { brush = ctype->brush; } else { brush = ctype->brush = newd MonsterBrush(ctype); @@ -141,25 +137,25 @@ void Tileset::loadCategory(pugi::xml_node node, wxArrayString &warnings) warnings.push_back(wxString("Unknown monster type \"") << wxstr(monsterName) << "\""); } } - } else if(nodeName == "npcs") { + } else if (nodeName == "npcs") { category = getCategory(TILESET_NPC); - for(pugi::xml_node brushNode = node.first_child(); brushNode; brushNode = brushNode.next_sibling()) { - const std::string& brushName = as_lower_str(brushNode.name()); - if(brushName != "npc") { + for (pugi::xml_node brushNode = node.first_child(); brushNode; brushNode = brushNode.next_sibling()) { + const std::string &brushName = as_lower_str(brushNode.name()); + if (brushName != "npc") { continue; } pugi::xml_attribute attribute; - if(!(attribute = brushNode.attribute("name"))) { + if (!(attribute = brushNode.attribute("name"))) { warnings.push_back("Couldn't read npc name tag of npc tileset"); continue; } - const std::string& npcName = attribute.as_string(); + const std::string &npcName = attribute.as_string(); NpcType* npcType = g_npcs[npcName]; - if(npcType) { + if (npcType) { NpcBrush* brush; - if(npcType->brush) { + if (npcType->brush) { brush = npcType->brush; } else { brush = npcType->brush = newd NpcBrush(npcType); @@ -173,13 +169,13 @@ void Tileset::loadCategory(pugi::xml_node node, wxArrayString &warnings) } } - if(!category) { + if (!category) { return; } - for(pugi::xml_node brushNode = node.first_child(); brushNode; brushNode = brushNode.next_sibling()) { + for (pugi::xml_node brushNode = node.first_child(); brushNode; brushNode = brushNode.next_sibling()) { category->loadBrush(brushNode, warnings); - if(subCategory) { + if (subCategory) { subCategory->loadBrush(brushNode, warnings); } } @@ -187,45 +183,42 @@ void Tileset::loadCategory(pugi::xml_node node, wxArrayString &warnings) // -TilesetCategory::TilesetCategory(Tileset& parent, TilesetCategoryType type) : type(type), tileset(parent) -{ +TilesetCategory::TilesetCategory(Tileset &parent, TilesetCategoryType type) : + type(type), tileset(parent) { ASSERT(type >= TILESET_UNKNOWN && type <= TILESET_HOUSE); } -TilesetCategory::~TilesetCategory() -{ +TilesetCategory::~TilesetCategory() { ASSERT(type >= TILESET_UNKNOWN && type <= TILESET_HOUSE); } -bool TilesetCategory::isTrivial() const -{ +bool TilesetCategory::isTrivial() const { return (type == TILESET_ITEM) || (type == TILESET_RAW); } -void TilesetCategory::loadBrush(pugi::xml_node node, wxArrayString& warnings) -{ +void TilesetCategory::loadBrush(pugi::xml_node node, wxArrayString &warnings) { pugi::xml_attribute attribute; std::string brushName = node.attribute("after").as_string(); - if((attribute = node.attribute("afteritem"))) { - const ItemType& type = g_items.getItemType(attribute.as_uint()); - if(type.id != 0) { + if ((attribute = node.attribute("afteritem"))) { + const ItemType &type = g_items.getItemType(attribute.as_uint()); + if (type.id != 0) { brushName = type.raw_brush ? type.raw_brush->getName() : std::string(); } } - const std::string& nodeName = as_lower_str(node.name()); - if(nodeName == "brush") { - if(!(attribute = node.attribute("name"))) { + const std::string &nodeName = as_lower_str(node.name()); + if (nodeName == "brush") { + if (!(attribute = node.attribute("name"))) { return; } Brush* brush = tileset.brushes.getBrush(attribute.as_string()); - if(brush) { + if (brush) { auto insertPosition = brushlist.end(); - if(!brushName.empty()) { - for(auto itt = brushlist.begin(); itt != brushlist.end(); ++itt) { - if((*itt)->getName() == brushName) { + if (!brushName.empty()) { + for (auto itt = brushlist.begin(); itt != brushlist.end(); ++itt) { + if ((*itt)->getName() == brushName) { insertPosition = ++itt; break; } @@ -236,10 +229,10 @@ void TilesetCategory::loadBrush(pugi::xml_node node, wxArrayString& warnings) } else { warnings.push_back("Brush \"" + wxString(attribute.as_string(), wxConvUTF8) + "\" doesn't exist."); } - } else if(nodeName == "item") { + } else if (nodeName == "item") { uint16_t fromId = 0, toId = 0; - if(!(attribute = node.attribute("id"))) { - if(!(attribute = node.attribute("fromid"))) { + if (!(attribute = node.attribute("id"))) { + if (!(attribute = node.attribute("fromid"))) { warnings.push_back("Couldn't read raw ids."); } toId = node.attribute("toid").as_uint(); @@ -249,16 +242,16 @@ void TilesetCategory::loadBrush(pugi::xml_node node, wxArrayString& warnings) toId = std::max(fromId, toId); std::vector tempBrushVector; - for(uint16_t id = fromId; id <= toId; ++id) { + for (uint16_t id = fromId; id <= toId; ++id) { ItemType* type = g_items.getRawItemType(id); - if(!type) { + if (!type) { warnings.push_back(wxString::Format("Brush: %s, From: %d, To: %d", wxstr(brushName), fromId, toId)); warnings.push_back("Unknown item id #" + std::to_string(id) + "."); continue; } RAWBrush* brush; - if(type->raw_brush) { + if (type->raw_brush) { brush = type->raw_brush; } else { brush = type->raw_brush = newd RAWBrush(type->id); @@ -266,7 +259,7 @@ void TilesetCategory::loadBrush(pugi::xml_node node, wxArrayString& warnings) tileset.brushes.addBrush(brush); // This will take care of cleaning up afterwards } - if(type->doodad_brush == nullptr && !isTrivial()) { + if (type->doodad_brush == nullptr && !isTrivial()) { type->doodad_brush = brush; } @@ -275,9 +268,9 @@ void TilesetCategory::loadBrush(pugi::xml_node node, wxArrayString& warnings) } auto insertPosition = brushlist.end(); - if(!brushName.empty()) { - for(auto itt = brushlist.begin(); itt != brushlist.end(); ++itt) { - if((*itt)->getName() == brushName) { + if (!brushName.empty()) { + for (auto itt = brushlist.begin(); itt != brushlist.end(); ++itt) { + if ((*itt)->getName() == brushName) { insertPosition = ++itt; break; } diff --git a/source/tileset.h b/source/tileset.h index 1b23d45a..0afee2a1 100644 --- a/source/tileset.h +++ b/source/tileset.h @@ -34,40 +34,45 @@ enum TilesetCategoryType { class TilesetCategory { public: - TilesetCategory(Tileset& parent, TilesetCategoryType type); + TilesetCategory(Tileset &parent, TilesetCategoryType type); ~TilesetCategory(); bool isTrivial() const; - TilesetCategoryType getType() const {return type;} - size_t size() const {return brushlist.size();} - - void loadBrush(pugi::xml_node node, wxArrayString& warnings); + TilesetCategoryType getType() const { + return type; + } + size_t size() const { + return brushlist.size(); + } + + void loadBrush(pugi::xml_node node, wxArrayString &warnings); void clear(); bool containsBrush(Brush* brush) const; protected: TilesetCategoryType type; + public: std::vector brushlist; - Tileset& tileset; + Tileset &tileset; private: - TilesetCategory(const TilesetCategory&); - TilesetCategory operator=(const TilesetCategory&); + TilesetCategory(const TilesetCategory &); + TilesetCategory operator=(const TilesetCategory &); }; typedef std::vector TilesetCategoryArray; class Tileset { public: - Tileset(Brushes& brushes, const std::string& name); + Tileset(Brushes &brushes, const std::string &name); ~Tileset(); TilesetCategory* getCategory(TilesetCategoryType type); const TilesetCategory* getCategory(TilesetCategoryType type) const; - void loadCategory(pugi::xml_node node, wxArrayString& warnings); + void loadCategory(pugi::xml_node node, wxArrayString &warnings); void clear(); bool containsBrush(Brush* brush) const; @@ -77,11 +82,11 @@ class Tileset { TilesetCategoryArray categories; protected: - Brushes& brushes; + Brushes &brushes; protected: - Tileset(const Tileset&); - Tileset operator=(const Tileset&); + Tileset(const Tileset &); + Tileset operator=(const Tileset &); friend class TilesetCategory; }; diff --git a/source/town.cpp b/source/town.cpp index 59e4b027..dd9169e6 100644 --- a/source/town.cpp +++ b/source/town.cpp @@ -22,67 +22,59 @@ #include "map.h" #include "tile.h" -Towns::Towns() -{ +Towns::Towns() { //// } -Towns::~Towns() -{ +Towns::~Towns() { clear(); } -void Towns::clear() -{ +void Towns::clear() { TownMap::const_iterator it = begin(); - while(it != end()) { + while (it != end()) { delete it->second; ++it; } towns.clear(); } -bool Towns::addTown(Town* town) -{ +bool Towns::addTown(Town* town) { TownMap::iterator it = find(town->getID()); - if(it != end()) { + if (it != end()) { return false; } towns[town->getID()] = town; return true; } -uint32_t Towns::getEmptyID() -{ +uint32_t Towns::getEmptyID() { uint32_t empty = 0; - for(TownMap::iterator it = begin(); it != end(); ++it) { - if(it->second->getID() > empty) { + for (TownMap::iterator it = begin(); it != end(); ++it) { + if (it->second->getID() > empty) { empty = it->second->getID(); } } return empty + 1; } -Town* Towns::getTown(std::string& name) -{ - for(TownMap::iterator it = begin(); it != end(); ++it) { - if(it->second->getName() == name) { +Town* Towns::getTown(std::string &name) { + for (TownMap::iterator it = begin(); it != end(); ++it) { + if (it->second->getName() == name) { return it->second; } } return nullptr; } -Town* Towns::getTown(uint32_t id) -{ +Town* Towns::getTown(uint32_t id) { TownMap::iterator it = find(id); - if(it != end()) { + if (it != end()) { return it->second; } return nullptr; } -void Town::setTemplePosition(const Position& position) -{ +void Town::setTemplePosition(const Position &position) { templepos = position; } diff --git a/source/town.h b/source/town.h index dac10b31..82c14e76 100644 --- a/source/town.h +++ b/source/town.h @@ -20,20 +20,31 @@ #include "position.h" -class Town -{ +class Town { public: - Town(uint32_t _id) : id(_id), name("") {} - Town(const Town& copy) : id(copy.id), name(copy.name), templepos(copy.templepos) {} - - const std::string& getName() const noexcept { return name; } - void setName(const std::string& _name) noexcept { name = _name; } - - const Position& getTemplePosition() const noexcept { return templepos; } - void setTemplePosition(const Position& position); - - uint32_t getID() const noexcept { return id; } - void setID(uint32_t _id) noexcept { id = _id; } + Town(uint32_t _id) : + id(_id), name("") { } + Town(const Town ©) : + id(copy.id), name(copy.name), templepos(copy.templepos) { } + + const std::string &getName() const noexcept { + return name; + } + void setName(const std::string &_name) noexcept { + name = _name; + } + + const Position &getTemplePosition() const noexcept { + return templepos; + } + void setTemplePosition(const Position &position); + + uint32_t getID() const noexcept { + return id; + } + void setID(uint32_t _id) noexcept { + id = _id; + } private: uint32_t id; @@ -43,8 +54,7 @@ class Town typedef std::map TownMap; -class Towns -{ +class Towns { public: Towns(); ~Towns(); @@ -52,24 +62,42 @@ class Towns // Clears the townmap void clear(); - uint32_t count() const noexcept { return towns.size(); } + uint32_t count() const noexcept { + return towns.size(); + } bool addTown(Town* town); uint32_t getEmptyID(); - Town* getTown(std::string& townname); + Town* getTown(std::string &townname); Town* getTown(uint32_t _townid); - TownMap::const_iterator begin() const noexcept { return towns.begin(); } - TownMap::const_iterator end() const noexcept { return towns.end(); } - TownMap::const_iterator find(uint32_t id) const { return towns.find(id); } - TownMap::iterator begin() noexcept { return towns.begin(); } - TownMap::iterator end() noexcept { return towns.end(); } - TownMap::iterator find(uint32_t id) { return towns.find(id); } + TownMap::const_iterator begin() const noexcept { + return towns.begin(); + } + TownMap::const_iterator end() const noexcept { + return towns.end(); + } + TownMap::const_iterator find(uint32_t id) const { + return towns.find(id); + } + TownMap::iterator begin() noexcept { + return towns.begin(); + } + TownMap::iterator end() noexcept { + return towns.end(); + } + TownMap::iterator find(uint32_t id) { + return towns.find(id); + } #ifdef __VISUALC__ // C++0x compliance to some degree :) - TownMap::iterator erase(TownMap::iterator iter) noexcept { return towns.erase(iter); } + TownMap::iterator erase(TownMap::iterator iter) noexcept { + return towns.erase(iter); + } #else - void erase(TownMap::iterator iter) {towns.erase(iter);} + void erase(TownMap::iterator iter) { + towns.erase(iter); + } #endif private: diff --git a/source/updater.cpp b/source/updater.cpp index 42ef4afd..2062c6d2 100644 --- a/source/updater.cpp +++ b/source/updater.cpp @@ -19,35 +19,33 @@ #ifdef _USE_UPDATER_ -#include "updater.h" + #include "updater.h" const wxEventType EVT_UPDATE_CHECK_FINISHED = wxNewEventType(); -UpdateChecker::UpdateChecker() -{ +UpdateChecker::UpdateChecker() { //// } -UpdateChecker::~UpdateChecker() -{ +UpdateChecker::~UpdateChecker() { //// } -void UpdateChecker::connect(wxEvtHandler* receiver) -{ +void UpdateChecker::connect(wxEvtHandler* receiver) { wxString address = "http://www.remeresmapeditor.com/update.php"; - address << "?os=" << -#ifdef __WINDOWS__ - "windows"; -#elif __LINUX__ - "linux"; -#else - "unknown"; -#endif + address << "?os=" + << + #ifdef __WINDOWS__ + "windows"; + #elif __LINUX__ + "linux"; + #else + "unknown"; + #endif address << "&verid=" << __RME_VERSION_ID__; -#ifdef __EXPERIMENTAL__ + #ifdef __EXPERIMENTAL__ address << "&beta"; -#endif + #endif wxURL* url = newd wxURL(address); UpdateConnectionThread* connection = newd UpdateConnectionThread(receiver, url); connection->Execute(); @@ -55,27 +53,24 @@ void UpdateChecker::connect(wxEvtHandler* receiver) UpdateConnectionThread::UpdateConnectionThread(wxEvtHandler* receiver, wxURL* url) : receiver(receiver), - url(url) -{ + url(url) { //// } -UpdateConnectionThread::~UpdateConnectionThread() -{ +UpdateConnectionThread::~UpdateConnectionThread() { //// } -wxThread::ExitCode UpdateConnectionThread::Entry() -{ +wxThread::ExitCode UpdateConnectionThread::Entry() { wxInputStream* input = url->GetInputStream(); - if(!input) { + if (!input) { delete input; delete url; return 0; } std::string data; - while(!input->Eof()) { + while (!input->Eof()) { data += input->GetC(); } @@ -83,7 +78,9 @@ wxThread::ExitCode UpdateConnectionThread::Entry() delete url; wxCommandEvent event(EVT_UPDATE_CHECK_FINISHED); event.SetClientData(newd std::string(data)); - if(receiver) receiver->AddPendingEvent(event); + if (receiver) { + receiver->AddPendingEvent(event); + } return 0; } diff --git a/source/updater.h b/source/updater.h index 2378ef3d..396ee80b 100644 --- a/source/updater.h +++ b/source/updater.h @@ -17,20 +17,19 @@ #ifdef _USE_UPDATER_ -#ifndef RME_UPDATER_H_ -#define RME_UPDATER_H_ + #ifndef RME_UPDATER_H_ + #define RME_UPDATER_H_ -#include "threads.h" + #include "threads.h" extern const wxEventType EVT_UPDATE_CHECK_FINISHED; -#define EVT_ON_UPDATE_CHECK_FINISHED(id, fn) \ - DECLARE_EVENT_TABLE_ENTRY( \ - EVT_UPDATE_CHECK_FINISHED, id, wxID_ANY, \ - (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, &fn ), \ - (wxObject *) nullptr \ - ), - + #define EVT_ON_UPDATE_CHECK_FINISHED(id, fn) \ + DECLARE_EVENT_TABLE_ENTRY( \ + EVT_UPDATE_CHECK_FINISHED, id, wxID_ANY, \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCommandEventFunction, &fn), \ + (wxObject*)nullptr \ + ), class wxURL; @@ -38,6 +37,7 @@ class UpdateConnectionThread : public DetachedThread { public: UpdateConnectionThread(wxEvtHandler* receiver, wxURL* url); virtual ~UpdateConnectionThread(); + protected: virtual ExitCode Entry(); wxEvtHandler* receiver; @@ -52,7 +52,6 @@ class UpdateChecker { void connect(wxEvtHandler* receiver); }; -#endif + #endif #endif - diff --git a/source/wall_brush.cpp b/source/wall_brush.cpp index 85fb463d..e675a866 100644 --- a/source/wall_brush.cpp +++ b/source/wall_brush.cpp @@ -25,92 +25,89 @@ uint32_t WallBrush::full_border_types[16]; uint32_t WallBrush::half_border_types[16]; WallBrush::WallBrush() : - redirect_to(nullptr) -{ + redirect_to(nullptr) { //// } -WallBrush::~WallBrush() -{ +WallBrush::~WallBrush() { //// } -bool WallBrush::load(pugi::xml_node node, wxArrayString& warnings) -{ +bool WallBrush::load(pugi::xml_node node, wxArrayString &warnings) { pugi::xml_attribute attribute; - if((attribute = node.attribute("lookid"))) { + if ((attribute = node.attribute("lookid"))) { look_id = attribute.as_uint(); } - if((attribute = node.attribute("server_lookid"))) { + if ((attribute = node.attribute("server_lookid"))) { look_id = g_items.getItemType(attribute.as_uint()).clientID; } - for(pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { - const std::string& childName = as_lower_str(childNode.name()); - if(childName == "wall") { - const std::string& typeString = childNode.attribute("type").as_string(); - if(typeString.empty()) { + for (pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) { + const std::string &childName = as_lower_str(childNode.name()); + if (childName == "wall") { + const std::string &typeString = childNode.attribute("type").as_string(); + if (typeString.empty()) { warnings.push_back("Could not read type tag of wall node\n"); continue; } uint32_t alignment; - if(typeString == "vertical") { + if (typeString == "vertical") { alignment = WALL_VERTICAL; - } else if(typeString == "horizontal") { + } else if (typeString == "horizontal") { alignment = WALL_HORIZONTAL; - } else if(typeString == "corner") { + } else if (typeString == "corner") { alignment = WALL_NORTHWEST_DIAGONAL; - } else if(typeString == "pole") { + } else if (typeString == "pole") { alignment = WALL_POLE; - } else if(typeString == "south end") { + } else if (typeString == "south end") { alignment = WALL_SOUTH_END; - } else if(typeString == "east end") { + } else if (typeString == "east end") { alignment = WALL_EAST_END; - } else if(typeString == "north end") { + } else if (typeString == "north end") { alignment = WALL_NORTH_END; - } else if(typeString == "west end") { + } else if (typeString == "west end") { alignment = WALL_WEST_END; - } else if(typeString == "south T") { + } else if (typeString == "south T") { alignment = WALL_SOUTH_T; - } else if(typeString == "east T") { + } else if (typeString == "east T") { alignment = WALL_EAST_T; - } else if(typeString == "west T") { + } else if (typeString == "west T") { alignment = WALL_WEST_T; - } else if(typeString == "north T") { + } else if (typeString == "north T") { alignment = WALL_NORTH_T; - } else if(typeString == "northwest diagonal") { + } else if (typeString == "northwest diagonal") { alignment = WALL_NORTHWEST_DIAGONAL; - } else if(typeString == "northeast diagonal") { + } else if (typeString == "northeast diagonal") { alignment = WALL_NORTHEAST_DIAGONAL; - } else if(typeString == "southwest diagonal") { + } else if (typeString == "southwest diagonal") { alignment = WALL_SOUTHWEST_DIAGONAL; - } else if(typeString == "southeast diagonal") { + } else if (typeString == "southeast diagonal") { alignment = WALL_SOUTHEAST_DIAGONAL; - } else if(typeString == "intersection") { + } else if (typeString == "intersection") { alignment = WALL_INTERSECTION; - } else if(typeString == "untouchable") { + } else if (typeString == "untouchable") { alignment = WALL_UNTOUCHABLE; } else { warnings.push_back("Unknown wall alignment '" + wxstr(typeString) + "'\n"); continue; } - for(pugi::xml_node subChildNode = childNode.first_child(); subChildNode; subChildNode = subChildNode.next_sibling()) { - const std::string& subChildName = as_lower_str(subChildNode.name()); - if(subChildName == "item") { + for (pugi::xml_node subChildNode = childNode.first_child(); subChildNode; subChildNode = subChildNode.next_sibling()) { + const std::string &subChildName = as_lower_str(subChildNode.name()); + if (subChildName == "item") { uint16_t id = subChildNode.attribute("id").as_uint(); - if(id == 0) { + if (id == 0) { warnings.push_back("Could not read id tag of item node\n"); break; } ItemType* type = g_items.getRawItemType(id); - if(!type) { + if (!type) { warnings.push_back("There is no itemtype with id " + std::to_string(id)); return false; - } else if(type->brush && type->brush != this) { + } else if (type->brush && type->brush != this) { warnings.push_back("Itemtype id " + std::to_string(id) + " already has a brush"); return false; } @@ -126,36 +123,36 @@ bool WallBrush::load(pugi::xml_node node, wxArrayString& warnings) wt.chance = wall_items[alignment].total_chance; wall_items[alignment].items.push_back(wt); - } else if(subChildName == "door") { + } else if (subChildName == "door") { uint16_t id = subChildNode.attribute("id").as_uint(); - if(id == 0) { + if (id == 0) { warnings.push_back("Could not read id tag of door node\n"); break; } std::string nodetype = subChildNode.attribute("type").as_string(); - if(nodetype.empty()) { + if (nodetype.empty()) { warnings.push_back("Could not read type tag of door node\n"); continue; } bool isOpen; pugi::xml_attribute openAttribute = subChildNode.attribute("open"); - if(openAttribute) { + if (openAttribute) { isOpen = openAttribute.as_bool(); } else { isOpen = true; - if(nodetype != "window" && nodetype != "any window" && nodetype != "hatch window") { + if (nodetype != "window" && nodetype != "any window" && nodetype != "hatch window") { warnings.push_back("Could not read open tag of door node\n"); break; } } ItemType* type = g_items.getRawItemType(id); - if(!type) { + if (!type) { warnings.push_back("There is no itemtype with id " + std::to_string(id)); return false; - } else if(type->brush && type->brush != this) { + } else if (type->brush && type->brush != this) { warnings.push_back("Itemtype id " + std::to_string(id) + " already has a brush"); return false; } @@ -170,25 +167,25 @@ bool WallBrush::load(pugi::xml_node node, wxArrayString& warnings) DoorType dt; bool all_windows = false; bool all_doors = false; - if(nodetype == "normal") { + if (nodetype == "normal") { dt.type = WALL_DOOR_NORMAL; - } else if(nodetype == "locked") { + } else if (nodetype == "locked") { dt.type = WALL_DOOR_LOCKED; - } else if(nodetype == "quest") { + } else if (nodetype == "quest") { dt.type = WALL_DOOR_QUEST; - } else if(nodetype == "magic") { + } else if (nodetype == "magic") { dt.type = WALL_DOOR_MAGIC; - } else if(nodetype == "archway") { + } else if (nodetype == "archway") { dt.type = WALL_ARCHWAY; - } else if(nodetype == "window") { + } else if (nodetype == "window") { dt.type = WALL_WINDOW; - } else if(nodetype == "hatch_window" || nodetype == "hatch window") { + } else if (nodetype == "hatch_window" || nodetype == "hatch window") { dt.type = WALL_HATCH_WINDOW; - } else if(nodetype == "any door") { + } else if (nodetype == "any door") { all_doors = true; - } else if(nodetype == "any window") { + } else if (nodetype == "any window") { all_windows = true; - } else if(nodetype == "any") { + } else if (nodetype == "any") { all_windows = true; all_doors = true; } else { @@ -197,48 +194,55 @@ bool WallBrush::load(pugi::xml_node node, wxArrayString& warnings) } dt.id = id; - if(all_windows) { - dt.type = WALL_WINDOW; door_items[alignment].push_back(dt); - dt.type = WALL_HATCH_WINDOW; door_items[alignment].push_back(dt); + if (all_windows) { + dt.type = WALL_WINDOW; + door_items[alignment].push_back(dt); + dt.type = WALL_HATCH_WINDOW; + door_items[alignment].push_back(dt); } - if(all_doors) { - dt.type = WALL_ARCHWAY; door_items[alignment].push_back(dt); - dt.type = WALL_DOOR_NORMAL; door_items[alignment].push_back(dt); - dt.type = WALL_DOOR_LOCKED; door_items[alignment].push_back(dt); - dt.type = WALL_DOOR_QUEST; door_items[alignment].push_back(dt); - dt.type = WALL_DOOR_MAGIC; door_items[alignment].push_back(dt); + if (all_doors) { + dt.type = WALL_ARCHWAY; + door_items[alignment].push_back(dt); + dt.type = WALL_DOOR_NORMAL; + door_items[alignment].push_back(dt); + dt.type = WALL_DOOR_LOCKED; + door_items[alignment].push_back(dt); + dt.type = WALL_DOOR_QUEST; + door_items[alignment].push_back(dt); + dt.type = WALL_DOOR_MAGIC; + door_items[alignment].push_back(dt); } - if(!all_doors && !all_windows) { + if (!all_doors && !all_windows) { door_items[alignment].push_back(dt); } } } - } else if(childName == "friend") { - const std::string& name = childNode.attribute("name").as_string(); - if(name.empty()) { + } else if (childName == "friend") { + const std::string &name = childNode.attribute("name").as_string(); + if (name.empty()) { continue; } - if(name == "all") { - //friends.push_back(-1); + if (name == "all") { + // friends.push_back(-1); } else { Brush* brush = g_brushes.getBrush(name); - if(brush) { + if (brush) { friends.push_back(brush->getID()); } else { warnings.push_back("Brush '" + wxstr(name) + "' is not defined."); continue; } - if(childNode.attribute("redirect").as_bool()) { + if (childNode.attribute("redirect").as_bool()) { if (!brush->isWall()) { warnings.push_back("Wall brush redirect link: '" + wxstr(name) + "' is not a wall brush."); - } else if(!redirect_to) { + } else if (!redirect_to) { redirect_to = brush->asWall(); } else { - warnings.push_back( "Wall brush '" + wxstr(getName()) + "' has more than one redirect link."); + warnings.push_back("Wall brush '" + wxstr(getName()) + "' has more than one redirect link."); } } } @@ -247,54 +251,58 @@ bool WallBrush::load(pugi::xml_node node, wxArrayString& warnings) return true; } -void WallBrush::undraw(BaseMap* map, Tile* tile) -{ +void WallBrush::undraw(BaseMap* map, Tile* tile) { tile->cleanWalls(this); } -void WallBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void WallBrush::draw(BaseMap* map, Tile* tile, void* parameter) { ASSERT(tile); - bool b = (parameter? *reinterpret_cast(parameter) : false); - if(b) { + bool b = (parameter ? *reinterpret_cast(parameter) : false); + if (b) { // Find a matching wall item on this tile, and shift the id - for(ItemVector::iterator item_iter = tile->items.begin(); item_iter != tile->items.end(); ++item_iter) { + for (ItemVector::iterator item_iter = tile->items.begin(); item_iter != tile->items.end(); ++item_iter) { Item* item = *item_iter; - if(item->isWall()) { + if (item->isWall()) { WallBrush* wb = item->getWallBrush(); - if(wb == this) { + if (wb == this) { // Ok, shift alignment BorderType alignment = item->getWallAlignment(); uint16_t id = 0; WallBrush* try_brush = this; - while(true) { - if(id != 0) break; - if(try_brush == nullptr) return; - - for(int i = alignment + 1; i != alignment; ++i) { - if(i == 16) i = 0; - WallNode& wn = try_brush->wall_items[i]; - if(wn.total_chance <= 0) { + while (true) { + if (id != 0) { + break; + } + if (try_brush == nullptr) { + return; + } + + for (int i = alignment + 1; i != alignment; ++i) { + if (i == 16) { + i = 0; + } + WallNode &wn = try_brush->wall_items[i]; + if (wn.total_chance <= 0) { continue; } int chance = random(1, wn.total_chance); - for(std::vector::const_iterator it = wn.items.begin(); it != wn.items.end(); ++it) { - if(chance <= it->chance) { + for (std::vector::const_iterator it = wn.items.begin(); it != wn.items.end(); ++it) { + if (chance <= it->chance) { id = it->id; break; } } - if(id != 0) { + if (id != 0) { break; } } try_brush = try_brush->redirect_to; - if(try_brush == this) { + if (try_brush == this) { break; } } - if(id != 0) { + if (id != 0) { item->setID(id); } return; @@ -309,29 +317,33 @@ void WallBrush::draw(BaseMap* map, Tile* tile, void* parameter) uint16_t id = 0; WallBrush* try_brush = this; - while(true) { - if(id != 0) break; - if(try_brush == nullptr) return; + while (true) { + if (id != 0) { + break; + } + if (try_brush == nullptr) { + return; + } - for(int i = 0; i < 16; ++i) { - WallNode& wn = try_brush->wall_items[i]; - if(wn.total_chance <= 0) { + for (int i = 0; i < 16; ++i) { + WallNode &wn = try_brush->wall_items[i]; + if (wn.total_chance <= 0) { continue; } int chance = random(1, wn.total_chance); - for(std::vector::const_iterator it = wn.items.begin(); it != wn.items.end(); ++it) { - if(chance <= it->chance) { + for (std::vector::const_iterator it = wn.items.begin(); it != wn.items.end(); ++it) { + if (chance <= it->chance) { id = it->id; break; } } - if(id != 0) { + if (id != 0) { break; } } try_brush = try_brush->redirect_to; - if(try_brush == this) { + if (try_brush == this) { break; } } @@ -339,19 +351,20 @@ void WallBrush::draw(BaseMap* map, Tile* tile, void* parameter) tile->addWallItem(Item::Create(id)); } -bool hasMatchingWallBrushAtTile(BaseMap* map, WallBrush* wall_brush, uint32_t x, uint32_t y, uint32_t z) -{ +bool hasMatchingWallBrushAtTile(BaseMap* map, WallBrush* wall_brush, uint32_t x, uint32_t y, uint32_t z) { Tile* t = map->getTile(x, y, z); - if(!t) return false; + if (!t) { + return false; + } ItemVector::const_iterator it = t->items.begin(); - for(; it != t->items.end(); ++it) { + for (; it != t->items.end(); ++it) { Item* item = *it; - if(item->isWall()) { + if (item->isWall()) { WallBrush* wb = item->getWallBrush(); - if(wb == wall_brush) { + if (wb == wall_brush) { return !g_items.getItemType(item->getID()).wall_hate_me; - } else if(wall_brush->friendOf(wb) || wb->friendOf(wall_brush)) { + } else if (wall_brush->friendOf(wb) || wb->friendOf(wall_brush)) { return !g_items.getItemType(item->getID()).wall_hate_me; } } @@ -360,8 +373,7 @@ bool hasMatchingWallBrushAtTile(BaseMap* map, WallBrush* wall_brush, uint32_t x, return false; } -void WallBrush::doWalls(BaseMap* map, Tile* tile) -{ +void WallBrush::doWalls(BaseMap* map, Tile* tile) { ASSERT(tile); // For quicker reference @@ -371,86 +383,87 @@ void WallBrush::doWalls(BaseMap* map, Tile* tile) // Advance the vector to the beginning of the walls ItemVector::iterator it = tile->items.begin(); - for(; it != tile->items.end() && (*it)->isBorder(); ++it); + for (; it != tile->items.end() && (*it)->isBorder(); ++it) + ; ItemVector items_to_add; - while(it != tile->items.end()) { + while (it != tile->items.end()) { Item* wall = *it; - if(!wall->isWall()) { + if (!wall->isWall()) { ++it; continue; } WallBrush* wall_brush = wall->getWallBrush(); // Skip if either the wall has no brush - if(!wall_brush) { + if (!wall_brush) { ++it; continue; } // or if it's a decoration brush. - if(wall_brush->isWallDecoration()) { + if (wall_brush->isWallDecoration()) { items_to_add.push_back(wall); it = tile->items.erase(it); continue; } bool neighbours[4]; - if(x == 0) { - if(y == 0) { + if (x == 0) { + if (y == 0) { neighbours[0] = false; neighbours[1] = false; neighbours[2] = hasMatchingWallBrushAtTile(map, wall_brush, x + 1, y, z); - neighbours[3] = hasMatchingWallBrushAtTile(map, wall_brush, x, y + 1, z); + neighbours[3] = hasMatchingWallBrushAtTile(map, wall_brush, x, y + 1, z); } else { - neighbours[0] = hasMatchingWallBrushAtTile(map, wall_brush, x, y - 1, z); + neighbours[0] = hasMatchingWallBrushAtTile(map, wall_brush, x, y - 1, z); neighbours[1] = false; neighbours[2] = hasMatchingWallBrushAtTile(map, wall_brush, x + 1, y, z); - neighbours[3] = hasMatchingWallBrushAtTile(map, wall_brush, x, y + 1, z); + neighbours[3] = hasMatchingWallBrushAtTile(map, wall_brush, x, y + 1, z); } - } else if(y == 0) { + } else if (y == 0) { neighbours[0] = false; neighbours[1] = hasMatchingWallBrushAtTile(map, wall_brush, x - 1, y, z); neighbours[2] = hasMatchingWallBrushAtTile(map, wall_brush, x + 1, y, z); - neighbours[3] = hasMatchingWallBrushAtTile(map, wall_brush, x, y + 1, z); + neighbours[3] = hasMatchingWallBrushAtTile(map, wall_brush, x, y + 1, z); } else { - neighbours[0] = hasMatchingWallBrushAtTile(map, wall_brush, x, y - 1, z); + neighbours[0] = hasMatchingWallBrushAtTile(map, wall_brush, x, y - 1, z); neighbours[1] = hasMatchingWallBrushAtTile(map, wall_brush, x - 1, y, z); neighbours[2] = hasMatchingWallBrushAtTile(map, wall_brush, x + 1, y, z); - neighbours[3] = hasMatchingWallBrushAtTile(map, wall_brush, x, y + 1, z); + neighbours[3] = hasMatchingWallBrushAtTile(map, wall_brush, x, y + 1, z); } uint32_t tiledata = 0; - for(int i = 0; i < 4; i++) { - if(neighbours[i]) { + for (int i = 0; i < 4; i++) { + if (neighbours[i]) { // Same wall as this one, calculate what border tiledata |= 1 << i; } } bool exit = false; - for(int i = 0; i < 2; ++i) { // Repeat twice - if(exit) { + for (int i = 0; i < 2; ++i) { // Repeat twice + if (exit) { break; } ::BorderType bt; - if(i == 0) { + if (i == 0) { bt = ::BorderType(full_border_types[tiledata]); } else { bt = ::BorderType(half_border_types[tiledata]); } - if(wall->getWallAlignment() == WALL_UNTOUCHABLE) { + if (wall->getWallAlignment() == WALL_UNTOUCHABLE) { items_to_add.push_back(wall); it = tile->items.erase(it); exit = true; - } else if(wall->getWallAlignment() == bt) { + } else if (wall->getWallAlignment() == bt) { // Do nothing, the tile already has a wall like this // However, wall decorations associated with this wall might need to change... items_to_add.push_back(wall); it = tile->items.erase(it); exit = true; - while(it != tile->items.end()) { + while (it != tile->items.end()) { // If we have a decoration ontop of us, we need to change it's alignment aswell! Item* wall_decoration = *it; @@ -458,7 +471,7 @@ void WallBrush::doWalls(BaseMap* map, Tile* tile) WallBrush* brush = wall_decoration->getWallBrush(); if (brush && brush->isWallDecoration()) { // We don't know if we have changed alignment - if(wall_decoration->getWallAlignment() == bt) { + if (wall_decoration->getWallAlignment() == bt) { // Same, no need to change... items_to_add.push_back(wall_decoration); it = tile->items.erase(it); @@ -466,9 +479,9 @@ void WallBrush::doWalls(BaseMap* map, Tile* tile) } // Not the same alignment, create newd item with correct alignment uint16_t id = 0; - WallNode& wn = brush->wall_items[int(bt)]; - if(wn.total_chance <= 0) { - if(wn.items.size() == 0) { + WallNode &wn = brush->wall_items[int(bt)]; + if (wn.total_chance <= 0) { + if (wn.items.size() == 0) { ++it; continue; } else { @@ -476,19 +489,18 @@ void WallBrush::doWalls(BaseMap* map, Tile* tile) } } else { int chance = random(1, wn.total_chance); - for(std::vector::const_iterator witer = wn.items.begin(); - witer != wn.items.end(); - ++witer) - { - if(chance <= witer->chance) { + for (std::vector::const_iterator witer = wn.items.begin(); + witer != wn.items.end(); + ++witer) { + if (chance <= witer->chance) { id = witer->id; break; } } } - if(id != 0) { + if (id != 0) { Item* new_wall = Item::Create(id); - if(wall_decoration->isSelected()) { + if (wall_decoration->isSelected()) { new_wall->select(); } items_to_add.push_back(new_wall); @@ -503,25 +515,31 @@ void WallBrush::doWalls(BaseMap* map, Tile* tile) uint16_t id = 0; WallBrush* try_brush = wall_brush; - while(true) { - if(try_brush == nullptr) break; - if(id != 0) break; + while (true) { + if (try_brush == nullptr) { + break; + } + if (id != 0) { + break; + } - WallNode& wn = try_brush->wall_items[int(bt)]; - if(wn.total_chance <= 0) { - if(wn.items.size() == 0) { + WallNode &wn = try_brush->wall_items[int(bt)]; + if (wn.total_chance <= 0) { + if (wn.items.size() == 0) { try_brush = try_brush->redirect_to; - if(try_brush == wall_brush) break; // To prevent infinite loop + if (try_brush == wall_brush) { + break; // To prevent infinite loop + } continue; } else { id = wn.items.front().id; } } else { int chance = random(1, wn.total_chance); - for(std::vector::const_iterator node_iter = wn.items.begin(); - node_iter != wn.items.end(); - ++node_iter) { - if(chance <= node_iter->chance) { + for (std::vector::const_iterator node_iter = wn.items.begin(); + node_iter != wn.items.end(); + ++node_iter) { + if (chance <= node_iter->chance) { id = node_iter->id; break; } @@ -529,17 +547,19 @@ void WallBrush::doWalls(BaseMap* map, Tile* tile) } // Propagate down the chain try_brush = try_brush->redirect_to; - if(try_brush == wall_brush) break; // To prevent infinite loop + if (try_brush == wall_brush) { + break; // To prevent infinite loop + } } - if(try_brush == nullptr && id == 0) { - if(i == 1) { + if (try_brush == nullptr && id == 0) { + if (i == 1) { ++it; } continue; } else { // If there is such an item, add it to the tile Item* new_wall = Item::Create(id); - if(wall->isSelected()) { + if (wall->isSelected()) { new_wall->select(); } items_to_add.push_back(new_wall); @@ -548,16 +568,16 @@ void WallBrush::doWalls(BaseMap* map, Tile* tile) } // Increment and check for end - while(it != tile->items.end()) { + while (it != tile->items.end()) { // If we have a decoration ontop of us, we need to change it's alignment aswell! Item* wall_decoration = *it; WallBrush* brush = wall_decoration->getWallBrush(); - if(brush && brush->isWallDecoration()) { + if (brush && brush->isWallDecoration()) { // We know we have changed alignment, so no need to check for it again. uint16_t id = 0; - WallNode& wn = brush->wall_items[int(bt)]; - if(wn.total_chance <= 0) { - if(wn.items.size() == 0) { + WallNode &wn = brush->wall_items[int(bt)]; + if (wn.total_chance <= 0) { + if (wn.items.size() == 0) { ++it; continue; } else { @@ -565,19 +585,18 @@ void WallBrush::doWalls(BaseMap* map, Tile* tile) } } else { int chance = random(1, wn.total_chance); - for(std::vector::const_iterator node_iter = wn.items.begin(); - node_iter != wn.items.end(); - ++node_iter) - { - if(chance <= node_iter->chance) { + for (std::vector::const_iterator node_iter = wn.items.begin(); + node_iter != wn.items.end(); + ++node_iter) { + if (chance <= node_iter->chance) { id = node_iter->id; break; } } } - if(id != 0) { + if (id != 0) { Item* new_wall = Item::Create(id); - if(wall_decoration->isSelected()) { + if (wall_decoration->isSelected()) { new_wall->select(); } items_to_add.push_back(new_wall); @@ -592,41 +611,41 @@ void WallBrush::doWalls(BaseMap* map, Tile* tile) } } tile->cleanWalls(); - for(ItemVector::const_iterator it = items_to_add.begin(); it != items_to_add.end(); ++it) { + for (ItemVector::const_iterator it = items_to_add.begin(); it != items_to_add.end(); ++it) { tile->addWallItem(*it); } } -bool WallBrush::hasWall(Item* item) -{ +bool WallBrush::hasWall(Item* item) { ASSERT(item->isWall()); ::BorderType bt = item->getWallAlignment(); WallBrush* test_wall = this; - while(test_wall != nullptr) { - for(std::vector::const_iterator it = test_wall->wall_items[int(bt)].items.begin(); it != test_wall->wall_items[int(bt)].items.end(); ++it) { - if(it->id == item->getID()) { + while (test_wall != nullptr) { + for (std::vector::const_iterator it = test_wall->wall_items[int(bt)].items.begin(); it != test_wall->wall_items[int(bt)].items.end(); ++it) { + if (it->id == item->getID()) { return true; } } - for(std::vector::const_iterator it = test_wall->door_items[int(bt)].begin(); it != test_wall->door_items[int(bt)].end(); ++it) { - if(it->id == item->getID()) { + for (std::vector::const_iterator it = test_wall->door_items[int(bt)].begin(); it != test_wall->door_items[int(bt)].end(); ++it) { + if (it->id == item->getID()) { return true; } } test_wall = test_wall->redirect_to; - if(test_wall == this) return false; // Prevent infinite loop + if (test_wall == this) { + return false; // Prevent infinite loop + } } return false; } -::DoorType WallBrush::getDoorTypeFromID(uint16_t id) -{ - for(int index = 0; index < 16; ++index) { - for(std::vector::const_iterator iter = door_items[index].begin(); iter != door_items[index].end(); ++iter) { - if(iter->id == id) { +::DoorType WallBrush::getDoorTypeFromID(uint16_t id) { + for (int index = 0; index < 16; ++index) { + for (std::vector::const_iterator iter = door_items[index].begin(); iter != door_items[index].end(); ++iter) { + if (iter->id == id) { return iter->type; } } @@ -637,36 +656,33 @@ ::DoorType WallBrush::getDoorTypeFromID(uint16_t id) //============================================================================= // Wall Decoration brush -WallDecorationBrush::WallDecorationBrush() -{ +WallDecorationBrush::WallDecorationBrush() { //// } -WallDecorationBrush::~WallDecorationBrush() -{ +WallDecorationBrush::~WallDecorationBrush() { //// } -void WallDecorationBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void WallDecorationBrush::draw(BaseMap* map, Tile* tile, void* parameter) { ASSERT(tile); ItemVector::iterator iter = tile->items.begin(); tile->cleanWalls(this); - while(iter != tile->items.end()) { + while (iter != tile->items.end()) { Item* item = *iter; - if(item->isBorder()) { + if (item->isBorder()) { ++iter; continue; } - if(item->isWall()) { + if (item->isWall()) { // Now we found something interesting. // Is it just a decoration, like what we're trying to add? WallBrush* brush = item->getWallBrush(); - if(brush && brush->isWallDecoration()) { + if (brush && brush->isWallDecoration()) { // It is, discard and advance! ++iter; continue; @@ -678,52 +694,51 @@ void WallDecorationBrush::draw(BaseMap* map, Tile* tile, void* parameter) // Now we need to figure out if we got an item that mights suffice to place on this tile.. int id = 0; - if(item->isBrushDoor()) { + if (item->isBrushDoor()) { // If it's a door ::DoorType doortype = brush->getDoorTypeFromID(item->getID()); uint16_t discarded_id = 0; bool close_match = false; bool open = item->isOpen(); - for(std::vector::iterator door_iter = door_items[wall_alignment].begin(); - door_iter!= door_items[wall_alignment].end(); - ++door_iter) - { - WallBrush::DoorType& dt = *door_iter; - if(dt.type == doortype) { + for (std::vector::iterator door_iter = door_items[wall_alignment].begin(); + door_iter != door_items[wall_alignment].end(); + ++door_iter) { + WallBrush::DoorType &dt = *door_iter; + if (dt.type == doortype) { ASSERT(dt.id); - const ItemType& type = g_items.getItemType(dt.id); + const ItemType &type = g_items.getItemType(dt.id); ASSERT(dt.id != 0); - if(type.isOpen == open) { + if (type.isOpen == open) { id = dt.id; break; } else { discarded_id = dt.id; close_match = true; } - if(!close_match && discarded_id == 0) { + if (!close_match && discarded_id == 0) { discarded_id = dt.id; } } } - if(id == 0) { + if (id == 0) { id = discarded_id; - if(id == 0) { + if (id == 0) { ++iter; continue; } } } else { // If it's a normal wall... - if(wall_items[wall_alignment].total_chance <= 0) { + if (wall_items[wall_alignment].total_chance <= 0) { // No fitting item, exit ++iter; continue; } int chance = random(1, wall_items[wall_alignment].total_chance); - for(auto it = wall_items[wall_alignment].items.begin(); it != wall_items[wall_alignment].items.end(); ++it) { - if(chance <= it->chance) { + for (auto it = wall_items[wall_alignment].items.begin(); it != wall_items[wall_alignment].items.end(); ++it) { + if (chance <= it->chance) { id = it->id; break; } @@ -740,4 +755,3 @@ void WallDecorationBrush::draw(BaseMap* map, Tile* tile, void* parameter) ++iter; } } - diff --git a/source/wall_brush.h b/source/wall_brush.h index 50868051..008db52a 100644 --- a/source/wall_brush.h +++ b/source/wall_brush.h @@ -23,20 +23,25 @@ //============================================================================= // Wallbrush, for drawing walls -class WallBrush : public TerrainBrush -{ +class WallBrush : public TerrainBrush { public: static void init(); WallBrush(); virtual ~WallBrush(); - bool isWall() const { return true; } - WallBrush* asWall() { return static_cast(this); } + bool isWall() const { + return true; + } + WallBrush* asWall() { + return static_cast(this); + } - virtual bool load(pugi::xml_node node, wxArrayString& warnings); + virtual bool load(pugi::xml_node node, wxArrayString &warnings); - virtual bool canDraw(BaseMap* map, const Position& position) const {return true;} + virtual bool canDraw(BaseMap* map, const Position &position) const { + return true; + } // Draw to the target tile // Note that this actually only puts the first WALL_NORMAL item on the tile. @@ -50,8 +55,12 @@ class WallBrush : public TerrainBrush bool hasWall(Item* item); ::DoorType getDoorTypeFromID(uint16_t id); - virtual bool canSmear() const { return false; } - virtual bool canDrag() const { return true; } + virtual bool canSmear() const { + return false; + } + virtual bool canDrag() const { + return true; + } protected: struct WallType { @@ -59,7 +68,8 @@ class WallBrush : public TerrainBrush uint16_t id; }; struct WallNode { - WallNode() : total_chance(0) {} + WallNode() : + total_chance(0) { } int total_chance; std::vector items; }; @@ -82,14 +92,17 @@ class WallBrush : public TerrainBrush //============================================================================= // Wall decoration brush, for drawing decoration on walls -class WallDecorationBrush : public WallBrush -{ +class WallDecorationBrush : public WallBrush { public: WallDecorationBrush(); virtual ~WallDecorationBrush(); - bool isWallDecoration() const { return true; } - WallDecorationBrush* asWallDecoration() { return static_cast(this); } + bool isWallDecoration() const { + return true; + } + WallDecorationBrush* asWallDecoration() { + return static_cast(this); + } // We use the exact same loading algorithm as normal walls diff --git a/source/waypoint_brush.cpp b/source/waypoint_brush.cpp index 93210c85..4f0f180f 100644 --- a/source/waypoint_brush.cpp +++ b/source/waypoint_brush.cpp @@ -25,43 +25,36 @@ // Waypoint Brush WaypointBrush::WaypointBrush() : - Brush() -{ + Brush() { //// } -WaypointBrush::~WaypointBrush() -{ +WaypointBrush::~WaypointBrush() { //// } -void WaypointBrush::setWaypoint(Waypoint* wp) -{ - if(wp) { +void WaypointBrush::setWaypoint(Waypoint* wp) { + if (wp) { waypoint_name = wp->name; } else { waypoint_name = ""; } } -std::string WaypointBrush::getWaypoint() const -{ +std::string WaypointBrush::getWaypoint() const { return waypoint_name; } -bool WaypointBrush::canDraw(BaseMap* map, const Position& position) const -{ +bool WaypointBrush::canDraw(BaseMap* map, const Position &position) const { return map->getTile(position) != nullptr; } -void WaypointBrush::undraw(BaseMap* map, Tile* tile) -{ +void WaypointBrush::undraw(BaseMap* map, Tile* tile) { // Never called ASSERT(false); } -void WaypointBrush::draw(BaseMap* map, Tile* tile, void* parameter) -{ +void WaypointBrush::draw(BaseMap* map, Tile* tile, void* parameter) { // Never called ASSERT(false); } diff --git a/source/waypoint_brush.h b/source/waypoint_brush.h index 9034b315..a1cc2510 100644 --- a/source/waypoint_brush.h +++ b/source/waypoint_brush.h @@ -25,31 +25,46 @@ // This doesn't actually draw anything, and the draw/undraw functions will ASSERT if // you try to call them, so I strongly advice against it -class WaypointBrush : public Brush -{ +class WaypointBrush : public Brush { public: WaypointBrush(); virtual ~WaypointBrush(); - bool isWaypoint() const { return true; } - WaypointBrush* asWaypoint() { return static_cast(this); } + bool isWaypoint() const { + return true; + } + WaypointBrush* asWaypoint() { + return static_cast(this); + } // Not used - virtual bool load(pugi::xml_node node, wxArrayString& warnings) { return true; } + virtual bool load(pugi::xml_node node, wxArrayString &warnings) { + return true; + } - virtual bool canDraw(BaseMap* map, const Position& position) const; + virtual bool canDraw(BaseMap* map, const Position &position) const; // Will ASSERT virtual void draw(BaseMap* map, Tile* tile, void* parameter); virtual void undraw(BaseMap* map, Tile* tile); - virtual bool canDrag() const { return false; } - virtual bool canSmear() const { return false; } - virtual bool oneSizeFitsAll() const { return true; } + virtual bool canDrag() const { + return false; + } + virtual bool canSmear() const { + return false; + } + virtual bool oneSizeFitsAll() const { + return true; + } std::string getWaypoint() const; void setWaypoint(Waypoint* wp); - virtual int getLookID() const { return 0; } // We don't have a graphic - virtual std::string getName() const { return "Waypoint Brush"; } + virtual int getLookID() const { + return 0; + } // We don't have a graphic + virtual std::string getName() const { + return "Waypoint Brush"; + } protected: std::string waypoint_name; diff --git a/source/waypoints.cpp b/source/waypoints.cpp index 6d67ac38..85a236bc 100644 --- a/source/waypoints.cpp +++ b/source/waypoints.cpp @@ -20,53 +20,54 @@ #include "waypoints.h" #include "map.h" -Waypoints::~Waypoints() -{ - for(auto it = waypoints.begin(); it != waypoints.end(); ++it) +Waypoints::~Waypoints() { + for (auto it = waypoints.begin(); it != waypoints.end(); ++it) { delete it->second; + } waypoints.clear(); } -void Waypoints::addWaypoint(Waypoint* wp) -{ +void Waypoints::addWaypoint(Waypoint* wp) { removeWaypoint(wp->name); - if(wp->pos.isValid()) { + if (wp->pos.isValid()) { Tile* t = map.getTile(wp->pos); - if(!t) + if (!t) { map.setTile(wp->pos, t = map.allocator(map.createTileL(wp->pos))); + } t->getLocation()->increaseWaypointCount(); } waypoints.insert(std::make_pair(as_lower_str(wp->name), wp)); } -Waypoint* Waypoints::getWaypoint(std::string name) -{ +Waypoint* Waypoints::getWaypoint(std::string name) { to_lower_str(name); WaypointMap::iterator iter = waypoints.find(name); - if(iter == waypoints.end()) + if (iter == waypoints.end()) { return nullptr; + } return iter->second; } -Waypoint* Waypoints::getWaypoint(const Position& position) -{ - if(!position.isValid()) +Waypoint* Waypoints::getWaypoint(const Position &position) { + if (!position.isValid()) { return nullptr; + } // TODO find waypoint by position hash. - for(WaypointMap::iterator it = waypoints.begin(); it != waypoints.end(); it++) { + for (WaypointMap::iterator it = waypoints.begin(); it != waypoints.end(); it++) { Waypoint* waypoint = it->second; - if(waypoint && waypoint->pos == position) + if (waypoint && waypoint->pos == position) { return waypoint; + } } return nullptr; } -void Waypoints::removeWaypoint(std::string name) -{ +void Waypoints::removeWaypoint(std::string name) { to_lower_str(name); WaypointMap::iterator iter = waypoints.find(name); - if(iter == waypoints.end()) + if (iter == waypoints.end()) { return; + } delete iter->second; waypoints.erase(iter); } diff --git a/source/waypoints.h b/source/waypoints.h index 62b556b7..91f2075c 100644 --- a/source/waypoints.h +++ b/source/waypoints.h @@ -20,8 +20,7 @@ #include "position.h" -class Waypoint -{ +class Waypoint { public: std::string name; Position pos; @@ -29,26 +28,34 @@ class Waypoint typedef std::map WaypointMap; -class Waypoints -{ +class Waypoints { public: - Waypoints(Map& map) : map(map) {} + Waypoints(Map &map) : + map(map) { } virtual ~Waypoints(); void addWaypoint(Waypoint* wp); Waypoint* getWaypoint(std::string name); - Waypoint* getWaypoint(const Position& position); + Waypoint* getWaypoint(const Position &position); void removeWaypoint(std::string name); WaypointMap waypoints; - WaypointMap::iterator begin() { return waypoints.begin(); } - WaypointMap::const_iterator begin() const { return waypoints.begin(); } - WaypointMap::iterator end() { return waypoints.end(); } - WaypointMap::const_iterator end() const { return waypoints.end(); } + WaypointMap::iterator begin() { + return waypoints.begin(); + } + WaypointMap::const_iterator begin() const { + return waypoints.begin(); + } + WaypointMap::iterator end() { + return waypoints.end(); + } + WaypointMap::const_iterator end() const { + return waypoints.end(); + } private: - Map& map; + Map ↦ }; #endif diff --git a/source/welcome_dialog.cpp b/source/welcome_dialog.cpp index b1a710b2..b2bd4c0a 100644 --- a/source/welcome_dialog.cpp +++ b/source/welcome_dialog.cpp @@ -22,275 +22,233 @@ wxDEFINE_EVENT(WELCOME_DIALOG_ACTION, wxCommandEvent); -WelcomeDialog::WelcomeDialog(const wxString& title_text, - const wxString &version_text, - const wxSize& size, - const wxBitmap &rme_logo, - const std::vector &recent_files) - : wxDialog(nullptr, wxID_ANY, "", wxDefaultPosition, size) { - Centre(); - wxColour base_colour = wxColor(250, 250, 250); - m_welcome_dialog_panel = newd WelcomeDialogPanel(this, - GetClientSize(), - title_text, - version_text, - base_colour, - wxBitmap(rme_logo.ConvertToImage().Scale(FROM_DIP(this, 48), FROM_DIP(this, 48))), - recent_files); +WelcomeDialog::WelcomeDialog(const wxString &title_text, const wxString &version_text, const wxSize &size, const wxBitmap &rme_logo, const std::vector &recent_files) : + wxDialog(nullptr, wxID_ANY, "", wxDefaultPosition, size) { + Centre(); + wxColour base_colour = wxColor(250, 250, 250); + m_welcome_dialog_panel = newd WelcomeDialogPanel(this, GetClientSize(), title_text, version_text, base_colour, wxBitmap(rme_logo.ConvertToImage().Scale(FROM_DIP(this, 48), FROM_DIP(this, 48))), recent_files); } void WelcomeDialog::OnButtonClicked(const wxMouseEvent &event) { - auto *button = dynamic_cast(event.GetEventObject()); - wxSize button_size = button->GetSize(); - wxPoint click_point = event.GetPosition(); - if (click_point.x > 0 && click_point.x < button_size.x && click_point.y > 0 && click_point.y < button_size.x) { - if (button->GetAction() == wxID_PREFERENCES) { - PreferencesWindow preferences_window(m_welcome_dialog_panel, true); - preferences_window.ShowModal(); - m_welcome_dialog_panel->updateInputs(); - } else { - wxCommandEvent action_event(WELCOME_DIALOG_ACTION); - if (button->GetAction() == wxID_OPEN) { - wxString wildcard = g_settings.getInteger(Config::USE_OTGZ) != 0 ? - "(*.otbm;*.otgz)|*.otbm;*.otgz" : - "(*.otbm)|*.otbm|Compressed OpenTibia Binary Map (*.otgz)|*.otgz"; - wxFileDialog file_dialog(this, "Open map file", "", "", wildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST); - if (file_dialog.ShowModal() == wxID_OK) { - action_event.SetString(file_dialog.GetPath()); - } else { - return; - } - } - action_event.SetId(button->GetAction()); - ProcessWindowEvent(action_event); - } - } + auto* button = dynamic_cast(event.GetEventObject()); + wxSize button_size = button->GetSize(); + wxPoint click_point = event.GetPosition(); + if (click_point.x > 0 && click_point.x < button_size.x && click_point.y > 0 && click_point.y < button_size.x) { + if (button->GetAction() == wxID_PREFERENCES) { + PreferencesWindow preferences_window(m_welcome_dialog_panel, true); + preferences_window.ShowModal(); + m_welcome_dialog_panel->updateInputs(); + } else { + wxCommandEvent action_event(WELCOME_DIALOG_ACTION); + if (button->GetAction() == wxID_OPEN) { + wxString wildcard = g_settings.getInteger(Config::USE_OTGZ) != 0 ? "(*.otbm;*.otgz)|*.otbm;*.otgz" : "(*.otbm)|*.otbm|Compressed OpenTibia Binary Map (*.otgz)|*.otgz"; + wxFileDialog file_dialog(this, "Open map file", "", "", wildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST); + if (file_dialog.ShowModal() == wxID_OK) { + action_event.SetString(file_dialog.GetPath()); + } else { + return; + } + } + action_event.SetId(button->GetAction()); + ProcessWindowEvent(action_event); + } + } } void WelcomeDialog::OnCheckboxClicked(const wxCommandEvent &event) { - g_settings.setInteger(Config::WELCOME_DIALOG, event.GetInt()); + g_settings.setInteger(Config::WELCOME_DIALOG, event.GetInt()); } void WelcomeDialog::OnRecentItemClicked(const wxMouseEvent &event) { - auto *recent_item = dynamic_cast(event.GetEventObject()); - wxSize button_size = recent_item->GetSize(); - wxPoint click_point = event.GetPosition(); - if (click_point.x > 0 && click_point.x < button_size.x && click_point.y > 0 && click_point.y < button_size.x) { - wxCommandEvent action_event(WELCOME_DIALOG_ACTION); - action_event.SetString(recent_item->GetText()); - action_event.SetId(wxID_OPEN); - ProcessWindowEvent(action_event); - } -} - -WelcomeDialogPanel::WelcomeDialogPanel(WelcomeDialog *dialog, - const wxSize &size, - const wxString &title_text, - const wxString &version_text, - const wxColour &base_colour, - const wxBitmap &rme_logo, - const std::vector &recent_files) - : wxPanel(dialog), - m_rme_logo(rme_logo), - m_title_text(title_text), - m_version_text(version_text), - m_text_colour(base_colour.ChangeLightness(40)), - m_background_colour(base_colour) { - - auto *recent_maps_panel = newd RecentMapsPanel(this, - dialog, - base_colour, - recent_files); - recent_maps_panel->SetMaxSize(wxSize(size.x / 2, size.y)); - recent_maps_panel->SetBackgroundColour(base_colour.ChangeLightness(98)); - - wxSize button_size = FROM_DIP(this, wxSize(150, 35)); - wxColour button_base_colour = base_colour.ChangeLightness(90); - - int button_pos_center_x = size.x / 4 - button_size.x / 2; - int button_pos_center_y = size.y / 2; - - wxPoint newMapButtonPoint(button_pos_center_x, button_pos_center_y); - auto *new_map_button = newd WelcomeDialogButton(this, - wxDefaultPosition, - button_size, - button_base_colour, - "New"); - new_map_button->SetAction(wxID_NEW); - new_map_button->Bind(wxEVT_LEFT_UP, &WelcomeDialog::OnButtonClicked, dialog); - - auto *open_map_button = newd WelcomeDialogButton(this, - wxDefaultPosition, - button_size, - button_base_colour, - "Open"); - open_map_button->SetAction(wxID_OPEN); - open_map_button->Bind(wxEVT_LEFT_UP, &WelcomeDialog::OnButtonClicked, dialog); - auto *preferences_button = newd WelcomeDialogButton(this, - wxDefaultPosition, - button_size, - button_base_colour, - "Preferences"); - preferences_button->SetAction(wxID_PREFERENCES); - preferences_button->Bind(wxEVT_LEFT_UP, &WelcomeDialog::OnButtonClicked, dialog); - - Bind(wxEVT_PAINT, &WelcomeDialogPanel::OnPaint, this); - - wxSizer *rootSizer = newd wxBoxSizer(wxHORIZONTAL); - wxSizer *buttons_sizer = newd wxBoxSizer(wxVERTICAL); - buttons_sizer->AddSpacer(size.y / 2); - buttons_sizer->Add(new_map_button, 0, wxALIGN_CENTER | wxTOP, FROM_DIP(this, 10)); - buttons_sizer->Add(open_map_button, 0, wxALIGN_CENTER | wxTOP, FROM_DIP(this, 10)); - buttons_sizer->Add(preferences_button, 0, wxALIGN_CENTER | wxTOP, FROM_DIP(this, 10)); - - wxSizer *vertical_sizer = newd wxBoxSizer(wxVERTICAL); - wxSizer *horizontal_sizer = newd wxBoxSizer(wxHORIZONTAL); - - m_show_welcome_dialog_checkbox = newd wxCheckBox(this, wxID_ANY, "Show this dialog on startup"); - m_show_welcome_dialog_checkbox->SetValue(g_settings.getInteger(Config::WELCOME_DIALOG) == 1); - m_show_welcome_dialog_checkbox->Bind(wxEVT_CHECKBOX, &WelcomeDialog::OnCheckboxClicked, dialog); - m_show_welcome_dialog_checkbox->SetBackgroundColour(m_background_colour); - horizontal_sizer->Add(m_show_welcome_dialog_checkbox, 0, wxALIGN_BOTTOM | wxALL, FROM_DIP(this, 10)); - vertical_sizer->Add(buttons_sizer, 1, wxEXPAND); - vertical_sizer->Add(horizontal_sizer, 1, wxEXPAND); - - rootSizer->Add(vertical_sizer, 1, wxEXPAND); - rootSizer->Add(recent_maps_panel, 1, wxEXPAND); - SetSizer(rootSizer); + auto* recent_item = dynamic_cast(event.GetEventObject()); + wxSize button_size = recent_item->GetSize(); + wxPoint click_point = event.GetPosition(); + if (click_point.x > 0 && click_point.x < button_size.x && click_point.y > 0 && click_point.y < button_size.x) { + wxCommandEvent action_event(WELCOME_DIALOG_ACTION); + action_event.SetString(recent_item->GetText()); + action_event.SetId(wxID_OPEN); + ProcessWindowEvent(action_event); + } +} + +WelcomeDialogPanel::WelcomeDialogPanel(WelcomeDialog* dialog, const wxSize &size, const wxString &title_text, const wxString &version_text, const wxColour &base_colour, const wxBitmap &rme_logo, const std::vector &recent_files) : + wxPanel(dialog), + m_rme_logo(rme_logo), + m_title_text(title_text), + m_version_text(version_text), + m_text_colour(base_colour.ChangeLightness(40)), + m_background_colour(base_colour) { + + auto* recent_maps_panel = newd RecentMapsPanel(this, dialog, base_colour, recent_files); + recent_maps_panel->SetMaxSize(wxSize(size.x / 2, size.y)); + recent_maps_panel->SetBackgroundColour(base_colour.ChangeLightness(98)); + + wxSize button_size = FROM_DIP(this, wxSize(150, 35)); + wxColour button_base_colour = base_colour.ChangeLightness(90); + + int button_pos_center_x = size.x / 4 - button_size.x / 2; + int button_pos_center_y = size.y / 2; + + wxPoint newMapButtonPoint(button_pos_center_x, button_pos_center_y); + auto* new_map_button = newd WelcomeDialogButton(this, wxDefaultPosition, button_size, button_base_colour, "New"); + new_map_button->SetAction(wxID_NEW); + new_map_button->Bind(wxEVT_LEFT_UP, &WelcomeDialog::OnButtonClicked, dialog); + + auto* open_map_button = newd WelcomeDialogButton(this, wxDefaultPosition, button_size, button_base_colour, "Open"); + open_map_button->SetAction(wxID_OPEN); + open_map_button->Bind(wxEVT_LEFT_UP, &WelcomeDialog::OnButtonClicked, dialog); + auto* preferences_button = newd WelcomeDialogButton(this, wxDefaultPosition, button_size, button_base_colour, "Preferences"); + preferences_button->SetAction(wxID_PREFERENCES); + preferences_button->Bind(wxEVT_LEFT_UP, &WelcomeDialog::OnButtonClicked, dialog); + + Bind(wxEVT_PAINT, &WelcomeDialogPanel::OnPaint, this); + + wxSizer* rootSizer = newd wxBoxSizer(wxHORIZONTAL); + wxSizer* buttons_sizer = newd wxBoxSizer(wxVERTICAL); + buttons_sizer->AddSpacer(size.y / 2); + buttons_sizer->Add(new_map_button, 0, wxALIGN_CENTER | wxTOP, FROM_DIP(this, 10)); + buttons_sizer->Add(open_map_button, 0, wxALIGN_CENTER | wxTOP, FROM_DIP(this, 10)); + buttons_sizer->Add(preferences_button, 0, wxALIGN_CENTER | wxTOP, FROM_DIP(this, 10)); + + wxSizer* vertical_sizer = newd wxBoxSizer(wxVERTICAL); + wxSizer* horizontal_sizer = newd wxBoxSizer(wxHORIZONTAL); + + m_show_welcome_dialog_checkbox = newd wxCheckBox(this, wxID_ANY, "Show this dialog on startup"); + m_show_welcome_dialog_checkbox->SetValue(g_settings.getInteger(Config::WELCOME_DIALOG) == 1); + m_show_welcome_dialog_checkbox->Bind(wxEVT_CHECKBOX, &WelcomeDialog::OnCheckboxClicked, dialog); + m_show_welcome_dialog_checkbox->SetBackgroundColour(m_background_colour); + horizontal_sizer->Add(m_show_welcome_dialog_checkbox, 0, wxALIGN_BOTTOM | wxALL, FROM_DIP(this, 10)); + vertical_sizer->Add(buttons_sizer, 1, wxEXPAND); + vertical_sizer->Add(horizontal_sizer, 1, wxEXPAND); + + rootSizer->Add(vertical_sizer, 1, wxEXPAND); + rootSizer->Add(recent_maps_panel, 1, wxEXPAND); + SetSizer(rootSizer); } void WelcomeDialogPanel::updateInputs() { - m_show_welcome_dialog_checkbox->SetValue(g_settings.getInteger(Config::WELCOME_DIALOG) == 1); + m_show_welcome_dialog_checkbox->SetValue(g_settings.getInteger(Config::WELCOME_DIALOG) == 1); } void WelcomeDialogPanel::OnPaint(const wxPaintEvent &event) { - wxPaintDC dc(this); - - dc.SetBrush(wxBrush(m_background_colour)); - dc.SetPen(wxPen(m_background_colour)); - dc.DrawRectangle(wxRect(wxPoint(0, 0), GetClientSize())); - - dc.DrawBitmap(m_rme_logo, wxPoint(GetSize().x / 4 - m_rme_logo.GetWidth() / 2, FROM_DIP(this, 40)), true); - - wxFont font = GetFont(); - font.SetPointSize(18); - dc.SetFont(font); - wxSize header_size = dc.GetTextExtent(m_title_text); - wxSize header_point(GetSize().x / 4, GetSize().y / 4); - dc.SetTextForeground(m_text_colour); - dc.DrawText(m_title_text, wxPoint(header_point.x - header_size.x / 2, header_point.y)); - - dc.SetFont(GetFont()); - wxSize version_size = dc.GetTextExtent(m_version_text); - dc.SetTextForeground(m_text_colour.ChangeLightness(110)); - dc.DrawText(m_version_text, wxPoint(header_point.x - version_size.x / 2, header_point.y + header_size.y + 10)); -} + wxPaintDC dc(this); -WelcomeDialogButton::WelcomeDialogButton(wxWindow *parent, - const wxPoint &pos, - const wxSize &size, - const wxColour &base_colour, - const wxString &text) - : wxPanel(parent, wxID_ANY, pos, size), - m_action(wxID_CLOSE), - m_text(text), - m_text_colour(base_colour.ChangeLightness(40)), - m_background(base_colour.ChangeLightness(96)), - m_background_hover(base_colour.ChangeLightness(93)), - m_is_hover(false) { - Bind(wxEVT_PAINT, &WelcomeDialogButton::OnPaint, this); - Bind(wxEVT_ENTER_WINDOW, &WelcomeDialogButton::OnMouseEnter, this); - Bind(wxEVT_LEAVE_WINDOW, &WelcomeDialogButton::OnMouseLeave, this); -} + dc.SetBrush(wxBrush(m_background_colour)); + dc.SetPen(wxPen(m_background_colour)); + dc.DrawRectangle(wxRect(wxPoint(0, 0), GetClientSize())); -void WelcomeDialogButton::OnPaint(const wxPaintEvent &event) { - wxPaintDC dc(this); + dc.DrawBitmap(m_rme_logo, wxPoint(GetSize().x / 4 - m_rme_logo.GetWidth() / 2, FROM_DIP(this, 40)), true); - wxColour colour = m_is_hover ? m_background_hover : m_background; - dc.SetBrush(wxBrush(colour)); - dc.SetPen(wxPen(colour, 1)); - dc.DrawRectangle(wxRect(wxPoint(0, 0), GetClientSize())); + wxFont font = GetFont(); + font.SetPointSize(18); + dc.SetFont(font); + wxSize header_size = dc.GetTextExtent(m_title_text); + wxSize header_point(GetSize().x / 4, GetSize().y / 4); + dc.SetTextForeground(m_text_colour); + dc.DrawText(m_title_text, wxPoint(header_point.x - header_size.x / 2, header_point.y)); - dc.SetFont(GetFont()); - dc.SetTextForeground(m_text_colour); - wxSize text_size = dc.GetTextExtent(m_text); - dc.DrawText(m_text, wxPoint(GetSize().x / 2 - text_size.x / 2, GetSize().y / 2 - text_size.y / 2)); + dc.SetFont(GetFont()); + wxSize version_size = dc.GetTextExtent(m_version_text); + dc.SetTextForeground(m_text_colour.ChangeLightness(110)); + dc.DrawText(m_version_text, wxPoint(header_point.x - version_size.x / 2, header_point.y + header_size.y + 10)); } -void WelcomeDialogButton::OnMouseEnter(const wxMouseEvent &event) { - m_is_hover = true; - Refresh(); +WelcomeDialogButton::WelcomeDialogButton(wxWindow* parent, const wxPoint &pos, const wxSize &size, const wxColour &base_colour, const wxString &text) : + wxPanel(parent, wxID_ANY, pos, size), + m_action(wxID_CLOSE), + m_text(text), + m_text_colour(base_colour.ChangeLightness(40)), + m_background(base_colour.ChangeLightness(96)), + m_background_hover(base_colour.ChangeLightness(93)), + m_is_hover(false) { + Bind(wxEVT_PAINT, &WelcomeDialogButton::OnPaint, this); + Bind(wxEVT_ENTER_WINDOW, &WelcomeDialogButton::OnMouseEnter, this); + Bind(wxEVT_LEAVE_WINDOW, &WelcomeDialogButton::OnMouseLeave, this); } -void WelcomeDialogButton::OnMouseLeave(const wxMouseEvent &event) { - m_is_hover = false; - Refresh(); -} +void WelcomeDialogButton::OnPaint(const wxPaintEvent &event) { + wxPaintDC dc(this); -RecentMapsPanel::RecentMapsPanel(wxWindow *parent, - WelcomeDialog *dialog, - const wxColour &base_colour, - const std::vector &recent_files) - : wxPanel(parent, wxID_ANY) { - wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); - for (const wxString &file : recent_files) { - auto *recent_item = newd RecentItem(this, base_colour, file); - sizer->Add(recent_item, 0, wxEXPAND); - recent_item->Bind(wxEVT_LEFT_UP, &WelcomeDialog::OnRecentItemClicked, dialog); - } - SetSizerAndFit(sizer); + wxColour colour = m_is_hover ? m_background_hover : m_background; + dc.SetBrush(wxBrush(colour)); + dc.SetPen(wxPen(colour, 1)); + dc.DrawRectangle(wxRect(wxPoint(0, 0), GetClientSize())); + + dc.SetFont(GetFont()); + dc.SetTextForeground(m_text_colour); + wxSize text_size = dc.GetTextExtent(m_text); + dc.DrawText(m_text, wxPoint(GetSize().x / 2 - text_size.x / 2, GetSize().y / 2 - text_size.y / 2)); } -RecentItem::RecentItem(wxWindow *parent, - const wxColour &base_colour, - const wxString &item_name) - : wxPanel(parent, wxID_ANY), - m_text_colour(base_colour.ChangeLightness(40)), - m_text_colour_hover(base_colour.ChangeLightness(20)), - m_item_text(item_name) { - SetBackgroundColour(base_colour.ChangeLightness(95)); - m_title = newd wxStaticText(this, wxID_ANY, wxFileNameFromPath(m_item_text)); - m_title->SetFont(GetFont().Bold()); - m_title->SetForegroundColour(m_text_colour); - m_title->SetToolTip(m_item_text); - m_file_path = newd wxStaticText(this, wxID_ANY, m_item_text, wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_START); - m_file_path->SetToolTip(m_item_text); - m_file_path->SetFont(GetFont().Smaller()); - m_file_path->SetForegroundColour(m_text_colour); - wxBoxSizer *mainSizer = newd wxBoxSizer(wxHORIZONTAL); - wxBoxSizer *sizer = newd wxBoxSizer(wxVERTICAL); - sizer->Add(m_title); - sizer->Add(m_file_path, 1, wxTOP, FROM_DIP(this, 2)); - mainSizer->Add(sizer, 0, wxEXPAND | wxALL, FROM_DIP(this, 8)); - Bind(wxEVT_ENTER_WINDOW, &RecentItem::OnMouseEnter, this); - Bind(wxEVT_LEAVE_WINDOW, &RecentItem::OnMouseLeave, this); - m_title->Bind(wxEVT_LEFT_UP, &RecentItem::PropagateItemClicked, this); - m_file_path->Bind(wxEVT_LEFT_UP, &RecentItem::PropagateItemClicked, this); - SetSizerAndFit(mainSizer); +void WelcomeDialogButton::OnMouseEnter(const wxMouseEvent &event) { + m_is_hover = true; + Refresh(); } -void RecentItem::PropagateItemClicked(wxMouseEvent& event) { - event.ResumePropagation(1); - event.SetEventObject(this); - event.Skip(); +void WelcomeDialogButton::OnMouseLeave(const wxMouseEvent &event) { + m_is_hover = false; + Refresh(); +} + +RecentMapsPanel::RecentMapsPanel(wxWindow* parent, WelcomeDialog* dialog, const wxColour &base_colour, const std::vector &recent_files) : + wxPanel(parent, wxID_ANY) { + wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); + for (const wxString &file : recent_files) { + auto* recent_item = newd RecentItem(this, base_colour, file); + sizer->Add(recent_item, 0, wxEXPAND); + recent_item->Bind(wxEVT_LEFT_UP, &WelcomeDialog::OnRecentItemClicked, dialog); + } + SetSizerAndFit(sizer); +} + +RecentItem::RecentItem(wxWindow* parent, const wxColour &base_colour, const wxString &item_name) : + wxPanel(parent, wxID_ANY), + m_text_colour(base_colour.ChangeLightness(40)), + m_text_colour_hover(base_colour.ChangeLightness(20)), + m_item_text(item_name) { + SetBackgroundColour(base_colour.ChangeLightness(95)); + m_title = newd wxStaticText(this, wxID_ANY, wxFileNameFromPath(m_item_text)); + m_title->SetFont(GetFont().Bold()); + m_title->SetForegroundColour(m_text_colour); + m_title->SetToolTip(m_item_text); + m_file_path = newd wxStaticText(this, wxID_ANY, m_item_text, wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_START); + m_file_path->SetToolTip(m_item_text); + m_file_path->SetFont(GetFont().Smaller()); + m_file_path->SetForegroundColour(m_text_colour); + wxBoxSizer* mainSizer = newd wxBoxSizer(wxHORIZONTAL); + wxBoxSizer* sizer = newd wxBoxSizer(wxVERTICAL); + sizer->Add(m_title); + sizer->Add(m_file_path, 1, wxTOP, FROM_DIP(this, 2)); + mainSizer->Add(sizer, 0, wxEXPAND | wxALL, FROM_DIP(this, 8)); + Bind(wxEVT_ENTER_WINDOW, &RecentItem::OnMouseEnter, this); + Bind(wxEVT_LEAVE_WINDOW, &RecentItem::OnMouseLeave, this); + m_title->Bind(wxEVT_LEFT_UP, &RecentItem::PropagateItemClicked, this); + m_file_path->Bind(wxEVT_LEFT_UP, &RecentItem::PropagateItemClicked, this); + SetSizerAndFit(mainSizer); +} + +void RecentItem::PropagateItemClicked(wxMouseEvent &event) { + event.ResumePropagation(1); + event.SetEventObject(this); + event.Skip(); } void RecentItem::OnMouseEnter(const wxMouseEvent &event) { - if (GetScreenRect().Contains(ClientToScreen(event.GetPosition())) - && m_title->GetForegroundColour() != m_text_colour_hover) { - m_title->SetForegroundColour(m_text_colour_hover); - m_file_path->SetForegroundColour(m_text_colour_hover); - m_title->Refresh(); - m_file_path->Refresh(); - } + if (GetScreenRect().Contains(ClientToScreen(event.GetPosition())) + && m_title->GetForegroundColour() != m_text_colour_hover) { + m_title->SetForegroundColour(m_text_colour_hover); + m_file_path->SetForegroundColour(m_text_colour_hover); + m_title->Refresh(); + m_file_path->Refresh(); + } } void RecentItem::OnMouseLeave(const wxMouseEvent &event) { - if (!GetScreenRect().Contains(ClientToScreen(event.GetPosition())) - && m_title->GetForegroundColour() != m_text_colour) { - m_title->SetForegroundColour(m_text_colour); - m_file_path->SetForegroundColour(m_text_colour); - m_title->Refresh(); - m_file_path->Refresh(); - } + if (!GetScreenRect().Contains(ClientToScreen(event.GetPosition())) + && m_title->GetForegroundColour() != m_text_colour) { + m_title->SetForegroundColour(m_text_colour); + m_file_path->SetForegroundColour(m_text_colour); + m_title->Refresh(); + m_file_path->Refresh(); + } } diff --git a/source/welcome_dialog.h b/source/welcome_dialog.h index 6803e47b..3ac1afba 100644 --- a/source/welcome_dialog.h +++ b/source/welcome_dialog.h @@ -24,83 +24,75 @@ wxDECLARE_EVENT(WELCOME_DIALOG_ACTION, wxCommandEvent); class WelcomeDialogPanel; -class WelcomeDialog : public wxDialog -{ +class WelcomeDialog : public wxDialog { public: - WelcomeDialog(const wxString& titleText, - const wxString& versionText, - const wxSize& size, - const wxBitmap& rmeLogo, - const std::vector &recentFiles); - void OnButtonClicked(const wxMouseEvent& event); - void OnCheckboxClicked(const wxCommandEvent& event); - void OnRecentItemClicked(const wxMouseEvent& event); + WelcomeDialog(const wxString &titleText, const wxString &versionText, const wxSize &size, const wxBitmap &rmeLogo, const std::vector &recentFiles); + void OnButtonClicked(const wxMouseEvent &event); + void OnCheckboxClicked(const wxCommandEvent &event); + void OnRecentItemClicked(const wxMouseEvent &event); + private: - WelcomeDialogPanel* m_welcome_dialog_panel; + WelcomeDialogPanel* m_welcome_dialog_panel; }; -class WelcomeDialogPanel : public wxPanel -{ +class WelcomeDialogPanel : public wxPanel { public: - WelcomeDialogPanel(WelcomeDialog* parent, - const wxSize& size, - const wxString& title_text, - const wxString& version_text, - const wxColour& base_colour, - const wxBitmap& rme_logo, - const std::vector &recent_files); - void OnPaint(const wxPaintEvent& event); - void updateInputs(); + WelcomeDialogPanel(WelcomeDialog* parent, const wxSize &size, const wxString &title_text, const wxString &version_text, const wxColour &base_colour, const wxBitmap &rme_logo, const std::vector &recent_files); + void OnPaint(const wxPaintEvent &event); + void updateInputs(); + private: - wxBitmap m_rme_logo; - wxString m_title_text; - wxString m_version_text; - wxColour m_text_colour; - wxColour m_background_colour; - wxCheckBox* m_show_welcome_dialog_checkbox; + wxBitmap m_rme_logo; + wxString m_title_text; + wxString m_version_text; + wxColour m_text_colour; + wxColour m_background_colour; + wxCheckBox* m_show_welcome_dialog_checkbox; }; -class WelcomeDialogButton : public wxPanel -{ +class WelcomeDialogButton : public wxPanel { public: - WelcomeDialogButton(wxWindow* parent, const wxPoint& pos, const wxSize& size, const wxColour& base_colour, const wxString &text); - void OnPaint(const wxPaintEvent& event); - void OnMouseEnter(const wxMouseEvent& event); - void OnMouseLeave(const wxMouseEvent& event); - wxStandardID GetAction() { return m_action; }; - void SetAction(wxStandardID action) { m_action = action; }; + WelcomeDialogButton(wxWindow* parent, const wxPoint &pos, const wxSize &size, const wxColour &base_colour, const wxString &text); + void OnPaint(const wxPaintEvent &event); + void OnMouseEnter(const wxMouseEvent &event); + void OnMouseLeave(const wxMouseEvent &event); + wxStandardID GetAction() { + return m_action; + }; + void SetAction(wxStandardID action) { + m_action = action; + }; + private: - wxStandardID m_action; - wxString m_text; - wxColour m_text_colour; - wxColour m_background; - wxColour m_background_hover; - bool m_is_hover; + wxStandardID m_action; + wxString m_text; + wxColour m_text_colour; + wxColour m_background; + wxColour m_background_hover; + bool m_is_hover; }; -class RecentMapsPanel : public wxPanel -{ +class RecentMapsPanel : public wxPanel { public: - RecentMapsPanel(wxWindow* parent, - WelcomeDialog* dialog, - const wxColour& base_colour, - const std::vector &recent_files); + RecentMapsPanel(wxWindow* parent, WelcomeDialog* dialog, const wxColour &base_colour, const std::vector &recent_files); }; -class RecentItem : public wxPanel -{ +class RecentItem : public wxPanel { public: - RecentItem(wxWindow* parent, const wxColour& base_colour, const wxString &item_name); - void OnMouseEnter(const wxMouseEvent& event); - void OnMouseLeave(const wxMouseEvent& event); - void PropagateItemClicked(wxMouseEvent& event); - wxString GetText() { return m_item_text; }; + RecentItem(wxWindow* parent, const wxColour &base_colour, const wxString &item_name); + void OnMouseEnter(const wxMouseEvent &event); + void OnMouseLeave(const wxMouseEvent &event); + void PropagateItemClicked(wxMouseEvent &event); + wxString GetText() { + return m_item_text; + }; + private: - wxColour m_text_colour; - wxColour m_text_colour_hover; - wxStaticText* m_title; - wxStaticText* m_file_path; - wxString m_item_text; + wxColour m_text_colour; + wxColour m_text_colour_hover; + wxStaticText* m_title; + wxStaticText* m_file_path; + wxString m_item_text; }; -#endif //WELCOME_DIALOG_H +#endif // WELCOME_DIALOG_H