Compilation for MSVC2013, thanks @dalkon

OTclient now compiles in "Microsoft Visual Studio 2013 Express for Windows Desktop"
All the needed libraries you can download at https://www.dropbox.com/s/2yfb1c763io8efy/otclient-msvc13-libs.zip
NOTE: You have to change VC++ Directories to the properly directories
NOTE: Latested MSVC 2013 or greated is required
This commit is contained in:
Eduardo Bart
2013-11-12 16:31:51 -02:00
parent c9597d6682
commit 1060c6f78c
17 changed files with 1514 additions and 34 deletions

View File

@@ -121,7 +121,7 @@ template<>
inline bool cast(const std::string& in, float& f) {
double d;
if(cast(in, d)) {
f=d;
f=(float)d;
return true;
}
return false;

View File

@@ -38,7 +38,7 @@ const char* demangle_name(const char* name)
#ifdef _MSC_VER
static char buffer[1024];
UnDecorateSymbolName(name, buffer, sizeof(buffer), UNDNAME_COMPLETE);
return &buffer[6];
return buffer;
#else
size_t len;
int status;

View File

@@ -31,6 +31,15 @@ namespace stdext {
/// Demangle names for GNU g++ compiler
const char* demangle_name(const char* name);
/// Returns the name of a class
template<typename T> std::string demangle_class() {
#ifdef _MSC_VER
return demangle_name(typeid(T).name()) + 6;
#else
return demangle_name(typeid(T).name());
#endif
}
/// Returns the name of a type
template<typename T> std::string demangle_type() { return demangle_name(typeid(T).name()); }

View File

@@ -55,13 +55,13 @@ 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> {
template<typename Tuple, typename... Args> static int call(char *s, size_t maxlen, const char *format, const Tuple& tuple, const Args&... args) {
#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...); }
return snprintf(s, maxlen, format, args...);
#endif
}
};
// Improved snprintf that accepts std::string and other types

View File

@@ -36,7 +36,7 @@ void microsleep(size_t us);
struct timer {
public:
timer() { restart(); }
float elapsed_seconds() { return (stdext::micros() - m_start)/1000000.0; }
float elapsed_seconds() { return (float)((stdext::micros() - m_start)/1000000.0); }
ticks_t elapsed_millis() { return (stdext::micros() - m_start)/1000; }
ticks_t elapsed_micros() { return stdext::micros() - m_start; }
void restart() { m_start = stdext::micros(); }