Save OS version to scenarios
This commit is contained in:
@@ -154,8 +154,7 @@ void writeScenarioToXml(ticpp::Printer&& data, cScenario& scenario) {
|
||||
data.OpenElement("creator");
|
||||
data.PushElement("type", "oboe");
|
||||
data.PushElement("version", scenario.format_ed_version());
|
||||
// TODO: fill <os> element
|
||||
data.PushElement("os", "");
|
||||
data.PushElement("os", get_os_version());
|
||||
data.CloseElement("creator");
|
||||
data.OpenElement("game");
|
||||
data.PushElement("num-towns", scenario.towns.size());
|
||||
|
@@ -23,6 +23,8 @@ void setWindowFloating(sf::Window& win, bool floating);
|
||||
void init_fileio();
|
||||
void launchURL(std::string url);
|
||||
|
||||
std::string get_os_version();
|
||||
|
||||
fs::path nav_get_party();
|
||||
fs::path nav_put_party(fs::path def = "");
|
||||
fs::path nav_get_scenario();
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <AppKit/NSBitmapImageRep.h>
|
||||
#include <SFML/Graphics/RenderWindow.hpp>
|
||||
#include <sstream>
|
||||
|
||||
// TODO: I'm sure there's a better way to do this (maybe one that's keyboard layout agnostic)
|
||||
// The proper way would involve use of the TextEntered event
|
||||
@@ -89,6 +90,14 @@ char keyToChar(sf::Keyboard::Key key, bool isShift) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string get_os_version() {
|
||||
NSProcessInfo* info = [NSProcessInfo processInfo];
|
||||
std::ostringstream os;
|
||||
os << "Apple Mac OS X ";
|
||||
os << [[info operatingSystemVersionString] cStringUsingEncoding:NSASCIIStringEncoding];
|
||||
return os.str();
|
||||
}
|
||||
|
||||
void makeFrontWindow(sf::Window& win) {
|
||||
sf::WindowHandle handle = win.getSystemHandle();
|
||||
id nsHandle = id(handle);
|
||||
|
Reference in New Issue
Block a user