Skip to content

Commit

Permalink
Fix OS X compilation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fpw committed Nov 7, 2021
1 parent 19f4ee1 commit 3e5e303
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/environment/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <nlohmann/json.hpp>
#include <iomanip>
#include <sstream>
#include "Settings.h"
#include "src/Logger.h"
#include "src/platform/Platform.h"
Expand All @@ -36,7 +37,7 @@ Settings::Settings(const std::string &settingsFile)
colorTable.push_back({"BLUE", 0xFF0000A0});
colorTable.push_back({"GREEN", 0xFF008000});
colorTable.push_back({"YELLOW", 0xFF808000});

database = std::make_shared<json>();
init();
load();
Expand Down Expand Up @@ -183,7 +184,7 @@ uint32_t Settings::colorStringToInt(std::string colString, const char* colDefaul
return i->second;
}
}

if ((cstr[0] == '#') && (cstr.size() >= 7)) {
cstr.erase(0,1);
uint32_t c = 0;
Expand All @@ -197,7 +198,7 @@ uint32_t Settings::colorStringToInt(std::string colString, const char* colDefaul
if (p == 6) c |= 0xFF000000;// make color opaque if alpha-channel not defined
if (p) return c;
}

cstr = colDefault;
for (auto i = colorTable.begin(); i != colorTable.end(); ++i) {
if (cstr == i->first) {
Expand Down
2 changes: 1 addition & 1 deletion src/environment/standalone/StandAloneEnvironment.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class StandAloneEnvironment: public Environment {
std::string getFontDirectory() override;
std::string getProgramPath() override;
std::string getSettingsDir() override;
void sendUserFixesFilenameToXData(std::string filename);
void sendUserFixesFilenameToXData(std::string filename) override;
std::string getEarthTexturePath() override;
void runInEnvironment(EnvironmentCallback cb) override;
std::shared_ptr<xdata::XData> getNavData() override;
Expand Down
2 changes: 1 addition & 1 deletion src/environment/xplane/XPlaneEnvironment.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class XPlaneEnvironment: public Environment {
std::string getFontDirectory() override;
std::string getProgramPath() override;
std::string getSettingsDir() override;
void sendUserFixesFilenameToXData(std::string filename);
void sendUserFixesFilenameToXData(std::string filename) override;
std::string getEarthTexturePath() override;
void runInEnvironment(EnvironmentCallback cb) override;
std::shared_ptr<xdata::XData> getNavData() override;
Expand Down
1 change: 0 additions & 1 deletion src/libxdata/world/models/navaids/UserFix.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class UserFix {
private:
UserFix::Type type = UserFix::Type::NONE;
std::string name;
int elevation = 0;
};

} /* namespace xdata */
Expand Down
3 changes: 2 additions & 1 deletion src/maps/OverlayedUserFix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include "OverlayedUserFix.h"
#include <cstdlib>

namespace maps {

Expand Down Expand Up @@ -149,7 +150,7 @@ void OverlayedUserFix::splitNameToLines() {
std::size_t splitPos = 0;
std::size_t centre = full_text.size() / 2;
while (pos != std::string::npos) {
if (abs(pos - centre) < abs(splitPos - centre)) {
if (abs((int) pos - (int) centre) < abs((int) splitPos - (int) centre)) {
splitPos = pos;
}
pos = full_text.find_first_of(" ,", pos + 1);
Expand Down

0 comments on commit 3e5e303

Please sign in to comment.