diff --git a/src/scenedit/scen.core.cpp b/src/scenedit/scen.core.cpp index 8d20a1bd..98f2c6b2 100644 --- a/src/scenedit/scen.core.cpp +++ b/src/scenedit/scen.core.cpp @@ -24,7 +24,6 @@ extern bool mouse_button_held; extern short cur_viewing_mode; extern cTown* town; extern cOutdoors* current_terrain; -extern short max_dim[3]; extern short mode_count,to_create; extern ter_num_t template_terrain[64][64]; extern cScenario scenario; @@ -1645,11 +1644,9 @@ bool build_scenario() { static bool check_location_bounds(cDialog& me, std::string id, bool losing) { if(!losing) return true; - // TODO: Use town->max_dim() instead of max_dim[town_size] - // (Requires all towns to be in memory though.) short town_num = me["town-num"].getTextAsNum(); short dim = me[id].getTextAsNum(); - if(dim < 0 || dim >= max_dim[scenario.town_size[town_num]]) { + if(dim < 0 || dim >= scenario.towns[town_num]->max_dim()) { giveError("This coordinate is not inside the bounds of the town."); return false; } diff --git a/src/tools/cursors.h b/src/tools/cursors.h index f89f3210..4d40433f 100644 --- a/src/tools/cursors.h +++ b/src/tools/cursors.h @@ -57,4 +57,15 @@ void obscureCursor(); void set_cursor(cursor_type which_curs); void restore_cursor(); +// Filenames for the cursors +static const char*const cursors[25] = { + "wand", "eyedropper", "brush", "spraycan", + "eraser", "topleft", "bottomright", "hand", + "NW", "N", "NE", + "W", "wait", "E", + "SW", "S", "SE", + "sword", "boot", "drop", "target", + "talk", "key", "look", "watch", +}; + #endif diff --git a/src/tools/cursors.mac.mm b/src/tools/cursors.mac.mm index b1cd0c41..483b23f9 100644 --- a/src/tools/cursors.mac.mm +++ b/src/tools/cursors.mac.mm @@ -11,6 +11,8 @@ #include #include "restypes.hpp" +extern cursor_type current_cursor; + static NSImage* imageFromURL(CFURLRef url){ CGImageSourceRef imageSource = CGImageSourceCreateWithURL(url, NULL); CGImageRef theImage = nil; @@ -40,7 +42,7 @@ static NSImage* imageFromURL(CFURLRef url){ return newImage; } -Cursor::Cursor(std::string path, float hotSpotX, float hotSpotY){ +Cursor::Cursor(fs::path path, float hotSpotX, float hotSpotY){ FSRef ref; FSPathMakeRef((UInt8*)path.c_str(), &ref, NULL); CFURLRef imgPath = CFURLCreateFromFSRef(NULL, &ref); diff --git a/src/tools/cursors.win.cpp b/src/tools/cursors.win.cpp index 28b02866..3ffd0868 100644 --- a/src/tools/cursors.win.cpp +++ b/src/tools/cursors.win.cpp @@ -8,16 +8,6 @@ extern cursor_type current_cursor; extern sf::RenderWindow mainPtr; -const std::string cursors[25] = { - "wand", "eyedropper", "brush", "spraycan", - "eraser", "topleft", "bottomright", "hand", - "NW", "N", "NE", - "W", "wait", "E", - "SW", "S", "SE", - "sword", "boot", "drop", "target", - "talk", "key", "look", "watch", -}; - static const COLORREF clrMagenta = RGB(255, 0, 255); // This function adapted from diff --git a/src/tools/winutil.h b/src/tools/winutil.h index 029c109b..13582f5a 100644 --- a/src/tools/winutil.h +++ b/src/tools/winutil.h @@ -39,7 +39,7 @@ int getMenubarHeight(); class ModalSession { void* session; - sf::Window& parent; + sf::Window* parent; public: void pumpEvents(); ModalSession(sf::Window& win, sf::Window& parent); diff --git a/src/tools/winutil.mac.mm b/src/tools/winutil.mac.mm index 6d9d6716..4bed9123 100644 --- a/src/tools/winutil.mac.mm +++ b/src/tools/winutil.mac.mm @@ -105,7 +105,7 @@ void setWindowFloating(sf::Window& win, bool floating) { } } -ModalSession::ModalSession(sf::Window& win) { +ModalSession::ModalSession(sf::Window& win, sf::Window& /*parent*/) { sf::WindowHandle handle = win.getSystemHandle(); id nsHandle = id(handle); if([nsHandle isKindOfClass: [NSWindow class]]) diff --git a/src/tools/winutil.win.cpp b/src/tools/winutil.win.cpp index d5a9403a..0ceba0b2 100644 --- a/src/tools/winutil.win.cpp +++ b/src/tools/winutil.win.cpp @@ -200,15 +200,15 @@ void ModalSession::pumpEvents() { HWND win_handle = (HWND)session; } -ModalSession::ModalSession(sf::Window& win, sf::Window& parent) : parent(parent) { +ModalSession::ModalSession(sf::Window& win, sf::Window& parent) : parent(&parent) { session = win.getSystemHandle(); - EnableWindow(parent.getSystemHandle(), false); + EnableWindow(parent->getSystemHandle(), false); } ModalSession::~ModalSession() { HWND win_handle = (HWND)session; - EnableWindow(parent.getSystemHandle(), true); - RedrawWindow(parent.getSystemHandle(), NULL, NULL, RDW_NOCHILDREN | RDW_UPDATENOW); + EnableWindow(parent->getSystemHandle(), true); + RedrawWindow(parent->getSystemHandle(), NULL, NULL, RDW_NOCHILDREN | RDW_UPDATENOW); } void set_up_apple_events() {