mirror of
https://github.com/edubart/otclient.git
synced 2025-12-14 20:59:47 +01:00
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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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()); }
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
Reference in New Issue
Block a user