Fix Mac build (again)

This commit is contained in:
2014-12-30 17:41:50 -05:00
parent 0b330432b4
commit 099a6a61b0
7 changed files with 21 additions and 21 deletions

View File

@@ -24,7 +24,6 @@ extern bool mouse_button_held;
extern short cur_viewing_mode; extern short cur_viewing_mode;
extern cTown* town; extern cTown* town;
extern cOutdoors* current_terrain; extern cOutdoors* current_terrain;
extern short max_dim[3];
extern short mode_count,to_create; extern short mode_count,to_create;
extern ter_num_t template_terrain[64][64]; extern ter_num_t template_terrain[64][64];
extern cScenario scenario; extern cScenario scenario;
@@ -1645,11 +1644,9 @@ bool build_scenario() {
static bool check_location_bounds(cDialog& me, std::string id, bool losing) { static bool check_location_bounds(cDialog& me, std::string id, bool losing) {
if(!losing) return true; 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 town_num = me["town-num"].getTextAsNum();
short dim = me[id].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."); giveError("This coordinate is not inside the bounds of the town.");
return false; return false;
} }

View File

@@ -57,4 +57,15 @@ void obscureCursor();
void set_cursor(cursor_type which_curs); void set_cursor(cursor_type which_curs);
void restore_cursor(); 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 #endif

View File

@@ -11,6 +11,8 @@
#include <string> #include <string>
#include "restypes.hpp" #include "restypes.hpp"
extern cursor_type current_cursor;
static NSImage* imageFromURL(CFURLRef url){ static NSImage* imageFromURL(CFURLRef url){
CGImageSourceRef imageSource = CGImageSourceCreateWithURL(url, NULL); CGImageSourceRef imageSource = CGImageSourceCreateWithURL(url, NULL);
CGImageRef theImage = nil; CGImageRef theImage = nil;
@@ -40,7 +42,7 @@ static NSImage* imageFromURL(CFURLRef url){
return newImage; return newImage;
} }
Cursor::Cursor(std::string path, float hotSpotX, float hotSpotY){ Cursor::Cursor(fs::path path, float hotSpotX, float hotSpotY){
FSRef ref; FSRef ref;
FSPathMakeRef((UInt8*)path.c_str(), &ref, NULL); FSPathMakeRef((UInt8*)path.c_str(), &ref, NULL);
CFURLRef imgPath = CFURLCreateFromFSRef(NULL, &ref); CFURLRef imgPath = CFURLCreateFromFSRef(NULL, &ref);

View File

@@ -8,16 +8,6 @@
extern cursor_type current_cursor; extern cursor_type current_cursor;
extern sf::RenderWindow mainPtr; 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); static const COLORREF clrMagenta = RGB(255, 0, 255);
// This function adapted from <http://web.archive.org/web/20130502044728/http://marknelson.us/2002/07/01/rendering-transparent-gifs-revisited/> // This function adapted from <http://web.archive.org/web/20130502044728/http://marknelson.us/2002/07/01/rendering-transparent-gifs-revisited/>

View File

@@ -39,7 +39,7 @@ int getMenubarHeight();
class ModalSession { class ModalSession {
void* session; void* session;
sf::Window& parent; sf::Window* parent;
public: public:
void pumpEvents(); void pumpEvents();
ModalSession(sf::Window& win, sf::Window& parent); ModalSession(sf::Window& win, sf::Window& parent);

View File

@@ -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(); sf::WindowHandle handle = win.getSystemHandle();
id nsHandle = id(handle); id nsHandle = id(handle);
if([nsHandle isKindOfClass: [NSWindow class]]) if([nsHandle isKindOfClass: [NSWindow class]])

View File

@@ -200,15 +200,15 @@ void ModalSession::pumpEvents() {
HWND win_handle = (HWND)session; 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(); session = win.getSystemHandle();
EnableWindow(parent.getSystemHandle(), false); EnableWindow(parent->getSystemHandle(), false);
} }
ModalSession::~ModalSession() { ModalSession::~ModalSession() {
HWND win_handle = (HWND)session; HWND win_handle = (HWND)session;
EnableWindow(parent.getSystemHandle(), true); EnableWindow(parent->getSystemHandle(), true);
RedrawWindow(parent.getSystemHandle(), NULL, NULL, RDW_NOCHILDREN | RDW_UPDATENOW); RedrawWindow(parent->getSystemHandle(), NULL, NULL, RDW_NOCHILDREN | RDW_UPDATENOW);
} }
void set_up_apple_events() { void set_up_apple_events() {