Visual Studio 2013 Compatibility
This commit is contained in:
parent
d3e97d33c7
commit
c9597d6682
|
@ -351,8 +351,13 @@ void Map::setShowZone(tileflags_t zone, bool show)
|
|||
|
||||
void Map::setShowZones(bool show)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
static const uint32 defaultZoneFlags
|
||||
= TILESTATE_HOUSE | TILESTATE_PROTECTIONZONE;
|
||||
#else
|
||||
static constexpr uint32 defaultZoneFlags
|
||||
= TILESTATE_HOUSE | TILESTATE_PROTECTIONZONE;
|
||||
#endif
|
||||
if(!show)
|
||||
m_zoneFlags = 0;
|
||||
else if(m_zoneFlags == 0)
|
||||
|
|
|
@ -1934,7 +1934,7 @@ CreaturePtr ProtocolGame::getCreature(const InputMessagePtr& msg, int type)
|
|||
|
||||
if(g_game.getFeature(Otc::GameThingMarks)) {
|
||||
msg->getU8(); // creature type for summons
|
||||
uint8 mark = msg->getU8(); // mark
|
||||
mark = msg->getU8(); // mark
|
||||
msg->getU16(); // helpers
|
||||
|
||||
if(creature) {
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
#ifndef FRAMEWORK_CONST_H
|
||||
#define FRAMEWORK_CONST_H
|
||||
|
||||
#include "stdext/compiler.h"
|
||||
|
||||
#define DEG_TO_RAD (acos(-1)/180.0)
|
||||
#define RAD_TO_DEC (180.0/acos(-1))
|
||||
|
||||
#define BUILD_COMPILER "gcc " __VERSION__
|
||||
|
||||
#ifndef BUILD_COMMIT
|
||||
#define BUILD_COMMIT "devel"
|
||||
#endif
|
||||
|
@ -52,9 +52,13 @@
|
|||
|
||||
namespace Fw
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
static const float pi = 3.14159265;
|
||||
static const float MIN_ALPHA = 0.003f;
|
||||
#else
|
||||
constexpr float pi = 3.14159265;
|
||||
constexpr float MIN_ALPHA = 0.003f;
|
||||
|
||||
#endif
|
||||
enum Key : unsigned char {
|
||||
KeyUnknown = 0,
|
||||
KeyEscape = 1,
|
||||
|
|
|
@ -103,7 +103,7 @@ inline void glEnableVertexAttribArray (GLuint index) { }
|
|||
inline void glDisableVertexAttribArray (GLuint index) { }
|
||||
|
||||
#else
|
||||
#define GLEW_STATIC
|
||||
//#define GLEW_STATIC
|
||||
#include <GL/glew.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ std::string Platform::getOSName()
|
|||
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
|
||||
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
||||
bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi);
|
||||
bOsVersionInfoEx = VerifyVersionInfo(&osvi, 0, 0);
|
||||
|
||||
if(!bOsVersionInfoEx)
|
||||
return std::string();
|
||||
|
|
|
@ -691,12 +691,12 @@ LRESULT WIN32Window::windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
if(newMousePos.x >= 32767)
|
||||
newMousePos.x = 0;
|
||||
else
|
||||
newMousePos.x = std::min(newMousePos.x, m_size.width());
|
||||
newMousePos.x = std::min<int32>(newMousePos.x, m_size.width());
|
||||
|
||||
if(newMousePos.y >= 32767)
|
||||
newMousePos.y = 0;
|
||||
else
|
||||
newMousePos.y = std::min(newMousePos.y, m_size.height());
|
||||
newMousePos.y = std::min<int32>(newMousePos.y, m_size.height());
|
||||
|
||||
m_inputEvent.mouseMoved = newMousePos - m_inputEvent.mousePos;
|
||||
m_inputEvent.mousePos = newMousePos;
|
||||
|
@ -746,8 +746,8 @@ LRESULT WIN32Window::windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
internalRestoreGLContext();
|
||||
|
||||
Size size = Size(LOWORD(lParam), HIWORD(lParam));
|
||||
size.setWidth(std::max(std::min(size.width(), 7680), 32));
|
||||
size.setHeight(std::max(std::min(size.height(), 4320), 32));
|
||||
size.setWidth(std::max<int32>(std::min<int32>(size.width(), 7680), 32));
|
||||
size.setHeight(std::max<int32>(std::min<int32>(size.height(), 4320), 32));
|
||||
|
||||
if(m_visible && (forceResize || m_size != size)) {
|
||||
m_size = size;
|
||||
|
|
|
@ -25,10 +25,23 @@
|
|||
|
||||
#ifdef __clang__
|
||||
// clang is supported
|
||||
#define BUILD_COMPILER "clang " __VERSION__
|
||||
#elif defined(__GNUC__)
|
||||
#if !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
|
||||
#error "Sorry, you need gcc 4.6 or greater to compile."
|
||||
#endif
|
||||
#define BUILD_COMPILER "gcc " __VERSION__
|
||||
#elif defined(_MSC_VER)
|
||||
#if _MSC_VER < 1800
|
||||
#error "You need Visual Studio 2013 or greater to compile."
|
||||
#endif
|
||||
#pragma warning(disable:4244) // conversion from 'A' to 'B', possible loss of data
|
||||
#pragma warning(disable:4305) // 'initializing' : truncation from 'A' to 'B'
|
||||
#pragma warning(disable:4146) // unary minus operator applied to unsigned type, result still unsigned
|
||||
#pragma warning(disable:4800) // 'A' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
|
||||
#define BUILD_COMPILER "msvc12"
|
||||
#define __PRETTY_FUNCTION__ __FUNCDNAME__
|
||||
#else
|
||||
#error "Compiler not supported."
|
||||
#endif
|
||||
|
@ -44,12 +57,8 @@
|
|||
#define unlikely(x) (x)
|
||||
#endif
|
||||
|
||||
#if !defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
#if !defined(_MSC_VER) && !defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
#error "C++0x is required to compile this application. Try updating your compiler."
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#warning "MSVC lacks some C++11 features used in this application; compilation is most likely to fail."
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,14 +22,24 @@
|
|||
|
||||
#include "demangle.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <windows.h>
|
||||
#include <dbghelp.h>
|
||||
#else
|
||||
#include <cxxabi.h>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
namespace stdext {
|
||||
|
||||
const char* demangle_name(const char* name)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
static char buffer[1024];
|
||||
UnDecorateSymbolName(name, buffer, sizeof(buffer), UNDNAME_COMPLETE);
|
||||
return &buffer[6];
|
||||
#else
|
||||
size_t len;
|
||||
int status;
|
||||
static char buffer[1024];
|
||||
|
@ -39,6 +49,7 @@ const char* demangle_name(const char* name)
|
|||
free(demangled);
|
||||
}
|
||||
return buffer;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,8 +55,14 @@ template<int N> struct expand_snprintf {
|
|||
template<typename Tuple, typename... Args> static int call(char *s, size_t maxlen, const char *format, const Tuple& tuple, const Args&... args) {
|
||||
return expand_snprintf<N-1>::call(s, maxlen, format, tuple, sprintf_cast(std::get<N-1>(tuple)), args...); }};
|
||||
template<> struct expand_snprintf<0> {
|
||||
#ifdef _MSC_VER
|
||||
template<typename Tuple, typename... Args> static int call(char *s, size_t maxlen, const char *format, const Tuple& tuple, const Args&... args) {
|
||||
return snprintf(s, maxlen, format, args...); }};
|
||||
return _snprintf(s, maxlen, format, args...); }
|
||||
#else
|
||||
template<typename Tuple, typename... Args> static int call(char *s, size_t maxlen, const char *format, const Tuple& tuple, const Args&... args) {
|
||||
return snprintf(s, maxlen, format, args...); }
|
||||
#endif
|
||||
};
|
||||
|
||||
// Improved snprintf that accepts std::string and other types
|
||||
template<typename... Args>
|
||||
|
|
|
@ -22,7 +22,11 @@
|
|||
|
||||
#include "time.h"
|
||||
#include <boost/chrono.hpp>
|
||||
#ifdef _MSC_VER
|
||||
#include <thread>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
namespace stdext {
|
||||
|
||||
|
@ -42,12 +46,20 @@ ticks_t micros() {
|
|||
|
||||
void millisleep(size_t ms)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
|
||||
#else
|
||||
usleep(ms * 1000);
|
||||
#endif
|
||||
};
|
||||
|
||||
void microsleep(size_t us)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(us));
|
||||
#else
|
||||
usleep(us);
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -172,9 +172,11 @@ enum TiXmlEncoding
|
|||
TIXML_ENCODING_UTF8,
|
||||
TIXML_ENCODING_LEGACY
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
static const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
|
||||
#else
|
||||
constexpr TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
|
||||
|
||||
#endif
|
||||
/** TiXmlBase is a base class for every class in TinyXml.
|
||||
It does little except to establish that TinyXml classes
|
||||
can be printed and provide some utility functions.
|
||||
|
|
Loading…
Reference in New Issue