Merge with develop

This commit is contained in:
kervala 2016-01-16 10:52:18 +01:00
parent 88799427bf
commit 628c2b1d80
63 changed files with 1790 additions and 125 deletions

View file

@ -526,7 +526,13 @@ MACRO(NL_SETUP_BUILD)
# Ignore default include paths # Ignore default include paths
ADD_PLATFORM_FLAGS("/X") ADD_PLATFORM_FLAGS("/X")
IF(MSVC12) IF(MSVC14)
ADD_PLATFORM_FLAGS("/Gy- /MP")
# /Ox is working with VC++ 2015, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC12)
ADD_PLATFORM_FLAGS("/Gy- /MP") ADD_PLATFORM_FLAGS("/Gy- /MP")
# /Ox is working with VC++ 2013, but custom optimizations don't exist # /Ox is working with VC++ 2013, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
@ -558,7 +564,7 @@ MACRO(NL_SETUP_BUILD)
SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}") SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}")
ELSE(MSVC12) ELSE(MSVC12)
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}") MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
ENDIF(MSVC12) ENDIF(MSVC14)
ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250") ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250")

View file

@ -354,7 +354,7 @@ public:
} }
else else
{ {
nlerror ("CEntityId looped (max was %"NL_I64"d", MaxEntityId); nlerror ("CEntityId looped (max was %" NL_I64 "d", MaxEntityId);
} }
return *this; return *this;
} }
@ -487,7 +487,7 @@ public:
uint creatorId; uint creatorId;
uint dynamicId; uint dynamicId;
if (sscanf(str, "(%"NL_I64"x:%x:%x:%x)", &id, &type, &creatorId, &dynamicId) != 4) if (sscanf(str, "(%" NL_I64 "x:%x:%x:%x)", &id, &type, &creatorId, &dynamicId) != 4)
{ {
*this = Unknown; *this = Unknown;
return; return;

View file

@ -728,7 +728,7 @@ inline void CMemStream::serial(uint64 &b)
} }
else else
{ {
writenumber( b, "%"NL_I64"u", 20 ); writenumber( b, "%" NL_I64 "u", 20 );
} }
} }
else else
@ -748,7 +748,7 @@ inline void CMemStream::serial(sint64 &b)
} }
else else
{ {
writenumber( b, "%"NL_I64"d", 20 ); writenumber( b, "%" NL_I64 "d", 20 );
} }
} }
else else

View file

@ -352,7 +352,7 @@ public:
} }
}; };
#if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 80 #if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 80 && NL_COMP_VC_VERSION < 140
// This operator only purpose is to compare with NULL value // This operator only purpose is to compare with NULL value
template <class T> template <class T>

View file

@ -186,8 +186,8 @@ inline std::string toString(const uint16 &val) { return toString("%hu", val); }
inline std::string toString(const sint16 &val) { return toString("%hd", val); } inline std::string toString(const sint16 &val) { return toString("%hd", val); }
inline std::string toString(const uint32 &val) { return toString("%u", val); } inline std::string toString(const uint32 &val) { return toString("%u", val); }
inline std::string toString(const sint32 &val) { return toString("%d", val); } inline std::string toString(const sint32 &val) { return toString("%d", val); }
inline std::string toString(const uint64 &val) { return toString("%"NL_I64"u", val); } inline std::string toString(const uint64 &val) { return toString("%" NL_I64 "u", val); }
inline std::string toString(const sint64 &val) { return toString("%"NL_I64"d", val); } inline std::string toString(const sint64 &val) { return toString("%" NL_I64 "d", val); }
#ifdef NL_COMP_GCC #ifdef NL_COMP_GCC
# if GCC_VERSION == 40102 # if GCC_VERSION == 40102
@ -206,7 +206,7 @@ inline std::string toString(const long unsigned int &val)
#endif #endif
#if (SIZEOF_SIZE_T) == 8 #if (SIZEOF_SIZE_T) == 8
inline std::string toString(const size_t &val) { return toString("%"NL_I64"u", val); } inline std::string toString(const size_t &val) { return toString("%" NL_I64 "u", val); }
#else #else
#ifdef NL_OS_MAC #ifdef NL_OS_MAC
inline std::string toString(const size_t &val) { return toString("%u", val); } inline std::string toString(const size_t &val) { return toString("%u", val); }
@ -237,8 +237,8 @@ inline bool fromString(const std::string &str, uint8 &val) { char *end; long v;
inline bool fromString(const std::string &str, sint8 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > SCHAR_MAX || v < SCHAR_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint8)v; return true; } } inline bool fromString(const std::string &str, sint8 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > SCHAR_MAX || v < SCHAR_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint8)v; return true; } }
inline bool fromString(const std::string &str, uint16 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > USHRT_MAX || v < 0 || end == str.c_str()) { val = 0; return false; } else { val = (uint16)v; return true; } } inline bool fromString(const std::string &str, uint16 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > USHRT_MAX || v < 0 || end == str.c_str()) { val = 0; return false; } else { val = (uint16)v; return true; } }
inline bool fromString(const std::string &str, sint16 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > SHRT_MAX || v < SHRT_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint16)v; return true; } } inline bool fromString(const std::string &str, sint16 &val) { char *end; long v; errno = 0; v = strtol(str.c_str(), &end, 10); if (errno || v > SHRT_MAX || v < SHRT_MIN || end == str.c_str()) { val = 0; return false; } else { val = (sint16)v; return true; } }
inline bool fromString(const std::string &str, uint64 &val) { bool ret = sscanf(str.c_str(), "%"NL_I64"u", &val) == 1; if (!ret) val = 0; return ret; } inline bool fromString(const std::string &str, uint64 &val) { bool ret = sscanf(str.c_str(), "%" NL_I64 "u", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const std::string &str, sint64 &val) { bool ret = sscanf(str.c_str(), "%"NL_I64"d", &val) == 1; if (!ret) val = 0; return ret; } inline bool fromString(const std::string &str, sint64 &val) { bool ret = sscanf(str.c_str(), "%" NL_I64 "d", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const std::string &str, float &val) { bool ret = sscanf(str.c_str(), "%f", &val) == 1; if (!ret) val = 0.0f; return ret; } inline bool fromString(const std::string &str, float &val) { bool ret = sscanf(str.c_str(), "%f", &val) == 1; if (!ret) val = 0.0f; return ret; }
inline bool fromString(const std::string &str, double &val) { bool ret = sscanf(str.c_str(), "%lf", &val) == 1; if (!ret) val = 0.0; return ret; } inline bool fromString(const std::string &str, double &val) { bool ret = sscanf(str.c_str(), "%lf", &val) == 1; if (!ret) val = 0.0; return ret; }
@ -286,8 +286,8 @@ inline bool fromString(const char *str, uint8 &val) { char *end; long v; errno =
inline bool fromString(const char *str, sint8 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > SCHAR_MAX || v < SCHAR_MIN || end == str) { val = 0; return false; } else { val = (sint8)v; return true; } } inline bool fromString(const char *str, sint8 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > SCHAR_MAX || v < SCHAR_MIN || end == str) { val = 0; return false; } else { val = (sint8)v; return true; } }
inline bool fromString(const char *str, uint16 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > USHRT_MAX || v < 0 || end == str) { val = 0; return false; } else { val = (uint16)v; return true; } } inline bool fromString(const char *str, uint16 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > USHRT_MAX || v < 0 || end == str) { val = 0; return false; } else { val = (uint16)v; return true; } }
inline bool fromString(const char *str, sint16 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > SHRT_MAX || v < SHRT_MIN || end == str) { val = 0; return false; } else { val = (sint16)v; return true; } } inline bool fromString(const char *str, sint16 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > SHRT_MAX || v < SHRT_MIN || end == str) { val = 0; return false; } else { val = (sint16)v; return true; } }
inline bool fromString(const char *str, uint64 &val) { bool ret = sscanf(str, "%"NL_I64"u", &val) == 1; if (!ret) val = 0; return ret; } inline bool fromString(const char *str, uint64 &val) { bool ret = sscanf(str, "%" NL_I64 "u", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const char *str, sint64 &val) { bool ret = sscanf(str, "%"NL_I64"d", &val) == 1; if (!ret) val = 0; return ret; } inline bool fromString(const char *str, sint64 &val) { bool ret = sscanf(str, "%" NL_I64 "d", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const char *str, float &val) { bool ret = sscanf(str, "%f", &val) == 1; if (!ret) val = 0.0f; return ret; } inline bool fromString(const char *str, float &val) { bool ret = sscanf(str, "%f", &val) == 1; if (!ret) val = 0.0f; return ret; }
inline bool fromString(const char *str, double &val) { bool ret = sscanf(str, "%lf", &val) == 1; if (!ret) val = 0.0; return ret; } inline bool fromString(const char *str, double &val) { bool ret = sscanf(str, "%lf", &val) == 1; if (!ret) val = 0.0; return ret; }

View file

@ -67,7 +67,10 @@
# endif # endif
# ifdef _MSC_VER # ifdef _MSC_VER
# define NL_COMP_VC # define NL_COMP_VC
# if _MSC_VER >= 1800 # if _MSC_VER >= 1900
# define NL_COMP_VC14
# define NL_COMP_VC_VERSION 140
# elif _MSC_VER >= 1800
# define NL_COMP_VC12 # define NL_COMP_VC12
# define NL_COMP_VC_VERSION 120 # define NL_COMP_VC_VERSION 120
# elif _MSC_VER >= 1700 # elif _MSC_VER >= 1700
@ -303,7 +306,7 @@
* Used to display a int64 in a platform independent way with printf like functions. * Used to display a int64 in a platform independent way with printf like functions.
\code \code
sint64 myint64 = SINT64_CONSTANT(0x123456781234); sint64 myint64 = SINT64_CONSTANT(0x123456781234);
printf("This is a 64 bits int: %"NL_I64"u", myint64); printf("This is a 64 bits int: %" NL_I64 "u", myint64);
\endcode \endcode
*/ */

View file

@ -64,6 +64,8 @@ public:
virtual void getWindowPos (uint32 &x, uint32 &y, uint32 &w, uint32 &h) { x=y=w=h=0; } virtual void getWindowPos (uint32 &x, uint32 &y, uint32 &w, uint32 &h) { x=y=w=h=0; }
static std::string stringifyMessage(const NLMISC::CLog::TDisplayInfo &args, const char *message, bool needSlashR = false);
protected: protected:
// display a string (MT) // display a string (MT)

View file

@ -299,7 +299,7 @@ void CClient::updatePong (sint64 pingTime, sint64 pongTime, uint32 pongNumber, u
} }
else else
{ {
fprintf (fp, "%"NL_I64"d\t%"NL_I64"d\t%"NL_I64"d\t%d\n", pongTime, pingTime, (pongTime-pingTime), pongNumber); fprintf (fp, "%" NL_I64 "d\t%" NL_I64 "d\t%" NL_I64 "d\t%d\n", pongTime, pingTime, (pongTime-pingTime), pongNumber);
fclose (fp); fclose (fp);
} }
} }
@ -578,7 +578,7 @@ void handleReceivedPong (CClient *client, sint64 pongTime)
uint32 blockNumber = 0; uint32 blockNumber = 0;
msgin.serial(blockNumber); msgin.serial(blockNumber);
// nlinfo ("receive a pong from %s pongnb %d %"NL_I64"d", CurrentInMsg->AddrFrom.asString().c_str(), pongNumber, pongTime - pingTime); // nlinfo ("receive a pong from %s pongnb %d %" NL_I64 "d", CurrentInMsg->AddrFrom.asString().c_str(), pongNumber, pongTime - pingTime);
client->updatePong (pingTime, pongTime, pongNumber, blockNumber); client->updatePong (pingTime, pongTime, pongNumber, blockNumber);
} }

View file

@ -142,7 +142,7 @@ void sendUDPNow (CUdpSock *client, const uint8 *packet, uint32 packetSize, const
client->sendTo (packet, packetSize, *addr); client->sendTo (packet, packetSize, *addr);
uint32 packetNumber = *(uint32 *)packet; uint32 packetNumber = *(uint32 *)packet;
// nlinfo ("time %"NL_I64"u sending now packet %5u", CTime::getLocalTime (), packetNumber); // nlinfo ("time %" NL_I64 "u sending now packet %5u", CTime::getLocalTime (), packetNumber);
} }
void sendUDP (CUdpSock *client, const uint8 *packet, uint32 packetSize, const CInetAddress *addr) void sendUDP (CUdpSock *client, const uint8 *packet, uint32 packetSize, const CInetAddress *addr)

View file

@ -99,7 +99,7 @@ IDriver *CDRU::createGlDriver() throw (EDru)
throw EDruOpenglDriverNotFound(); throw EDruOpenglDriverNotFound();
} }
nlinfo ("Using the library '"NL3D_GL_DLL_NAME"' that is in the directory: '%s'", driverLib.getLibFileName().c_str()); nlinfo ("Using the library '" NL3D_GL_DLL_NAME "' that is in the directory: '%s'", driverLib.getLibFileName().c_str());
createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME); createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME);
if (createDriver == NULL) if (createDriver == NULL)
@ -153,7 +153,7 @@ IDriver *CDRU::createGlEsDriver() throw (EDru)
throw EDruOpenglEsDriverNotFound(); throw EDruOpenglEsDriverNotFound();
} }
nlinfo ("Using the library '"NL3D_GLES_DLL_NAME"' that is in the directory: '%s'", driverLib.getLibFileName().c_str()); nlinfo ("Using the library '" NL3D_GLES_DLL_NAME "' that is in the directory: '%s'", driverLib.getLibFileName().c_str());
createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME); createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME);
if (createDriver == NULL) if (createDriver == NULL)
@ -206,7 +206,7 @@ IDriver *CDRU::createD3DDriver() throw (EDru)
throw EDruDirect3dDriverNotFound(); throw EDruDirect3dDriverNotFound();
} }
nlinfo ("Using the library '"NL3D_D3D_DLL_NAME"' that is in the directory: '%s'", driverLib.getLibFileName().c_str()); nlinfo ("Using the library '" NL3D_D3D_DLL_NAME "' that is in the directory: '%s'", driverLib.getLibFileName().c_str());
createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME); createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME);
if (createDriver == NULL) if (createDriver == NULL)

View file

@ -385,7 +385,7 @@ void CTextureDLM::releaseLightMap(uint x, uint y)
// Free this bit in the block. // Free this bit in the block.
nlassert(block->FreeSpace & mask); nlassert(block->FreeSpace & mask);
block->FreeSpace&= ~mask; block->FreeSpace&= (~mask & std::numeric_limits<uint>::max());
// Free the block if necessary. // Free the block if necessary.

View file

@ -422,7 +422,7 @@ namespace NLGUI
{ {
nlassert(key); nlassert(key);
nlassert(isValid()); nlassert(isValid());
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%d"NL_I64"' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename())); if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%d" NL_I64 "' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename()));
CLuaStackChecker lsc(_LuaState); CLuaStackChecker lsc(_LuaState);
push(); push();
_LuaState->push(key); _LuaState->push(key);

View file

@ -836,7 +836,7 @@ std::string CBitMemStream::getSerialItem( const TBMSSerialInfo& serialItem )
{ {
uint64 u; uint64 u;
serial( u, serialItem.BitSize ); serial( u, serialItem.BitSize );
s = NLMISC::toString( "%"NL_I64"u", u ); s = NLMISC::toString( "%" NL_I64 "u", u );
break; break;
} }
case TBMSSerialInfo::F: // what about double? case TBMSSerialInfo::F: // what about double?

View file

@ -538,9 +538,9 @@ void CBufFIFO::displayStats (CLog *log)
log->displayNL ("%p BiggestBlock: %d, SmallestBlock: %d", this, _BiggestBlock, _SmallestBlock); log->displayNL ("%p BiggestBlock: %d, SmallestBlock: %d", this, _BiggestBlock, _SmallestBlock);
log->displayNL ("%p BiggestBuffer: %d, SmallestBuffer: %d", this, _BiggestBuffer, _SmallestBuffer); log->displayNL ("%p BiggestBuffer: %d, SmallestBuffer: %d", this, _BiggestBuffer, _SmallestBuffer);
log->displayNL ("%p Pushed: %d, PushedTime: total %"NL_I64"d ticks, mean %f ticks", this, _Pushed, _PushedTime, (_Pushed>0?(double)(sint64)_PushedTime / (double)_Pushed:0.0)); log->displayNL ("%p Pushed: %d, PushedTime: total %" NL_I64 "d ticks, mean %f ticks", this, _Pushed, _PushedTime, (_Pushed>0?(double)(sint64)_PushedTime / (double)_Pushed:0.0));
log->displayNL ("%p Fronted: %d, FrontedTime: total %"NL_I64"d ticks, mean %f ticks", this, _Fronted, _FrontedTime, (_Fronted>0?(double)(sint64)_FrontedTime / (double)_Fronted:0.0)); log->displayNL ("%p Fronted: %d, FrontedTime: total %" NL_I64 "d ticks, mean %f ticks", this, _Fronted, _FrontedTime, (_Fronted>0?(double)(sint64)_FrontedTime / (double)_Fronted:0.0));
log->displayNL ("%p Resized: %d, ResizedTime: total %"NL_I64"d ticks, mean %f ticks", this, _Resized, _ResizedTime, (_Resized>0?(double)(sint64)_ResizedTime / (double)_Resized:0.0)); log->displayNL ("%p Resized: %d, ResizedTime: total %" NL_I64 "d ticks, mean %f ticks", this, _Resized, _ResizedTime, (_Resized>0?(double)(sint64)_ResizedTime / (double)_Resized:0.0));
} }
void CBufFIFO::display () void CBufFIFO::display ()

View file

@ -120,7 +120,7 @@ ICDBNode * CCDBNodeLeaf::getNode (const CTextId& id, bool /* bCreate */)
//----------------------------------------------- //-----------------------------------------------
void CCDBNodeLeaf::write( CTextId& id, FILE * f) void CCDBNodeLeaf::write( CTextId& id, FILE * f)
{ {
fprintf(f,"%"NL_I64"d\t%s\n",_Property,id.toString().c_str()); fprintf(f,"%" NL_I64 "d\t%s\n",_Property,id.toString().c_str());
} // write // } // write //
//----------------------------------------------- //-----------------------------------------------
@ -165,7 +165,7 @@ void CCDBNodeLeaf::readDelta(TGameCycle gc, CBitMemStream & f )
} }
if ( verboseDatabase ) if ( verboseDatabase )
{ {
nlinfo( "CDB: Read value (%u bits) %"NL_I64"d", bits, _Property ); nlinfo( "CDB: Read value (%u bits) %" NL_I64 "d", bits, _Property );
} }
// bkup the date of change // bkup the date of change

View file

@ -380,7 +380,7 @@ string bytesToHumanReadable (uint64 bytes)
div++; div++;
res = newres; res = newres;
} }
return toString ("%"NL_I64"u%s", res, divTable[div]); return toString ("%" NL_I64 "u%s", res, divTable[div]);
} }
uint32 humanReadableToBytes (const string &str) uint32 humanReadableToBytes (const string &str)

View file

@ -49,7 +49,7 @@ bool CCPUTimeStat::getCPUTicks(uint64& user, uint64& nice, uint64& system, uint6
// /proc/stat // /proc/stat
// cpu [user] [nice] [system] [idle] [iowait] [irq] [softirq] // cpu [user] [nice] [system] [idle] [iowait] [irq] [softirq]
if (fscanf(f, "cpu %"NL_I64"u %"NL_I64"u %"NL_I64"u %"NL_I64"u %"NL_I64"u", &user, &nice, &system, &idle, &iowait) != 5) if (fscanf(f, "cpu %" NL_I64 "u %" NL_I64 "u %" NL_I64 "u %" NL_I64 "u %" NL_I64 "u", &user, &nice, &system, &idle, &iowait) != 5)
nlwarning("Failed to parse /proc/stat"); nlwarning("Failed to parse /proc/stat");
fclose(f); fclose(f);
@ -73,7 +73,7 @@ bool CCPUTimeStat::getPIDTicks(uint64& utime, uint64& stime, uint64& cutime, uin
// /proc/<pid>/stat // /proc/<pid>/stat
// pid com sta ppi pgi ses tty tpg fla mif maf cmi cma [utime] [stime] [cutime] [cstime] ... // pid com sta ppi pgi ses tty tpg fla mif maf cmi cma [utime] [stime] [cutime] [cstime] ...
if (fscanf(f, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %"NL_I64"u %"NL_I64"u %"NL_I64"u %"NL_I64"u", &utime, &stime, &cutime, &cstime) != 4) if (fscanf(f, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %" NL_I64 "u %" NL_I64 "u %" NL_I64 "u %" NL_I64 "u", &utime, &stime, &cutime, &cstime) != 4)
nlwarning("Failed to parse /proc/<pid>/stat"); nlwarning("Failed to parse /proc/<pid>/stat");
fclose(f); fclose(f);

View file

@ -864,18 +864,18 @@ public:
else if(type == "int") else if(type == "int")
{ {
if (!IsBadReadPtr(addr,sizeof(int))) if (!IsBadReadPtr(addr,sizeof(int)))
sprintf (tmp, "%d", *addr); sprintf (tmp, "%p", (void *)(*addr));
} }
else if (type == "char") else if (type == "char")
{ {
if (!IsBadReadPtr(addr,sizeof(char))) if (!IsBadReadPtr(addr,sizeof(char)))
if (nlisprint(*addr)) if (nlisprint(*addr))
{ {
sprintf (tmp, "'%c'", *addr); sprintf (tmp, "'%c'", (char)((*addr) & 0xFF));
} }
else else
{ {
sprintf (tmp, "%d", *addr); sprintf (tmp, "%p", (void *)(*addr));
} }
} }
else if (type == "char*") else if (type == "char*")
@ -932,7 +932,7 @@ public:
if(*addr == 0) if(*addr == 0)
sprintf (tmp, "<NULL>"); sprintf (tmp, "<NULL>");
else else
sprintf (tmp, "0x%p", *addr); sprintf (tmp, "0x%p", (void *)*addr);
} }
} }

View file

@ -945,7 +945,7 @@ CEvalNumExpr::TReturnState CEvalNumExpr::evalExpression (double &finalResult, TT
value = (double)(uint)((floor (value+0.5)==0.0)); value = (double)(uint)((floor (value+0.5)==0.0));
break; break;
case Tilde: case Tilde:
value = (double)~((uint)floor (value+0.5)); value = (double)(~((uint)floor (value+0.5)) & std::numeric_limits<uint>::max());
break; break;
case Minus: case Minus:
value = -value; value = -value;

View file

@ -791,7 +791,7 @@ NLMISC_CATEGORISED_COMMAND(nel, iFileAccessLogDisplay, "Display file access logs
while (atIt!=atItEnd) while (atIt!=atItEnd)
{ {
uint64 delta= (*atIt-IFileAccessLogStartTime); uint64 delta= (*atIt-IFileAccessLogStartTime);
log.display("%"NL_I64"u,",delta); log.display("%" NL_I64 "u,",delta);
++atIt; ++atIt;
} }
log.displayNL(""); log.displayNL("");

View file

@ -99,7 +99,7 @@ static string getFuncInfo (DWORD_TYPE funcAddr, DWORD_TYPE stackAddr)
if (stop==0 && (parse[i] == ',' || parse[i] == ')')) if (stop==0 && (parse[i] == ',' || parse[i] == ')'))
{ {
char tmp[32]; char tmp[32];
sprintf(tmp, "=0x%p", *((DWORD_TYPE*)(stackAddr) + 2 + pos++)); sprintf(tmp, "=0x%p", (void *)(*((DWORD_TYPE*)(stackAddr) + 2 + pos++)));
str += tmp; str += tmp;
} }
str += parse[i]; str += parse[i];

View file

@ -327,14 +327,14 @@ void COXml::serial(sint32 &b)
void COXml::serial(uint64 &b) void COXml::serial(uint64 &b)
{ {
writenumber( b, "%"NL_I64"u", 20 ); writenumber( b, "%" NL_I64 "u", 20 );
} }
// *************************************************************************** // ***************************************************************************
void COXml::serial(sint64 &b) void COXml::serial(sint64 &b)
{ {
writenumber( b, "%"NL_I64"d", 20 ); writenumber( b, "%" NL_I64 "d", 20 );
} }
// *************************************************************************** // ***************************************************************************

View file

@ -23,6 +23,32 @@
#include <windows.h> #include <windows.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#ifdef DXGI_STATUS_OCCLUDED
#undef DXGI_STATUS_OCCLUDED
#undef DXGI_STATUS_CLIPPED
#undef DXGI_STATUS_NO_REDIRECTION
#undef DXGI_STATUS_NO_DESKTOP_ACCESS
#undef DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE
#undef DXGI_STATUS_MODE_CHANGED
#undef DXGI_STATUS_MODE_CHANGE_IN_PROGRESS
#endif
#ifdef DXGI_ERROR_INVALID_CALL
#undef DXGI_ERROR_INVALID_CALL
#undef DXGI_ERROR_NOT_FOUND
#undef DXGI_ERROR_MORE_DATA
#undef DXGI_ERROR_UNSUPPORTED
#undef DXGI_ERROR_DEVICE_REMOVED
#undef DXGI_ERROR_DEVICE_HUNG
#undef DXGI_ERROR_DEVICE_RESET
#undef DXGI_ERROR_WAS_STILL_DRAWING
#undef DXGI_ERROR_FRAME_STATISTICS_DISJOINT
#undef DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE
#undef DXGI_ERROR_DRIVER_INTERNAL_ERROR
#undef DXGI_ERROR_NONEXCLUSIVE
#undef DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
#undef DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED
#undef DXGI_ERROR_REMOTE_OUTOFMEMORY
#endif
#include <dxgi.h> #include <dxgi.h>
#include <initguid.h> #include <initguid.h>
#include <CGuid.h> #include <CGuid.h>

View file

@ -116,26 +116,20 @@ void CWindowDisplayer::create (string windowNameEx, bool iconified, sint x, sint
_Thread->start (); _Thread->start ();
} }
void CWindowDisplayer::doDisplay (const NLMISC::CLog::TDisplayInfo &args, const char *message) std::string CWindowDisplayer::stringifyMessage(const NLMISC::CLog::TDisplayInfo &args, const char *message, bool needSlashR)
{ {
bool needSpace = false; bool needSpace = false;
//stringstream ss; //stringstream ss;
string str; string str;
uint32 color = 0xFF000000;
if (args.LogType != CLog::LOG_NO) if (args.LogType != CLog::LOG_NO)
{ {
str += logTypeToString(args.LogType); str += CWindowDisplayer::logTypeToString(args.LogType);
if (args.LogType == CLog::LOG_ERROR || args.LogType == CLog::LOG_ASSERT) color = 0x00FF0000;
else if (args.LogType == CLog::LOG_WARNING) color = 0x00800000;
else if (args.LogType == CLog::LOG_DEBUG) color = 0x00808080;
else color = 0;
needSpace = true; needSpace = true;
} }
// Write thread identifier // Write thread identifier
if ( args.ThreadId != 0 ) if (args.ThreadId != 0)
{ {
if (needSpace) { str += " "; needSpace = false; } if (needSpace) { str += " "; needSpace = false; }
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
@ -173,7 +167,7 @@ void CWindowDisplayer::doDisplay (const NLMISC::CLog::TDisplayInfo &args, const
uint nbl = 1; uint nbl = 1;
char *npos, *pos = const_cast<char *>(message); char *npos, *pos = const_cast<char *>(message);
while ((npos = strchr (pos, '\n'))) while ((npos = strchr(pos, '\n')))
{ {
*npos = '\0'; *npos = '\0';
str += pos; str += pos;
@ -181,13 +175,13 @@ void CWindowDisplayer::doDisplay (const NLMISC::CLog::TDisplayInfo &args, const
str += "\r"; str += "\r";
str += "\n"; str += "\n";
*npos = '\n'; *npos = '\n';
pos = npos+1; pos = npos + 1;
nbl++; nbl++;
} }
str += pos; str += pos;
pos = const_cast<char *>(args.CallstackAndLog.c_str()); pos = const_cast<char *>(args.CallstackAndLog.c_str());
while ((npos = strchr (pos, '\n'))) while ((npos = strchr(pos, '\n')))
{ {
*npos = '\0'; *npos = '\0';
str += pos; str += pos;
@ -195,11 +189,28 @@ void CWindowDisplayer::doDisplay (const NLMISC::CLog::TDisplayInfo &args, const
str += "\r"; str += "\r";
str += "\n"; str += "\n";
*npos = '\n'; *npos = '\n';
pos = npos+1; pos = npos + 1;
nbl++; nbl++;
} }
str += pos; str += pos;
return str;
}
void CWindowDisplayer::doDisplay (const NLMISC::CLog::TDisplayInfo &args, const char *message)
{
uint32 color = 0xFF000000;
if (args.LogType != CLog::LOG_NO)
{
if (args.LogType == CLog::LOG_ERROR || args.LogType == CLog::LOG_ASSERT) color = 0x00FF0000;
else if (args.LogType == CLog::LOG_WARNING) color = 0x00800000;
else if (args.LogType == CLog::LOG_DEBUG) color = 0x00808080;
else color = 0;
}
std::string str = stringifyMessage(args, message, needSlashR);
{ {
CSynchronized<std::list<std::pair<uint32, std::string> > >::CAccessor access (&_Buffer); CSynchronized<std::list<std::pair<uint32, std::string> > >::CAccessor access (&_Buffer);
if (_HistorySize > 0 && access.value().size() >= (uint)_HistorySize) if (_HistorySize > 0 && access.value().size() >= (uint)_HistorySize)

View file

@ -716,7 +716,7 @@ uint64 CBufServer::newBytesReceived()
{ {
uint64 b = bytesReceived(); uint64 b = bytesReceived();
uint64 nbrecvd = b - _PrevBytesPoppedIn; uint64 nbrecvd = b - _PrevBytesPoppedIn;
//nlinfo( "b: %"NL_I64"u new: %"NL_I64"u", b, nbrecvd ); //nlinfo( "b: %" NL_I64 "u new: %" NL_I64 "u", b, nbrecvd );
_PrevBytesPoppedIn = b; _PrevBytesPoppedIn = b;
return nbrecvd; return nbrecvd;
} }
@ -728,7 +728,7 @@ uint64 CBufServer::newBytesSent()
{ {
uint64 b = bytesSent(); uint64 b = bytesSent();
uint64 nbsent = b - _PrevBytesPushedOut; uint64 nbsent = b - _PrevBytesPushedOut;
//nlinfo( "b: %"NL_I64"u new: %"NL_I64"u", b, nbsent ); //nlinfo( "b: %" NL_I64 "u new: %" NL_I64 "u", b, nbsent );
_PrevBytesPushedOut = b; _PrevBytesPushedOut = b;
return nbsent; return nbsent;
} }

View file

@ -311,7 +311,7 @@ void CCallbackClient::connect( const CInetAddress& addr )
throw ESocketConnectionFailed( addr ); throw ESocketConnectionFailed( addr );
//break; //break;
default : default :
nlwarning( "LNETL3C: No connection event in replay data, at update #%"NL_I64"u", _MR_UpdateCounter ); nlwarning( "LNETL3C: No connection event in replay data, at update #%" NL_I64 "u", _MR_UpdateCounter );
} }
} }
#endif #endif
@ -346,7 +346,7 @@ void CCallbackClient::disconnect( TSockId hostid )
// Read (skip) disconnection in the file // Read (skip) disconnection in the file
if ( ! (_MR_Recorder.checkNextOne( _MR_UpdateCounter ) == Disconnecting) ) if ( ! (_MR_Recorder.checkNextOne( _MR_UpdateCounter ) == Disconnecting) )
{ {
nlwarning( "LNETL3C: No disconnection event in the replay data, at update #%"NL_I64"u", _MR_UpdateCounter ); nlwarning( "LNETL3C: No disconnection event in the replay data, at update #%" NL_I64 "u", _MR_UpdateCounter );
} }
} }
// Record or replay disconnection (because disconnect() in the client does not push a disc. event) // Record or replay disconnection (because disconnect() in the client does not push a disc. event)

View file

@ -301,7 +301,7 @@ TNetworkEvent CMessageRecorder::checkNextOne( sint64 updatecounter )
TMessageRecord record; TMessageRecord record;
if ( getNext( record, updatecounter ) ) if ( getNext( record, updatecounter ) )
{ {
nldebug( "MR: Check next one: %s at update %"NL_I64"u", EventToString(record.Event).c_str(), updatecounter ); nldebug( "MR: Check next one: %s at update %" NL_I64 "u", EventToString(record.Event).c_str(), updatecounter );
return record.Event; return record.Event;
} }
else else
@ -330,7 +330,7 @@ TNetworkEvent CMessageRecorder::replayConnectionAttempt( const CInetAddress& add
{ {
// Found // Found
event = (*ipr).Event; event = (*ipr).Event;
nldebug( "MR: Connection attempt found at update %"NL_I64"u", (*ipr).UpdateCounter ); nldebug( "MR: Connection attempt found at update %" NL_I64 "u", (*ipr).UpdateCounter );
_ConnectionAttempts.erase( ipr ); _ConnectionAttempts.erase( ipr );
return event; return event;
} }
@ -348,7 +348,7 @@ TNetworkEvent CMessageRecorder::replayConnectionAttempt( const CInetAddress& add
if ( stored_addr == addr ) if ( stored_addr == addr )
{ {
// Found // Found
nldebug( "MR: Connection attempt found at update %"NL_I64"u", (*ipr).UpdateCounter ); nldebug( "MR: Connection attempt found at update %" NL_I64 "u", (*ipr).UpdateCounter );
_PreloadedRecords.erase( ipr ); _PreloadedRecords.erase( ipr );
return event; return event;
} }
@ -367,7 +367,7 @@ TNetworkEvent CMessageRecorder::replayConnectionAttempt( const CInetAddress& add
if ( stored_addr == addr ) if ( stored_addr == addr )
{ {
// Found // Found
nldebug( "MR: Connection attempt found at update %"NL_I64"u", rec.UpdateCounter ); nldebug( "MR: Connection attempt found at update %" NL_I64 "u", rec.UpdateCounter );
return rec.Event; return rec.Event;
} }
else else

View file

@ -72,12 +72,12 @@ void CNetLog::output( const char *srchost, uint8 msgnum,
const char *desthost, const char *msgname, uint32 msgsize ) const char *desthost, const char *msgname, uint32 msgsize )
{ {
/*OLD char line [1024]; /*OLD char line [1024];
smprintf( line, 1024, "@@%"NL_I64"d@%s@%hu@%s@%s@%s@%u@", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0), smprintf( line, 1024, "@@%" NL_I64 "d@%s@%hu@%s@%s@%s@%u@", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0),
srchost, (uint16)msgnum, _ProcessName.c_str(), desthost, msgname, msgsize ); srchost, (uint16)msgnum, _ProcessName.c_str(), desthost, msgname, msgsize );
displayRawNL( line ); displayRawNL( line );
*/ */
/* displayRawNL( "@@%"NL_I64"d@%s@%hu@%s@%s@%s@%u@", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0), /* displayRawNL( "@@%" NL_I64 "d@%s@%hu@%s@%s@%s@%u@", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0),
srchost, (uint16)msgnum, _ProcessName.c_str(), desthost, msgname, msgsize ); srchost, (uint16)msgnum, _ProcessName.c_str(), desthost, msgname, msgsize );
*/ */
displayRawNL( "@@0@%s@%hu@%s@%s@%s@%u@", displayRawNL( "@@0@%s@%hu@%s@%s@%s@%u@",
@ -91,11 +91,11 @@ void CNetLog::output( const char *srchost, uint8 msgnum,
void CNetLog::input( const char *srchost, uint8 msgnum, const char *desthost ) void CNetLog::input( const char *srchost, uint8 msgnum, const char *desthost )
{ {
/*OLD char line [1024]; /*OLD char line [1024];
smprintf( line, 1024, "##%"NL_I64"d#%s#%hu#%s#%s#", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0), smprintf( line, 1024, "##%" NL_I64 "d#%s#%hu#%s#%s#", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0),
srchost, msgnum, _ProcessName.c_str(), desthost ); srchost, msgnum, _ProcessName.c_str(), desthost );
displayRawNL( line ); displayRawNL( line );
*/ */
/* displayRawNL( "##%"NL_I64"d#%s#%hu#%s#%s#", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0), /* displayRawNL( "##%" NL_I64 "d#%s#%hu#%s#%s#", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0),
srchost, msgnum, _ProcessName.c_str(), desthost ); srchost, msgnum, _ProcessName.c_str(), desthost );
*/ */
displayRawNL( "##0#%s#%hu#%s#%s#", displayRawNL( "##0#%s#%hu#%s#%s#",

View file

@ -838,7 +838,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName,
} }
} }
nlinfo ("SERVICE: Starting Service '%s' using NeL ("__DATE__" "__TIME__") compiled %s", _ShortName.c_str(), CompilationDate.c_str()); nlinfo ("SERVICE: Starting Service '%s' using NeL (" __DATE__ " " __TIME__ ") compiled %s", _ShortName.c_str(), CompilationDate.c_str());
nlinfo ("SERVICE: On OS: %s", CSystemInfo::getOS().c_str()); nlinfo ("SERVICE: On OS: %s", CSystemInfo::getOS().c_str());
setExitStatus (EXIT_SUCCESS); setExitStatus (EXIT_SUCCESS);
@ -1802,7 +1802,7 @@ NLMISC_CATEGORISED_COMMAND(nel, serviceInfo, "display information about this ser
if(args.size() != 0) return false; if(args.size() != 0) return false;
log.displayNL ("Service %s '%s' using NeL ("__DATE__" "__TIME__")", IService::getInstance()->getServiceLongName().c_str(), IService::getInstance()->getServiceUnifiedName().c_str()); log.displayNL ("Service %s '%s' using NeL (" __DATE__ " " __TIME__ ")", IService::getInstance()->getServiceLongName().c_str(), IService::getInstance()->getServiceUnifiedName().c_str());
log.displayNL ("Service listening port: %d", IService::getInstance()->ListeningPort.get()); log.displayNL ("Service listening port: %d", IService::getInstance()->ListeningPort.get());
log.displayNL ("Service running directory: '%s'", IService::getInstance()->RunningDirectory.c_str()); log.displayNL ("Service running directory: '%s'", IService::getInstance()->RunningDirectory.c_str());
log.displayNL ("Service log directory: '%s'", IService::getInstance()->LogDirectory.c_str()); log.displayNL ("Service log directory: '%s'", IService::getInstance()->LogDirectory.c_str());

View file

@ -251,7 +251,7 @@ void uncbServiceIdentification(CMessage &msgin, TSockId from, CCallbackNetBase &
TServiceId inSid; TServiceId inSid;
if (from->appId () != AppIdDeadConnection) if (from->appId () != AppIdDeadConnection)
AUTOCHECK_DISPLAY ("HNETL5: received a connect ident from an unknown connection 0x%"NL_I64"X", from->appId ()); AUTOCHECK_DISPLAY ("HNETL5: received a connect ident from an unknown connection 0x%" NL_I64 "X", from->appId ());
// recover the service name and id // recover the service name and id
msgin.serial(inSName); msgin.serial(inSName);
@ -362,7 +362,7 @@ void uncbMsgProcessing(CMessage &msgin, TSockId from, CCallbackNetBase &/* netba
if (uc == 0) if (uc == 0)
{ {
nlwarning ("HNETL5: Received a message from a service %hu that is not ready (bad appid? 0x%"NL_I64"X)", sid.get(), from->appId ()); nlwarning ("HNETL5: Received a message from a service %hu that is not ready (bad appid? 0x%" NL_I64 "X)", sid.get(), from->appId ());
return; return;
} }
if((*itcb).second == 0) if((*itcb).second == 0)
@ -1139,7 +1139,7 @@ void CUnifiedNetwork::update(TTime timeout)
if ( remainingTime > prevRemainingTime ) if ( remainingTime > prevRemainingTime )
{ {
// Restart at previousTime // Restart at previousTime
nldebug( "Backward time sync detected (at least -%"NL_I64"d ms)", remainingTime - prevRemainingTime ); nldebug( "Backward time sync detected (at least -%" NL_I64 "d ms)", remainingTime - prevRemainingTime );
remainingTime = prevRemainingTime; remainingTime = prevRemainingTime;
t0 = currentTime - (timeout - remainingTime); t0 = currentTime - (timeout - remainingTime);
} }
@ -1935,7 +1935,7 @@ void CUnifiedNetwork::autoCheck()
for (j = 0; j < _IdCnx[i].Connections.size (); j++) for (j = 0; j < _IdCnx[i].Connections.size (); j++)
{ {
if (_IdCnx[i].Connections[j].valid() && !_IdCnx[i].Connections[j].IsServerConnection && _IdCnx[i].Connections[j].CbNetBase->connected () && _IdCnx[i].Connections[j].getAppId() != i) AUTOCHECK_DISPLAY ("HLNET5: sid %d bad appid %"NL_I64"X", i, _IdCnx[i].Connections[j].getAppId()); if (_IdCnx[i].Connections[j].valid() && !_IdCnx[i].Connections[j].IsServerConnection && _IdCnx[i].Connections[j].CbNetBase->connected () && _IdCnx[i].Connections[j].getAppId() != i) AUTOCHECK_DISPLAY ("HLNET5: sid %d bad appid %" NL_I64 "X", i, _IdCnx[i].Connections[j].getAppId());
} }
for (j = 0; j < _IdCnx[i].NetworkConnectionAssociations.size (); j++) for (j = 0; j < _IdCnx[i].NetworkConnectionAssociations.size (); j++)

View file

@ -44,11 +44,11 @@ void _CUniTime::setUniTime (NLMISC::TTime /* uTime */, NLMISC::TTime /* lTime */
TTime lt = getLocalTime (); TTime lt = getLocalTime ();
TTime delta = uTime - lTime + _SyncLocalTime - _SyncUniTime; TTime delta = uTime - lTime + _SyncLocalTime - _SyncUniTime;
nlinfo ("_CUniTime::setUniTime(%"NL_I64"d, %"NL_I64"d): Resyncing delta %"NL_I64"dms",uTime,lTime,delta); nlinfo ("_CUniTime::setUniTime(%" NL_I64 "d, %" NL_I64 "d): Resyncing delta %" NL_I64 "dms",uTime,lTime,delta);
} }
else else
{ {
nlinfo ("_CUniTime::setUniTime(%"NL_I64"d, %"NL_I64"d)",uTime,lTime); nlinfo ("_CUniTime::setUniTime(%" NL_I64 "d, %" NL_I64 "d)",uTime,lTime);
Sync = true; Sync = true;
} }
_SyncUniTime = uTime; _SyncUniTime = uTime;
@ -191,7 +191,7 @@ void _CUniTime::syncUniTimeFromService (CCallbackNetBase::TRecordingState /* rec
after = CTime::getLocalTime (); after = CTime::getLocalTime ();
delta = after - before; delta = after - before;
nlinfo ("_CUniTime::syncUniTimeFromService(): ping:%"NL_I64"dms, time:%ds, unitime:%"NL_I64"dms", delta, GetUniversalTimeSecondsSince1970, GetUniversalTimeUniTime); nlinfo ("_CUniTime::syncUniTimeFromService(): ping:%" NL_I64 "dms, time:%ds, unitime:%" NL_I64 "dms", delta, GetUniversalTimeSecondsSince1970, GetUniversalTimeUniTime);
// <-- from here to the "-->" comment, the block must be executed in less than one second or an infinite loop occurs // <-- from here to the "-->" comment, the block must be executed in less than one second or an infinite loop occurs
@ -222,11 +222,11 @@ void _CUniTime::syncUniTimeFromService (CCallbackNetBase::TRecordingState /* rec
// adjust the unitime to the current localtime // adjust the unitime to the current localtime
GetUniversalTimeUniTime += deltaAdjust; GetUniversalTimeUniTime += deltaAdjust;
nlinfo ("_CUniTime::syncUniTimeFromService(): rtime:%ds, runitime:%"NL_I64"ds, rlocaltime:%"NL_I64"d, deltaAjust:%"NL_I64"dms", nextsecond, GetUniversalTimeUniTime, lt, deltaAdjust); nlinfo ("_CUniTime::syncUniTimeFromService(): rtime:%ds, runitime:%" NL_I64 "ds, rlocaltime:%" NL_I64 "d, deltaAjust:%" NL_I64 "dms", nextsecond, GetUniversalTimeUniTime, lt, deltaAdjust);
} }
else else
{ {
nlinfo ("_CUniTime::syncUniTimeFromService(): runitime:%"NL_I64"ds, rlocaltime:%"NL_I64"d", GetUniversalTimeUniTime, lt); nlinfo ("_CUniTime::syncUniTimeFromService(): runitime:%" NL_I64 "ds, rlocaltime:%" NL_I64 "d", GetUniversalTimeUniTime, lt);
} }
_CUniTime::setUniTime (GetUniversalTimeUniTime, lt); _CUniTime::setUniTime (GetUniversalTimeUniTime, lt);
@ -256,7 +256,7 @@ static void cbServerAskUniversalTime (CMessage& /* msgin */, TSockId from, CCall
TTime ut = _CUniTime::getUniTime (); TTime ut = _CUniTime::getUniTime ();
// afficher l adresse de celui qui demande // afficher l adresse de celui qui demande
nlinfo("UT: Send the universal time %"NL_I64"d to '%s'", ut, netbase.hostAddress(from).asString().c_str()); nlinfo("UT: Send the universal time %" NL_I64 "d to '%s'", ut, netbase.hostAddress(from).asString().c_str());
CMessage msgout ("GUT"); CMessage msgout ("GUT");
msgout.serial (ut); msgout.serial (ut);
@ -359,7 +359,7 @@ void _CUniTime::syncUniTimeFromServer (CCallbackClient * /* client */)
attempt++; attempt++;
} }
client->disconnect (); client->disconnect ();
nlinfo ("Universal time is %"NL_I64"dms with a mean error of %"NL_I64"dms", _CUniTime::getUniTime(), bestdelta/2); nlinfo ("Universal time is %" NL_I64 "dms with a mean error of %" NL_I64 "dms", _CUniTime::getUniTime(), bestdelta/2);
return; return;
error: error:
nlwarning ("there's no connection or lost or can't synchronize universal time"); nlwarning ("there's no connection or lost or can't synchronize universal time");
@ -377,12 +377,12 @@ NLMISC_CATEGORISED_COMMAND(nel, time, "displays the universal time", "")
if ( _CUniTime::Sync ) if ( _CUniTime::Sync )
{ {
log.displayNL ("CTime::getLocalTime(): %"NL_I64"dms, _CUniTime::getUniTime(): %"NL_I64"dms", CTime::getLocalTime (), _CUniTime::getUniTime ()); log.displayNL ("CTime::getLocalTime(): %" NL_I64 "dms, _CUniTime::getUniTime(): %" NL_I64 "dms", CTime::getLocalTime (), _CUniTime::getUniTime ());
log.displayNL ("_CUniTime::getStringUniTime(): '%s'", _CUniTime::getStringUniTime()); log.displayNL ("_CUniTime::getStringUniTime(): '%s'", _CUniTime::getStringUniTime());
} }
else else
{ {
log.displayNL ("CTime::getLocalTime(): %"NL_I64"dms <Universal time not sync>", CTime::getLocalTime ()); log.displayNL ("CTime::getLocalTime(): %" NL_I64 "dms <Universal time not sync>", CTime::getLocalTime ());
} }
return true; return true;

View file

@ -174,9 +174,9 @@ CRational64 CEdgeCollide::testPointMove(const CVector2f &start, const CVector2f
*/ */
/* /*
if (numerator != numeratorInt) if (numerator != numeratorInt)
nlwarning("numerator(%f) != numeratorInt(%"NL_I64"d)", numerator, numeratorInt); nlwarning("numerator(%f) != numeratorInt(%" NL_I64 "d)", numerator, numeratorInt);
if (denominator != denominatorInt) if (denominator != denominatorInt)
nlwarning("denominator(%f) != denominatorInt(%"NL_I64"d)", denominator, denominatorInt); nlwarning("denominator(%f) != denominatorInt(%" NL_I64 "d)", denominator, denominatorInt);
*/ */
return CRational64(numeratorInt, denominatorInt); return CRational64(numeratorInt, denominatorInt);
} }

View file

@ -67,6 +67,11 @@ IF(WITH_NEL_TOOLS AND WITH_3D)
ADD_SUBDIRECTORY(object_viewer_widget) ADD_SUBDIRECTORY(object_viewer_widget)
ENDIF() ENDIF()
IF(WITH_QT5)
ADD_SUBDIRECTORY(shared_widgets)
ADD_SUBDIRECTORY(panoply_preview)
ENDIF()
IF(WITH_NEL_TOOLS) IF(WITH_NEL_TOOLS)
FIND_PACKAGE(Squish) FIND_PACKAGE(Squish)
ENDIF() ENDIF()

View file

@ -0,0 +1,36 @@
FILE(GLOB SRCS *.cpp)
FILE(GLOB HDRS *.h)
IF (WIN32)
FILE(GLOB RSRC *.rc)
ENDIF (WIN32)
FILE(GLOB RESOURCES *.qrc)
FILE(GLOB PANOPLY_MAKER ../panoply_maker/color_modifier.cpp ../panoply_maker/color_modifier.h)
SOURCE_GROUP("" FILES ${SRCS} ${HDRS} ${RSRC} ${RESOURCES})
SOURCE_GROUP("panoply_maker" FILES ${PANOPLY_MAKER})
SET(CMAKE_AUTOMOC ON)
QT5_ADD_RESOURCES(RESOURCE_ADDED ${RESOURCES})
CMAKE_POLICY(SET CMP0020 NEW)
ADD_EXECUTABLE(nl_panoply_preview WIN32 ${SRC}
${SRCS}
${HDRS}
${RSRC}
${RESOURCE_ADDED}
${PANOPLY_MAKER}
)
TARGET_LINK_LIBRARIES(nl_panoply_preview
nelmisc
nel3d
shared_widgets
Qt5::Widgets)
NL_DEFAULT_PROPS(nl_panoply_preview "NeL, Tools, 3D: panoply_preview")
NL_ADD_RUNTIME_FLAGS(nl_panoply_preview)
INSTALL(TARGETS nl_panoply_preview RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT samples3d)

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "greenpill.ico"

View file

@ -0,0 +1,138 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <nel/misc/types_nl.h>
#include "main_window.h"
// STL includes
// Qt includes
#include <QtGui>
#include <QTreeView>
#include <QDirModel>
#include <QUndoStack>
#include <QScrollArea>
#include <QApplication>
#include <QAction>
#include <QMenuBar>
#include <QMenu>
#include <QDockWidget>
#include <QToolBar>
#include <QStatusBar>
#include <QStyleFactory>
#include <QMessageBox>
// NeL includes
// #include <nel/misc/debug.h>
#include <nel/misc/i18n.h>
#include <nel/3d/u_driver.h>
// Project includes
#include "../shared_widgets/command_log.h"
#include "panoply_preview.h"
using namespace std;
using namespace NLMISC;
namespace NLTOOLS {
namespace {
QString nli18n(const char *label)
{
return QString::fromUtf16(CI18N::get(label).c_str());
}
} /* anonymous namespace */
CMainWindow::CMainWindow(const QMap<QString, QSize> &customSizeHints, QWidget *parent, Qt::WindowFlags flags)
: QMainWindow(parent, flags),
m_PanoplyPreview(NULL),
m_CommandLog(NULL), m_CommandLogDock(NULL),
m_WidgetsMenu(NULL), m_HelpMenu(NULL),
m_AboutAct(NULL)
{
setObjectName("CMainWindow");
setWindowTitle(tr("NeL Panoply Preview"));
createActions();
createMenus();
createToolBars();
createStatusBar();
m_PanoplyPreview = new CPanoplyPreview(this);
setCentralWidget(m_PanoplyPreview);
createDockWindows();
}
CMainWindow::~CMainWindow()
{
}
void CMainWindow::createActions()
{
m_AboutAct = new QAction(this);
connect(m_AboutAct, SIGNAL(triggered()), this, SLOT(about()));
m_AboutAct->setText(tr("About"));
m_AboutAct->setStatusTip(tr("About"));
}
void CMainWindow::createMenus()
{
m_WidgetsMenu = menuBar()->addMenu(QString::null);
m_HelpMenu = menuBar()->addMenu(QString::null);
m_HelpMenu->addAction(m_AboutAct);
m_WidgetsMenu->setTitle(tr("Widgets"));
m_HelpMenu->setTitle(tr("Help"));
}
void CMainWindow::createToolBars()
{
}
void CMainWindow::createStatusBar()
{
statusBar()->showMessage(tr("Ready"));
}
void CMainWindow::createDockWindows()
{
// CommandLog (Console)
{
m_CommandLogDock = new QDockWidget(this);
m_CommandLogDock->setWindowTitle(tr("Console"));
m_CommandLogDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
m_CommandLog = new NLQT::CCommandLogDisplayer(m_CommandLogDock);
m_CommandLogDock->setWidget(m_CommandLog);
addDockWidget(Qt::BottomDockWidgetArea, m_CommandLogDock);
m_WidgetsMenu->addAction(m_CommandLogDock->toggleViewAction());
}
}
void CMainWindow::about()
{
QMessageBox::about(this, tr("Panoply Preview"), tr("Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)"));
}
} /* namespace NLTOOLS */
/* end of file */

View file

@ -0,0 +1,95 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NLTOOLS_MAIN_WINDOW_H
#define NLTOOLS_MAIN_WINDOW_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QMainWindow>
// NeL includes
#include <nel/misc/rgba.h>
#include <nel/misc/ucstring.h>
#include <nel/misc/time_nl.h>
#include <nel/3d/animation_time.h>
#include <nel/net/login_cookie.h>
// Project includes
// ...
class QTreeView;
class QDirModel;
class QUndoStack;
class QScrollArea;
namespace NLQT {
class CCommandLogDisplayer;
}
namespace NLTOOLS {
class CPanoplyPreview;
/**
* CMainWindow
* \brief CMainWindow
* \date 2014-09-19 09:38GMT
* \author Jan BOON (jan.boon@kaetemi.be)
*/
class CMainWindow : public QMainWindow
{
Q_OBJECT
public:
CMainWindow(const QMap<QString, QSize> &customSizeHints, QWidget *parent = 0, Qt::WindowFlags flags = 0);
virtual ~CMainWindow();
inline QMenu *widgetsMenu() { return m_WidgetsMenu; }
private slots:
void about();
private:
void createActions();
void createMenus();
void createToolBars();
void createStatusBar();
void createDockWindows();
private:
CMainWindow(const CMainWindow &);
CMainWindow &operator=(const CMainWindow &);
private:
CPanoplyPreview *m_PanoplyPreview;
NLQT::CCommandLogDisplayer *m_CommandLog;
QDockWidget *m_CommandLogDock;
QMenu *m_WidgetsMenu;
QMenu *m_HelpMenu;
QAction *m_AboutAct;
}; /* class CMainWindow */
} /* namespace NLTOOLS */
#endif /* #ifndef NLTOOLS_MAIN_WINDOW_H */
/* end of file */

View file

@ -0,0 +1,523 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <nel/misc/types_nl.h>
#include "panoply_preview.h"
// STL includes
// Qt includes
#include <QVBoxLayout>
#include <QDockWidget>
#include <QMenu>
#include <QGroupBox>
#include <QLineEdit>
#include <QSlider>
#include <QScrollArea>
#include <QPushButton>
#include <QLabel>
#include <QPainter>
// NeL includes
#include <nel/misc/debug.h>
#include <nel/misc/command.h>
#include <nel/misc/path.h>
#include <nel/misc/thread.h>
#include <nel/misc/mutex.h>
#include <nel/misc/bitmap.h>
#include <nel/misc/file.h>
// Project includes
#include "main_window.h"
#include "../panoply_maker/color_modifier.h"
using namespace std;
using namespace NLMISC;
namespace NLTOOLS {
class CColorThread : public NLMISC::IRunnable
{
public:
// Called when a thread is run.
virtual void run()
{
while (Running)
{
SettingsMutex.enter();
if (!Running)
{
SettingsMutex.leave();
return;
}
if (!Process)
{
SettingsMutex.leave();
nlSleep(10); // TODO: Should wait on an event signal...
continue;
}
// nldebug("Update color modifier");
m_ColorModifier.Hue = Hue;
m_ColorModifier.Lightness = Lightness;
m_ColorModifier.Saturation = Saturation;
m_ColorModifier.Luminosity = Luminosity;
m_ColorModifier.Contrast = Contrast;
Process = false;
SettingsMutex.leave();
BitmapMutex.enter();
if (!Running)
{
BitmapMutex.leave();
return;
}
if (!BitmapsOk)
{
nldebug("Bitmaps not ready");
BitmapMutex.leave();
nlSleep(500);
continue;
}
float retDeltaHue;
DestBitmap = ColorBitmap;
m_ColorModifier.convertBitmap(DestBitmap, ColorBitmap, MaskBitmap, retDeltaHue);
BitmapMutex.leave();
PanoplyPreview->displayBitmap(DestBitmap);
nlSleep(10); // TODO: Should wait on an event signal...
}
}
CColorThread() : PanoplyPreview(NULL), BitmapsOk(false), Hue(0), Lightness(0), Saturation(0), Luminosity(0), Contrast(0), Process(false), Running(true) { }
virtual ~CColorThread() { }
virtual void getName (std::string &result) const { result = "CColorThread"; }
private:
CColorModifier m_ColorModifier;
public:
CPanoplyPreview *PanoplyPreview;
NLMISC::CMutex BitmapMutex;
NLMISC::CBitmap ColorBitmap;
NLMISC::CBitmap MaskBitmap;
bool BitmapsOk;
NLMISC::CBitmap DestBitmap;
NLMISC::CMutex SettingsMutex;
float Hue;
float Lightness;
float Saturation;
float Luminosity;
float Contrast;
bool Process;
bool Running;
};
// *****************************************************************
CPanoplyPreview::CPanoplyPreview(CMainWindow *parent) : QWidget(parent)
{
connect(this, SIGNAL(tSigBitmap()), this, SLOT(tSlotBitmap()));
createDockWindows(parent);
m_Image = new QImage(512, 512, QImage::Format_RGB32);
m_Pixmap = new QPixmap(512, 512);
setMinimumWidth(512);
setMinimumHeight(512);
m_ColorThread = new CColorThread();
m_ColorThread->PanoplyPreview = this;
m_Thread = IThread::create(m_ColorThread);
m_Thread->start();
}
CPanoplyPreview::~CPanoplyPreview()
{
m_ColorThread->SettingsMutex.enter();
m_ColorThread->BitmapMutex.enter();
m_ColorThread->Running = false;
m_ColorThread->BitmapMutex.leave();
m_ColorThread->SettingsMutex.leave();
m_Thread->wait();
delete m_Thread;
delete m_ColorThread;
}
void CPanoplyPreview::paintEvent(QPaintEvent* e)
{
QPainter painter(this);
painter.drawPixmap(0, 0, *m_Pixmap);
}
void CPanoplyPreview::displayBitmap(const CBitmap &bitmap) // Called from thread!
{
// nldebug("received bitmap");
m_ColorThread->BitmapMutex.enter();
m_ImageMutex.enter();
const char *buffer = (const char *)&bitmap.getPixels()[0];
if (bitmap.getWidth() != m_Image->width() || bitmap.getHeight() != m_Image->height())
{
QImage *image = m_Image;
m_Image = new QImage(bitmap.getWidth(), bitmap.getHeight(), QImage::Format_RGB32);
delete image;
}
for (uint32 y = 0; y < bitmap.getHeight(); ++y)
{
uint8 *dst = (uint8 *)m_Image->scanLine(y);
const uint8 *src = (const uint8 *)&buffer[y * bitmap.getWidth() * sizeof(uint32)];
for (uint32 x = 0; x < bitmap.getWidth(); ++x)
{
uint32 xb = x * 4;
dst[xb + 0] = src[xb + 2];
dst[xb + 1] = src[xb + 1];
dst[xb + 2] = src[xb + 0];
dst[xb + 3] = src[xb + 3];
}
//memcpy(m_Image->scanLine(y), &buffer[y * bitmap.getWidth() * sizeof(uint32)], sizeof(uint32) * bitmap.getWidth());
}
m_ImageMutex.leave();
m_ColorThread->BitmapMutex.leave();
tSigBitmap();
}
void CPanoplyPreview::tSlotBitmap()
{
// nldebug("display bitmap");
m_ImageMutex.enter();
if (m_Image->width() != m_Pixmap->width()
|| m_Image->height() != m_Pixmap->height())
{
QPixmap *pixmap = m_Pixmap;
m_Pixmap = new QPixmap(m_Image->width(), m_Image->height());
setMinimumWidth(m_Pixmap->width());
setMinimumHeight(m_Pixmap->height());
delete pixmap;
}
m_Pixmap->convertFromImage(*m_Image);
repaint();
m_ImageMutex.leave();
}
void CPanoplyPreview::colorEdited(const QString &text)
{
m_ColorFile = text;
}
void CPanoplyPreview::maskEdited(const QString &text)
{
m_MaskFile = text;
}
void CPanoplyPreview::goPushed(bool)
{
// nldebug("push bitmaps");
m_ColorThread->SettingsMutex.enter();
m_ColorThread->BitmapMutex.enter();
m_ColorThread->BitmapsOk = false;
try
{
{
NLMISC::CIFile is;
if (!is.open(m_ColorFile.toLocal8Bit().data()))
throw NLMISC::Exception("Cannot open file '%s'", m_ColorFile.toLocal8Bit().data());
uint32 depth = m_ColorThread->ColorBitmap.load(is);
if (depth == 0 || m_ColorThread->ColorBitmap.getPixels().empty())
throw NLMISC::Exception("Failed to load bitmap '%s'", m_ColorFile.toLocal8Bit().data());
if (m_ColorThread->ColorBitmap.PixelFormat != NLMISC::CBitmap::RGBA)
m_ColorThread->ColorBitmap.convertToType(NLMISC::CBitmap::RGBA);
}
{
NLMISC::CIFile is;
if (!is.open(m_MaskFile.toLocal8Bit().data()))
throw NLMISC::Exception("Cannot open file '%s'", m_MaskFile.toLocal8Bit().data());
uint32 depth = m_ColorThread->MaskBitmap.load(is);
if (depth == 0 || m_ColorThread->MaskBitmap.getPixels().empty())
throw NLMISC::Exception("Failed to load bitmap '%s'", m_MaskFile.toLocal8Bit().data());
if (m_ColorThread->MaskBitmap.PixelFormat != NLMISC::CBitmap::Luminance)
m_ColorThread->MaskBitmap.convertToType(NLMISC::CBitmap::Luminance);
}
{
m_ColorThread->BitmapsOk = true;
m_ColorThread->Process = true;
}
}
catch (const NLMISC::Exception &e)
{
nlwarning("Exception: '%s'", e.what());
}
m_ColorThread->BitmapMutex.leave();
m_ColorThread->SettingsMutex.leave();
// nldebug("done pushing butmaps");
}
void CPanoplyPreview::hueChanged(int value)
{
float v = (float)value;
m_ColorThread->SettingsMutex.enter();
m_ColorThread->Hue = v;
m_ColorThread->Process = true;
m_ColorThread->SettingsMutex.leave();
}
void CPanoplyPreview::lightnessChanged(int value)
{
float v = (float)value * 0.01f;
m_ColorThread->SettingsMutex.enter();
m_ColorThread->Lightness = v;
m_ColorThread->Process = true;
m_ColorThread->SettingsMutex.leave();
}
void CPanoplyPreview::saturationChanged(int value)
{
float v = (float)value * 0.01f;
m_ColorThread->SettingsMutex.enter();
m_ColorThread->Saturation = v;
m_ColorThread->Process = true;
m_ColorThread->SettingsMutex.leave();
}
void CPanoplyPreview::luminosityChanged(int value)
{
float v = (float)value;
m_ColorThread->SettingsMutex.enter();
m_ColorThread->Luminosity = v;
m_ColorThread->Process = true;
m_ColorThread->SettingsMutex.leave();
}
void CPanoplyPreview::contrastChanged(int value)
{
float v = (float)value;
m_ColorThread->SettingsMutex.enter();
m_ColorThread->Contrast = v;
m_ColorThread->Process = true;
m_ColorThread->SettingsMutex.leave();
}
// *****************************************************************
CSliderTextEdit::CSliderTextEdit(QWidget *parent, QLineEdit *lineEdit, float scale) : QSlider(Qt::Horizontal, parent), m_LineEdit(lineEdit), m_Updating(false), m_Scale(scale)
{
connect(this, SIGNAL(valueChanged(int)), this, SLOT(sliderValueChanged(int)));
connect(lineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(lineEditTextEdited(const QString &)));
}
CSliderTextEdit::~CSliderTextEdit()
{
}
void CSliderTextEdit::lineEditTextEdited(const QString &text)
{
if (!m_Updating)
{
m_Updating = true;
setValue((int)(text.toFloat() * m_Scale));
m_Updating = false;
}
}
void CSliderTextEdit::sliderValueChanged(int value)
{
if (!m_Updating)
{
m_Updating = true;
m_LineEdit->setText(QString::number((double)value / (double)m_Scale));
m_Updating = false;
}
}
// *****************************************************************
void CPanoplyPreview::createDockWindows(CMainWindow *mainWindow)
{
nlassert(mainWindow);
// Color Modifier
{
QDockWidget *dockWidget = new QDockWidget(mainWindow);
nlassert(dockWidget);
dockWidget->setWindowTitle(tr("Color Modifier"));
dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
QScrollArea *scrollArea = new QScrollArea(dockWidget);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setWidgetResizable(true);
QWidget *widget = new QWidget(scrollArea);
QVBoxLayout *vboxLayout = new QVBoxLayout(widget);
// Input File Paths
{
QGroupBox *groupBox = new QGroupBox(widget);
groupBox->setTitle(tr("Input File Paths"));
QGridLayout *groupLayout = new QGridLayout(groupBox);
QLabel *colorLabel = new QLabel(groupBox);
colorLabel->setText(tr("Color: "));
groupLayout->addWidget(colorLabel, 0, 0);
QLineEdit *colorFile = new QLineEdit(groupBox);
colorFile->setText("W:\\database\\stuff\\fyros\\agents\\_textures\\actors\\fy_hof_armor00_arm01_c1.png");
groupLayout->addWidget(colorFile, 0, 1);
m_ColorFile = colorFile->text();
connect(colorFile, SIGNAL(textEdited(const QString &)), this, SLOT(colorEdited(const QString &)));
QLabel *maskLabel = new QLabel(groupBox);
maskLabel->setText(tr("Mask: "));
groupLayout->addWidget(maskLabel, 1, 0);
QLineEdit *maskFile = new QLineEdit(groupBox);
maskFile->setText("W:\\database\\stuff\\fyros\\agents\\_textures\\actors\\mask\\fy_hof_armor00_arm01_c1_skin.png");
groupLayout->addWidget(maskFile, 1, 1);
m_MaskFile = maskFile->text();
connect(maskFile, SIGNAL(textEdited(const QString &)), this, SLOT(maskEdited(const QString &)));
QPushButton *go = new QPushButton(groupBox);
go->setText(tr("Go"));
groupLayout->addWidget(go, 2, 0, 1, 2);
connect(go, SIGNAL(clicked(bool)), this, SLOT(goPushed(bool)));
groupBox->setLayout(groupLayout);
vboxLayout->addWidget(groupBox);
}
// Color Modifier
{
QGroupBox *groupBox = new QGroupBox(widget);
groupBox->setTitle(tr("Color Modifier"));
QGridLayout *groupLayout = new QGridLayout(groupBox);
QLabel *label;
QLineEdit *edit;
CSliderTextEdit *slider;
label = new QLabel(groupBox);
label->setText(tr("Hue [0, 360]: "));
groupLayout->addWidget(label, 0, 0);
edit = new QLineEdit(groupBox);
edit->setText("0");
groupLayout->addWidget(edit, 0, 1);
slider = new CSliderTextEdit(groupBox, edit, 1.0f);
slider->setMinimum(0);
slider->setMaximum(360);
slider->setValue(0);
groupLayout->addWidget(slider, 1, 0, 1, 2);
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(hueChanged(int)));
label = new QLabel(groupBox);
label->setText(tr("Lightness [-1, 1]: "));
groupLayout->addWidget(label, 2, 0);
edit = new QLineEdit(groupBox);
edit->setText("0");
groupLayout->addWidget(edit, 2, 1);
slider = new CSliderTextEdit(groupBox, edit, 100.0f);
slider->setMinimum(-100);
slider->setMaximum(100);
slider->setValue(0);
groupLayout->addWidget(slider, 3, 0, 1, 2);
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(lightnessChanged(int)));
label = new QLabel(groupBox);
label->setText(tr("Saturation [-1, 1]: "));
groupLayout->addWidget(label, 4, 0);
edit = new QLineEdit(groupBox);
edit->setText("0");
groupLayout->addWidget(edit, 4, 1);
slider = new CSliderTextEdit(groupBox, edit, 100.0f);
slider->setMinimum(-100);
slider->setMaximum(100);
slider->setValue(0);
groupLayout->addWidget(slider, 5, 0, 1, 2);
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(saturationChanged(int)));
label = new QLabel(groupBox);
label->setText(tr("Luminosity [-100, 100]: "));
groupLayout->addWidget(label, 6, 0);
edit = new QLineEdit(groupBox);
edit->setText("0");
groupLayout->addWidget(edit, 6, 1);
slider = new CSliderTextEdit(groupBox, edit, 1.0f);
slider->setMinimum(-100);
slider->setMaximum(100);
slider->setValue(0);
groupLayout->addWidget(slider, 7, 0, 1, 2);
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(luminosityChanged(int)));
label = new QLabel(groupBox);
label->setText(tr("Contrast [-100, 100]: "));
groupLayout->addWidget(label, 8, 0);
edit = new QLineEdit(groupBox);
edit->setText("0");
groupLayout->addWidget(edit, 8, 1);
slider = new CSliderTextEdit(groupBox, edit, 1.0f);
slider->setMinimum(-100);
slider->setMaximum(100);
slider->setValue(0);
groupLayout->addWidget(slider, 9, 0, 1, 2);
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(contrastChanged(int)));
groupBox->setLayout(groupLayout);
vboxLayout->addWidget(groupBox);
}
vboxLayout->addStretch();
widget->setLayout(vboxLayout);
scrollArea->setWidget(widget);
dockWidget->setWidget(scrollArea);
mainWindow->addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
mainWindow->widgetsMenu()->addAction(dockWidget->toggleViewAction());
}
}
} /* namespace NLTOOLS */
/* end of file */

View file

@ -0,0 +1,125 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NLTOOLS_PANOPLY_PREVIEW_H
#define NLTOOLS_PANOPLY_PREVIEW_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QWidget>
#include <QTextEdit>
#include <QLineEdit>
#include <QSlider>
#include <QImage>
#include <QPixmap>
// NeL includes
#include <nel/misc/log.h>
#include <nel/misc/displayer.h>
// Project includes
namespace NLMISC {
class CBitmap;
class IThread;
}
namespace NLTOOLS {
class CMainWindow;
class CColorThread;
/**
* CPanoplyPreview
* \brief CPanoplyPreview
* \date 2014-09-19 09:38GMT
* \author Jan BOON (jan.boon@kaetemi.be)
*/
class CPanoplyPreview : public QWidget
{
Q_OBJECT
public:
CPanoplyPreview(CMainWindow *parent);
virtual ~CPanoplyPreview();
void displayBitmap(const NLMISC::CBitmap &bitmap); // Called from thread!
protected:
virtual void paintEvent(QPaintEvent *e);
signals:
void tSigBitmap();
private slots:
void tSlotBitmap();
void colorEdited(const QString &text);
void maskEdited(const QString &text);
void goPushed(bool);
void hueChanged(int value);
void lightnessChanged(int value);
void saturationChanged(int value);
void luminosityChanged(int value);
void contrastChanged(int value);
private:
void createDockWindows(CMainWindow *mainWindow);
private:
NLMISC::IThread *m_Thread;
CColorThread *m_ColorThread;
QString m_ColorFile;
QString m_MaskFile;
QImage *m_Image;
QPixmap *m_Pixmap;
NLMISC::CMutex m_ImageMutex;
private:
CPanoplyPreview(const CPanoplyPreview &);
CPanoplyPreview &operator=(const CPanoplyPreview &);
}; /* class CPanoplyPreview */
class CSliderTextEdit : public QSlider
{
Q_OBJECT
public:
CSliderTextEdit(QWidget *parent, QLineEdit *lineEdit, float scale);
virtual ~CSliderTextEdit();
private slots:
void lineEditTextEdited(const QString &text);
void sliderValueChanged(int value);
private:
QLineEdit *m_LineEdit;
bool m_Updating;
float m_Scale;
};
} /* namespace NLTOOLS */
#endif /* #ifndef NLTOOLS_PANOPLY_PREVIEW_H */
/* end of file */

View file

@ -0,0 +1,105 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NLTOOLS_CONFIG_H
#define NLTOOLS_CONFIG_H
#include <nel/misc/types_nl.h>
// use the default log.log file (not erased on use)
// #define NLTOOLS_USE_LOG_LOG false
// the config file name
// #define NLTOOLS_CONFIG_FILE "panoply_preview.cfg"
// #define NLTOOLS_CONFIG_FILE_DEFAULT "panoply_preview_default.cfg"
// use panoply_preview log file
// #define NLTOOLS_USE_LOG 1
// panoply_preview log file name
#define NLTOOLS_LOG_FILE "panoply_preview.log"
// clear panoply_preview log before use
#define NLTOOLS_ERASE_LOG true
// version number
#define NLTOOLS_VERSION "0.10.0"
// use the low fragmentation heap (windows feature)
// #define NLTOOLS_LOW_FRAGMENTATION_HEAP 1
// temporary dev tags
//#define NL_DEV_STEREO 0
//#define NL_DEV_MEMLEAK 1
//#define NL_DEV_NET 0
//#define NL_DEV_NETNEW 1
//#define NL_DEV_CG 0
//#define NL_DEV_BULLET 0
// some default defines
#if FINAL_VERSION
# if !defined(NLTOOLS_USE_LOG_LOG)
# define NLTOOLS_USE_LOG_LOG false
# endif
# if !defined(NLTOOLS_USE_LOG)
# define NLTOOLS_USE_LOG 0
# endif
#endif
#if !defined (NLTOOLS_USE_LOG_LOG)
# define NLTOOLS_USE_LOG_LOG true
#endif
#if !defined (NLTOOLS_USE_LOG)
# define NLTOOLS_USE_LOG 1
#endif
#if !defined (NLTOOLS_LOW_FRAGMENTATION_HEAP)
# ifdef NL_OS_WINDOWS
# define NLTOOLS_LOW_FRAGMENTATION_HEAP 1
# else
# define NLTOOLS_LOW_FRAGMENTATION_HEAP 0
# endif
#endif
// for compatibility with old configuration
#ifndef NLTOOLS_CONFIG_FILE
# ifndef NLTOOLS_CONFIG
# define NLTOOLS_CONFIG_FILE "panoply_preview.cfg"
# else
# define NLTOOLS_CONFIG_FILE NLTOOLS_CONFIG "panoply_preview.cfg"
# endif
#endif
#ifndef NLTOOLS_CONFIG_FILE_DEFAULT
# define NLTOOLS_CONFIG_FILE_DEFAULT "panoply_preview_default.cfg"
#endif
#endif /* #ifndef NLTOOLS_CONFIG_H */
/* end of file */

View file

@ -0,0 +1,176 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <nel/misc/types_nl.h>
#include "tool_main.h"
// STL includes
#include <stdio.h>
#ifdef NL_OS_WINDOWS
# include <windows.h>
# include <direct.h>
# include <tchar.h>
#endif
// Qt includes
#include <QApplication>
#include <QtCore/QMap>
#include <QtCore/qdebug.h>
#include <QStyleFactory>
// NeL includes
#include <nel/misc/debug.h>
#include <nel/misc/common.h>
#include <nel/misc/file.h>
#include <nel/misc/path.h>
#include <nel/misc/command.h>
#include <nel/misc/sheet_id.h>
// Project includes
#include "../shared_widgets/common.h"
#include "tool_config.h"
#include "main_window.h"
using namespace std;
using namespace NLMISC;
namespace NLTOOLS {
namespace {
CFileDisplayer *s_FileDisplayer = NULL;
} /* anonymous namespace */
} /* namespace NLTOOLS */
void usage()
{
/* from Qt sample */
qWarning() << "Usage: mainwindow [-SizeHint<color> <width>x<height>] ...";
exit(1);
}
QMap<QString, QSize> parseCustomSizeHints(int argc, char **argv)
{
/* from Qt sample */
QMap<QString, QSize> result;
for (int i = 1; i < argc; ++i) {
QString arg = QString::fromLocal8Bit(argv[i]);
if (arg.startsWith(QLatin1String("-SizeHint"))) {
QString name = arg.mid(9);
if (name.isEmpty())
usage();
if (++i == argc)
usage();
QString sizeStr = QString::fromLocal8Bit(argv[i]);
int idx = sizeStr.indexOf(QLatin1Char('x'));
if (idx == -1)
usage();
bool ok;
int w = sizeStr.left(idx).toInt(&ok);
if (!ok)
usage();
int h = sizeStr.mid(idx + 1).toInt(&ok);
if (!ok)
usage();
result[name] = QSize(w, h);
}
}
return result;
}
#ifdef NL_OS_WINDOWS
# ifdef _UNICODE
# define tstring wstring
# else
# define tstring string
# endif
#endif
sint main(int argc, char **argv)
{
// go nel!
{
// use log.log if NEL_LOG_IN_FILE and NLTOOLS_USE_LOG_LOG defined as 1
createDebug(NULL, NLTOOLS_USE_LOG_LOG, false);
#if NLTOOLS_USE_LOG
// create toverhex_client.log
// filedisplayer only deletes the 001 etc
if (NLTOOLS_ERASE_LOG && CFile::isExists(NLTOOLS_LOG_FILE))
CFile::deleteFile(NLTOOLS_LOG_FILE);
// initialize the log file
NLTOOLS::s_FileDisplayer = new CFileDisplayer();
NLTOOLS::s_FileDisplayer->setParam(NLTOOLS_LOG_FILE, NLTOOLS_ERASE_LOG);
DebugLog->addDisplayer(NLTOOLS::s_FileDisplayer);
InfoLog->addDisplayer(NLTOOLS::s_FileDisplayer);
WarningLog->addDisplayer(NLTOOLS::s_FileDisplayer);
AssertLog->addDisplayer(NLTOOLS::s_FileDisplayer);
ErrorLog->addDisplayer(NLTOOLS::s_FileDisplayer);
#endif
nlinfo("Welcome to NeL!");
}
// low fragmentation heap (windows)
#if NLTOOLS_LOW_FRAGMENTATION_HEAP
ULONG heapFragValue = 2; // enable low fragmentation heap
if (HeapSetInformation(GetProcessHeap(),
HeapCompatibilityInformation,
&heapFragValue, sizeof(heapFragValue)))
{
nlinfo("HeapSetInformation OK!\n");
}
else
{
nlwarning("HeapSetInformation FAIL! (%d)\n", GetLastError());
}
#endif
#ifdef NL_OS_WINDOWS
HRESULT hr;
hr = hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
bool coInitOk = (hr == S_OK) || (hr == S_FALSE);
#endif
CSheetId::initWithoutSheet();
NLQT::preApplication();
QApplication app(argc, const_cast<char **>(argv));
NLQT::postApplication();
QMap<QString, QSize> customSizeHints = parseCustomSizeHints(argc, argv);
NLTOOLS::CMainWindow mainWin(customSizeHints);
mainWin.resize(800, 600);
mainWin.show(); // calls isVisible(true)
int result = app.exec();
#ifdef NL_OS_WINDOWS
if (coInitOk) CoUninitialize();
#endif
return result;
}
/* end of file */

View file

@ -0,0 +1,33 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NLTOOLS_MAIN_H
#define NLTOOLS_MAIN_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
// Project includes
namespace NLTOOLS {
} /* namespace NLTOOLS */
#endif /* #ifndef NLTOOLS_MAIN_H */
/* end of file */

View file

@ -0,0 +1,23 @@
FILE(GLOB SRCS *.cpp)
FILE(GLOB HDRS *.h)
IF (WIN32)
FILE(GLOB RSRC *.rc)
ENDIF (WIN32)
FILE(GLOB RESOURCES *.qrc)
SOURCE_GROUP("" FILES ${SRCS} ${HDRS} ${RSRC} ${RESOURCES})
SET(CMAKE_AUTOMOC ON)
QT5_ADD_RESOURCES(RESOURCE_ADDED ${RESOURCES})
CMAKE_POLICY(SET CMP0020 NEW)
NL_TARGET_LIB(shared_widgets ${SRCS} ${HDRS} ${RSRC} ${RESOURCE_ADDED})
TARGET_LINK_LIBRARIES(shared_widgets nelmisc nel3d Qt5::Widgets)
NL_DEFAULT_PROPS(shared_widgets "NeL, Tools, 3D: Shared Widgets")
NL_ADD_RUNTIME_FLAGS(shared_widgets)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS shared_widgets LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT tools3d)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)

View file

@ -0,0 +1,159 @@
/*
Copyright (C) 2010-2015 by authors
Author: Jan Boon <jan.boon@kaetemi.be>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <nel/misc/types_nl.h>
#include "command_log.h"
// STL includes
// Qt includes
#include <QVBoxLayout>
// NeL includes
#include <nel/misc/debug.h>
#include <nel/misc/command.h>
#include <nel/misc/path.h>
#include <nel/misc/window_displayer.h>
// Project includes
using namespace std;
using namespace NLMISC;
namespace NLQT {
CCommandLog::CCommandLog(QWidget *parent) : QWidget(parent)
{
m_DisplayerOutput = new QTextEdit();
m_DisplayerOutput->setReadOnly(true);
m_DisplayerOutput->setFocusPolicy(Qt::NoFocus);
m_CommandInput = new QLineEdit();
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(m_DisplayerOutput);
layout->addWidget(m_CommandInput);
setLayout(layout);
connect(m_CommandInput, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
connect(this, SIGNAL(tSigDisplay(const QColor &, const QString &)), this, SLOT(tSlotDisplay(const QColor &, const QString &)));
}
CCommandLog::~CCommandLog()
{
}
void CCommandLog::doDisplay(const CLog::TDisplayInfo& args, const char *message)
{
QColor color;
switch (args.LogType)
{
case CLog::LOG_DEBUG:
color = Qt::gray;
break;
case CLog::LOG_STAT:
color = Qt::green;
break;
case CLog::LOG_NO:
case CLog::LOG_UNKNOWN:
case CLog::LOG_INFO:
color = Qt::white;
break;
case CLog::LOG_WARNING:
color = Qt::yellow;
break;
case CLog::LOG_ERROR:
case CLog::LOG_ASSERT:
color = Qt::red;
break;
default:
color = Qt::black;
break;
}
std::string str = NLMISC::CWindowDisplayer::stringifyMessage(args, message);
tSigDisplay(color, str.substr(0, str.size() - 1).c_str());
}
void CCommandLog::tSlotDisplay(const QColor &c, const QString &text)
{
m_DisplayerOutput->setTextColor(c);
m_DisplayerOutput->append(text);
}
void CCommandLog::returnPressed()
{
QString text = m_CommandInput->text();
if (text.isEmpty())
return;
std::string cmd = text.toLocal8Bit().data();
execCommand(cmd);
if (m_Func) m_Func(cmd);
m_CommandInput->clear();
}
CCommandLogDisplayer::CCommandLogDisplayer(QWidget *parent) : CCommandLog(parent)
{
connect(this, SIGNAL(execCommand(const std::string &)), this, SLOT(execCommandLog(const std::string &)));
DebugLog->addDisplayer(this);
InfoLog->addDisplayer(this);
WarningLog->addDisplayer(this);
AssertLog->addDisplayer(this);
ErrorLog->addDisplayer(this);
m_Log.addDisplayer(this);
}
CCommandLogDisplayer::~CCommandLogDisplayer()
{
DebugLog->removeDisplayer(this);
InfoLog->removeDisplayer(this);
WarningLog->removeDisplayer(this);
AssertLog->removeDisplayer(this);
ErrorLog->removeDisplayer(this);
m_Log.removeDisplayer(this);
}
void CCommandLogDisplayer::doDisplay(const NLMISC::CLog::TDisplayInfo& args, const char *message)
{
CCommandLog::doDisplay(args, message);
}
void CCommandLogDisplayer::execCommandLog(const std::string &cmd)
{
m_Log.displayRawNL("> %s", cmd.c_str());
ICommand::execute(cmd, m_Log);
}
} /* namespace NLQT */
/* end of file */

View file

@ -0,0 +1,111 @@
/*
Copyright (C) 2010-2015 by authors
Author: Jan Boon <jan.boon@kaetemi.be>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NLQT_COMMAND_LOG_H
#define NLQT_COMMAND_LOG_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QWidget>
#include <QTextEdit>
#include <QLineEdit>
// NeL includes
#include <nel/misc/log.h>
#include <nel/misc/displayer.h>
#include <nel/misc/callback.h>
// Project includes
namespace NLQT {
typedef NLMISC::CCallback<void, const std::string &> TCommandExecute;
class CCommandLog : public QWidget
{
Q_OBJECT
public:
CCommandLog(QWidget *parent);
virtual ~CCommandLog();
void setExecCommand(const TCommandExecute &func) { m_Func = func; }
void doDisplay(const NLMISC::CLog::TDisplayInfo& args, const char *message);
void clear() { m_DisplayerOutput->clear(); }
signals:
void tSigDisplay(const QColor &c, const QString &text);
void execCommand(const std::string &cmd);
private slots:
void returnPressed();
void tSlotDisplay(const QColor &c, const QString &text);
private:
QTextEdit *m_DisplayerOutput;
QLineEdit *m_CommandInput;
TCommandExecute m_Func;
private:
CCommandLog(const CCommandLog &);
CCommandLog &operator=(const CCommandLog &);
}; /* class CCommandLog */
class CCommandLogDisplayer : public CCommandLog, public NLMISC::IDisplayer
{
Q_OBJECT
public:
CCommandLogDisplayer(QWidget *parent);
virtual ~CCommandLogDisplayer();
protected:
virtual void doDisplay(const NLMISC::CLog::TDisplayInfo& args, const char *message);
private slots:
void execCommandLog(const std::string &cmd);
private:
NLMISC::CLog m_Log;
private:
CCommandLogDisplayer(const CCommandLogDisplayer &);
CCommandLogDisplayer &operator=(const CCommandLogDisplayer &);
}; /* class CCommandLogDisplayer */
} /* namespace NLQT */
#endif /* #ifndef NLQT_COMMAND_LOG_H */
/* end of file */

View file

@ -0,0 +1,87 @@
/*
Copyright (C) 2015 by authors
Author: Jan Boon <jan.boon@kaetemi.be>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NLQT_COMMON_H
#define NLQT_COMMON_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QApplication>
#include <QStyleFactory>
#include <QDir>
#include <QPalette>
// NeL includes
// Project includes
namespace NLQT {
namespace {
void preApplication()
{
QCoreApplication::libraryPaths();
QString app_location = QCoreApplication::applicationFilePath();
app_location.truncate(app_location.lastIndexOf(QLatin1Char('/')));
app_location = QDir(app_location).canonicalPath();
QCoreApplication::removeLibraryPath(app_location);
QCoreApplication::addLibraryPath("./platforms");
QCoreApplication::addLibraryPath("./qtwebengine");
QCoreApplication::addLibraryPath("./imageformats");
QCoreApplication::addLibraryPath("./iconengines");
QCoreApplication::addLibraryPath("./designer");
}
void postApplication()
{
QApplication::setStyle(QStyleFactory::create("Fusion"));
QPalette palette = qApp->palette();
palette.setColor(QPalette::Window, QColor(64, 64, 64));
palette.setColor(QPalette::WindowText, Qt::white);
palette.setColor(QPalette::Base, QColor(48, 48, 48));
palette.setColor(QPalette::AlternateBase, QColor(64, 64, 64));
palette.setColor(QPalette::ToolTipBase, Qt::white);
palette.setColor(QPalette::ToolTipText, Qt::white);
palette.setColor(QPalette::Text, Qt::white);
palette.setColor(QPalette::Button, QColor(64, 64, 64));
palette.setColor(QPalette::ButtonText, Qt::white);
palette.setColor(QPalette::BrightText, Qt::red);
palette.setColor(QPalette::Highlight, QColor(64, 128, 96));
palette.setColor(QPalette::HighlightedText, Qt::white);
qApp->setPalette(palette);
}
}
} /* namespace NLQT */
#endif /* #ifndef NLQT_SERVICE_WINDOW_H */
/* end of file */

View file

@ -255,7 +255,7 @@ bool CCDBSynchronised::setProp(const string &name, sint64 value)
} }
#ifdef TRACE_SET_VALUE #ifdef TRACE_SET_VALUE
nlinfo("Set value %"NL_I64"d for Prop %s", value,name.c_str() ); nlinfo("Set value %" NL_I64 "d for Prop %s", value,name.c_str() );
#endif #endif
// Set the property. // Set the property.

View file

@ -8399,7 +8399,7 @@ ADD_METHOD(void CCharacterCL::displayDebug(float x, float &y, float lineStep)) /
if(isPlayer() || isUser()) if(isPlayer() || isUser())
{ {
SPropVisualA visualA = *(SPropVisualA *)(&prop); SPropVisualA visualA = *(SPropVisualA *)(&prop);
TextContext->printfAt(x, y, "VPA: %"NL_I64"X : Chest(%d,%d) Legs(%d,%d) Arms(%d,%d) Hat(%d,%d) RH(%d) LH(%d)", prop, TextContext->printfAt(x, y, "VPA: %" NL_I64 "X : Chest(%d,%d) Legs(%d,%d) Arms(%d,%d) Hat(%d,%d) RH(%d) LH(%d)", prop,
(uint)visualA.PropertySubData.JacketModel, (uint)visualA.PropertySubData.JacketColor, (uint)visualA.PropertySubData.JacketModel, (uint)visualA.PropertySubData.JacketColor,
(uint)visualA.PropertySubData.TrouserModel, (uint)visualA.PropertySubData.TrouserColor, (uint)visualA.PropertySubData.TrouserModel, (uint)visualA.PropertySubData.TrouserColor,
(uint)visualA.PropertySubData.ArmModel, (uint)visualA.PropertySubData.ArmColor, (uint)visualA.PropertySubData.ArmModel, (uint)visualA.PropertySubData.ArmColor,
@ -8408,29 +8408,29 @@ ADD_METHOD(void CCharacterCL::displayDebug(float x, float &y, float lineStep)) /
(uint)visualA.PropertySubData.WeaponLeftHand); (uint)visualA.PropertySubData.WeaponLeftHand);
} }
else else
TextContext->printfAt(x, y, "VPA: %"NL_I64"X", prop); TextContext->printfAt(x, y, "VPA: %" NL_I64 "X", prop);
y += lineStep; y += lineStep;
// VPB // VPB
prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E"+toString("%d", _Slot)+":P"+toString("%d", CLFECOMMON::PROPERTY_VPB))->getValue64(); prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E"+toString("%d", _Slot)+":P"+toString("%d", CLFECOMMON::PROPERTY_VPB))->getValue64();
if(isPlayer() || isUser()) if(isPlayer() || isUser())
{ {
SPropVisualB visualB = *(SPropVisualB *)(&prop); SPropVisualB visualB = *(SPropVisualB *)(&prop);
TextContext->printfAt(x, y, "VPB: %"NL_I64"X : Hands(%d,%d) Feet(%d,%d).", prop, TextContext->printfAt(x, y, "VPB: %" NL_I64 "X : Hands(%d,%d) Feet(%d,%d).", prop,
(uint)visualB.PropertySubData.HandsModel, (uint)visualB.PropertySubData.HandsColor, (uint)visualB.PropertySubData.HandsModel, (uint)visualB.PropertySubData.HandsColor,
(uint)visualB.PropertySubData.FeetModel, (uint)visualB.PropertySubData.FeetColor); (uint)visualB.PropertySubData.FeetModel, (uint)visualB.PropertySubData.FeetColor);
} }
else else
TextContext->printfAt(x, y, "VPB: %"NL_I64"X", prop); TextContext->printfAt(x, y, "VPB: %" NL_I64 "X", prop);
y += lineStep; y += lineStep;
// VPC // VPC
prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E"+toString("%d", _Slot)+":P"+toString("%d", CLFECOMMON::PROPERTY_VPC))->getValue64(); prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E"+toString("%d", _Slot)+":P"+toString("%d", CLFECOMMON::PROPERTY_VPC))->getValue64();
if(isPlayer() || isUser()) if(isPlayer() || isUser())
{ {
SPropVisualC visualC = *(SPropVisualC *)(&prop); SPropVisualC visualC = *(SPropVisualC *)(&prop);
TextContext->printfAt(x, y, "VPC: %"NL_I64"X : EyesColor(%d) Tattoo(%d).", prop, visualC.PropertySubData.EyesColor, visualC.PropertySubData.Tattoo); TextContext->printfAt(x, y, "VPC: %" NL_I64 "X : EyesColor(%d) Tattoo(%d).", prop, visualC.PropertySubData.EyesColor, visualC.PropertySubData.Tattoo);
} }
else else
TextContext->printfAt(x, y, "VPC: %"NL_I64"X", prop); TextContext->printfAt(x, y, "VPC: %" NL_I64 "X", prop);
y += lineStep; y += lineStep;
}// displayDebug // }// displayDebug //

View file

@ -2122,7 +2122,7 @@ public:
CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND)); CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND));
if (pList == NULL) if (pList == NULL)
{ {
nlwarning("element "GROUP_LIST_MAINLAND" not found probably bad outgame.xml"); nlwarning("element " GROUP_LIST_MAINLAND " not found probably bad outgame.xml");
return; return;
} }
@ -2315,7 +2315,7 @@ public:
List = dynamic_cast<CInterfaceGroup *>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_KEYSET)); List = dynamic_cast<CInterfaceGroup *>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_KEYSET));
if (List == NULL) if (List == NULL)
{ {
nlwarning("element "GROUP_LIST_KEYSET" not found probably bad outgame.xml"); nlwarning("element " GROUP_LIST_KEYSET " not found probably bad outgame.xml");
return; return;
} }

View file

@ -208,7 +208,7 @@ void createOptionalCatUI()
CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CAT)); CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CAT));
if (pList == NULL) if (pList == NULL)
{ {
nlwarning("element "GROUP_LIST_CAT" not found probably bad login_main.xml"); nlwarning("element " GROUP_LIST_CAT " not found probably bad login_main.xml");
return; return;
} }
@ -1085,7 +1085,7 @@ void initShardDisplay()
CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_SHARD)); CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_SHARD));
if (pList == NULL) if (pList == NULL)
{ {
nlwarning("element "GROUP_LIST_SHARD" not found probably bad login_main.xml"); nlwarning("element " GROUP_LIST_SHARD " not found probably bad login_main.xml");
return; return;
} }
/* // To test more servers /* // To test more servers
@ -1303,7 +1303,7 @@ class CAHOnLogin : public IActionHandler
CGroupEditBox *pGEBPwd = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_PASSWORD)); CGroupEditBox *pGEBPwd = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_PASSWORD));
if ((pGEBLog == NULL) || (pGEBPwd == NULL)) if ((pGEBLog == NULL) || (pGEBPwd == NULL))
{ {
nlwarning("element "CTRL_EDITBOX_LOGIN" or "CTRL_EDITBOX_PASSWORD" not found probably bad login_main.xml"); nlwarning("element " CTRL_EDITBOX_LOGIN " or " CTRL_EDITBOX_PASSWORD " not found probably bad login_main.xml");
return; return;
} }
@ -1587,7 +1587,7 @@ void initPatch()
CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CAT)); CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CAT));
if (pList == NULL) if (pList == NULL)
{ {
nlwarning("element "GROUP_LIST_CAT" not found probably bad login_main.xml"); nlwarning("element " GROUP_LIST_CAT " not found probably bad login_main.xml");
return; return;
} }

View file

@ -34,7 +34,7 @@ using namespace NLMISC;
static std::string uint64ToHex(uint64 size) static std::string uint64ToHex(uint64 size)
{ {
char data[256]; char data[256];
sprintf(data, "%"NL_I64"X", size); sprintf(data, "%" NL_I64 "X", size);
return std::string(data); return std::string(data);
} }

View file

@ -189,7 +189,7 @@ void displayReceiveLog()
TReceiveDateLog::iterator idl; TReceiveDateLog::iterator idl;
for ( idl=ReceivePosDateLog[i].begin(); idl!=ReceivePosDateLog[i].end(); ++idl ) for ( idl=ReceivePosDateLog[i].begin(); idl!=ReceivePosDateLog[i].end(); ++idl )
{ {
ReceiveLogger.displayRawNL( "%u\t%u\t%"NL_I64"u", (*idl).ServerCycle, (*idl).PredictedInterval, (*idl).LocalTime ); ReceiveLogger.displayRawNL( "%u\t%u\t%" NL_I64 "u", (*idl).ServerCycle, (*idl).PredictedInterval, (*idl).LocalTime );
} }
} }
} }
@ -1156,7 +1156,7 @@ void CNetworkConnection::receiveSystemSync(CBitMemStream &msgin)
_CurrentClientTick = uint32(_CurrentServerTick - (_LCT+_MsPerTick)/_MsPerTick); _CurrentClientTick = uint32(_CurrentServerTick - (_LCT+_MsPerTick)/_MsPerTick);
_CurrentClientTime = _UpdateTime - (_LCT+_MsPerTick); _CurrentClientTime = _UpdateTime - (_LCT+_MsPerTick);
//nlinfo( "CNET[%p]: received SYNC %"NL_I64"u %"NL_I64"u - _CurrentReceivedNumber=%d _CurrentServerTick=%d", this, (uint64)_Synchronize, (uint64)stime, _CurrentReceivedNumber, _CurrentServerTick ); //nlinfo( "CNET[%p]: received SYNC %" NL_I64 "u %" NL_I64 "u - _CurrentReceivedNumber=%d _CurrentServerTick=%d", this, (uint64)_Synchronize, (uint64)stime, _CurrentReceivedNumber, _CurrentServerTick );
sendSystemAckSync(); sendSystemAckSync();
} }
@ -1704,7 +1704,7 @@ void CNetworkConnection::decodeVisualProperties( CBitMemStream& msgin )
{ {
nlinfo( "CLIENT: recvd property %hu (%s) for slot %hu, date %u", (uint16)PROPERTY_ORIENTATION, getPropText(PROPERTY_ORIENTATION), (uint16)slot, timestamp ); nlinfo( "CLIENT: recvd property %hu (%s) for slot %hu, date %u", (uint16)PROPERTY_ORIENTATION, getPropText(PROPERTY_ORIENTATION), (uint16)slot, timestamp );
} }
//nldebug("CLPROPNET[%p]: received property %d for entity %d: %"NL_I64"u", this, action->PropIndex, action->CLEntityId, action->getValue()); //nldebug("CLPROPNET[%p]: received property %d for entity %d: %" NL_I64 "u", this, action->PropIndex, action->CLEntityId, action->getValue());
} }
} }
@ -1964,7 +1964,7 @@ void CNetworkConnection::decodeDiscreetProperty( CBitMemStream& msgin, TPropInde
{ {
nlinfo( "CLIENT: recvd property %hu (%s) for slot %hu, date %u", (uint16)propIndex, getPropText(propIndex), (uint16)slot, TVPNodeClient::SlotContext.Timestamp ); nlinfo( "CLIENT: recvd property %hu (%s) for slot %hu, date %u", (uint16)propIndex, getPropText(propIndex), (uint16)slot, TVPNodeClient::SlotContext.Timestamp );
} }
//nldebug("CLPROPNET[%p]: received property %d for entity %d: %"NL_I64"u", this, action->PropIndex, action->CLEntityId, action->getValue()); //nldebug("CLPROPNET[%p]: received property %d for entity %d: %" NL_I64 "u", this, action->PropIndex, action->CLEntityId, action->getValue());
} }
} }
} }

View file

@ -107,7 +107,7 @@ void CPropertyDecoder::receive(TPacketNumber /* packetNumber */, CAction *action
property.LastReceived = act->getValue(); property.LastReceived = act->getValue();
nldebug("CLPROPD: Received (Id=%d,Act=%d)=(%"NL_I64"d)(Pck=%d)", act->Slot, act->Code, property.LastReceived, packetNumber); nldebug("CLPROPD: Received (Id=%d,Act=%d)=(%" NL_I64 "d)(Pck=%d)", act->Slot, act->Code, property.LastReceived, packetNumber);
} }
*/ */
} }

View file

@ -1108,7 +1108,7 @@ std::string CDisplayerVisualEntity::getVisualProperties() const
uint64 uVPB = leafB->getValue64(); uint64 uVPB = leafB->getValue64();
uint64 uVPC = leafC->getValue64(); uint64 uVPC = leafC->getValue64();
const std::string strVPABC = NLMISC::toString( "VPA:%016.16"NL_I64"x\nVPB:%016.16"NL_I64"x\nVPC:%016.16"NL_I64"x", uVPA, uVPB, uVPC ); const std::string strVPABC = NLMISC::toString( "VPA:%016.16" NL_I64 "x\nVPB:%016.16" NL_I64 "x\nVPC:%016.16" NL_I64 "x", uVPA, uVPB, uVPC );
return strVPABC; return strVPABC;
} }

View file

@ -806,7 +806,7 @@ int CEditor::luaGetVisualPropertiesFromInstanceId(CLuaState &ls)
uint64 uVPB = vB.get(); uint64 uVPB = vB.get();
uint64 uVPC = vC.get(); uint64 uVPC = vC.get();
std::string strVPABC = NLMISC::toString( "VPA:%016.16"NL_I64"x\nVPB:%016.16"NL_I64"x\nVPC:%016.16"NL_I64"x", uVPA, uVPB, uVPC ); std::string strVPABC = NLMISC::toString( "VPA:%016.16" NL_I64 "x\nVPB:%016.16" NL_I64 "x\nVPC:%016.16" NL_I64 "x", uVPA, uVPB, uVPC );
ls.push(strVPABC); ls.push(strVPABC);
@ -1957,12 +1957,12 @@ int CEditor::luaRemoveInstanceObserver(CLuaState &ls)
IInstanceObserver *observer = getEditor().getInstanceObserver((TInstanceObserverHandle) ls.toInteger(2)); IInstanceObserver *observer = getEditor().getInstanceObserver((TInstanceObserverHandle) ls.toInteger(2));
if (observer == NULL) if (observer == NULL)
{ {
CLuaIHM::fails(ls, "Instance observer not found for handle = %d"NL_I64, ls.toInteger(2)); CLuaIHM::fails(ls, "Instance observer not found for handle = %" NL_I64 "d", ls.toInteger(2));
} }
CInstanceObserverLua *luaObserver = dynamic_cast<CInstanceObserverLua *>(observer); CInstanceObserverLua *luaObserver = dynamic_cast<CInstanceObserverLua *>(observer);
if (luaObserver == NULL) if (luaObserver == NULL)
{ {
CLuaIHM::fails(ls, "Instance observer found for handle %d"NL_I64", but has bad type, it wasn't registered from lua.", ls.toInteger(2)); CLuaIHM::fails(ls, "Instance observer found for handle %" NL_I64 "d, but has bad type, it wasn't registered from lua.", ls.toInteger(2));
} }
getEditor().removeInstanceObserver((TInstanceObserverHandle) ls.toInteger(2)); getEditor().removeInstanceObserver((TInstanceObserverHandle) ls.toInteger(2));
CLuaObject receiver = luaObserver->getReceiver(); CLuaObject receiver = luaObserver->getReceiver();

View file

@ -3552,7 +3552,7 @@ void CUserEntity::CSpeedFactor::update(ICDBNode *node) // virtual
{ {
CCDBNodeLeaf *leaf = safe_cast<CCDBNodeLeaf *>(node); CCDBNodeLeaf *leaf = safe_cast<CCDBNodeLeaf *>(node);
_Value = ((float)leaf->getValue64())/100.0f; _Value = ((float)leaf->getValue64())/100.0f;
//nlinfo("SpeedFactor changed to %f / %"NL_I64"u", _Value, leaf->getValue64()); //nlinfo("SpeedFactor changed to %f / %" NL_I64 "u", _Value, leaf->getValue64());
// clamp the value (2.0 is the egg item or the level 6 speed up power up, nothing should be faster) // clamp the value (2.0 is the egg item or the level 6 speed up power up, nothing should be faster)
// commented because ring editor speed is in fact faster // commented because ring editor speed is in fact faster

View file

@ -1550,12 +1550,12 @@ void CMirroredDataSet::displayPropValue( const std::string& propName, const T
} }
case TypeUint64: case TypeUint64:
{ {
displayValueLine( propName, "%"NL_I64"u", "U64", (uint64*)NULL, this, entityIndex, propIndex, flagsStr, log ); displayValueLine( propName, "%" NL_I64 "u", "U64", (uint64*)NULL, this, entityIndex, propIndex, flagsStr, log );
break; break;
} }
case TypeSint64: case TypeSint64:
{ {
displayValueLine( propName, "%"NL_I64"d", "S64", (sint64*)NULL, this, entityIndex, propIndex, flagsStr, log ); displayValueLine( propName, "%" NL_I64 "d", "S64", (sint64*)NULL, this, entityIndex, propIndex, flagsStr, log );
break; break;
} }
case TypeFloat: case TypeFloat:
@ -1635,12 +1635,12 @@ void CMirroredDataSet::setValueFromString( const TDataSetRow& entityIndex, TP
} }
case TypeUint64: case TypeUint64:
{ {
assignValue( this, entityIndex, propIndex, valueStr.c_str(), "%"NL_I64"u", (uint64*)NULL ); assignValue( this, entityIndex, propIndex, valueStr.c_str(), "%" NL_I64 "u", (uint64*)NULL );
break; break;
} }
case TypeSint64: case TypeSint64:
{ {
assignValue( this, entityIndex, propIndex, valueStr.c_str(), "%"NL_I64"d", (sint64*)NULL ); assignValue( this, entityIndex, propIndex, valueStr.c_str(), "%" NL_I64 "d", (sint64*)NULL );
break; break;
} }
case TypeFloat: case TypeFloat:
@ -1726,12 +1726,12 @@ void CMirroredDataSet::getValueToString( const TDataSetRow& entityIndex, TPro
} }
case TypeUint64: case TypeUint64:
{ {
displayValue( this, entityIndex, propIndex, tmpStr, "%"NL_I64"u", (uint64*)NULL ); displayValue( this, entityIndex, propIndex, tmpStr, "%" NL_I64 "u", (uint64*)NULL );
break; break;
} }
case TypeSint64: case TypeSint64:
{ {
displayValue( this, entityIndex, propIndex, tmpStr, "%"NL_I64"d", (sint64*)NULL ); displayValue( this, entityIndex, propIndex, tmpStr, "%" NL_I64 "d", (sint64*)NULL );
break; break;
} }
case TypeFloat: case TypeFloat:

View file

@ -894,7 +894,7 @@ void CObjectInteger::inPlaceCopy(const CObjectInteger &src)
} }
std::string CObjectInteger::doToString() const { return NLMISC::toString("%d"NL_I64, _Value); } std::string CObjectInteger::doToString() const { return NLMISC::toString("%" NL_I64 "d", _Value); }
void CObjectInteger::doSerialize(std::string& out, CSerializeContext& /* context */) const void CObjectInteger::doSerialize(std::string& out, CSerializeContext& /* context */) const
{ {
@ -1977,7 +1977,7 @@ void CObjectInteger::dump(const std::string prefix, uint depth) const
{ {
//H_AUTO(R2_CObjectInteger_dump) //H_AUTO(R2_CObjectInteger_dump)
std::string result(depth * 4, ' '); std::string result(depth * 4, ' ');
result += NLMISC::toString("%sInteger, ptr = 0x%p, value = %d"NL_I64", ghost = %s", prefix.c_str(), this, _Value, _Ghost ? "true" : "false"); result += NLMISC::toString("%sInteger, ptr = 0x%p, value = %" NL_I64 "d, ghost = %s", prefix.c_str(), this, _Value, _Ghost ? "true" : "false");
nlwarning(result.c_str()); nlwarning(result.c_str());
} }

View file

@ -138,7 +138,7 @@ void sendUDPNow (CUdpSock *client, const uint8 *packet, uint32 packetSize, const
client->sendTo (packet, packetSize, *addr); client->sendTo (packet, packetSize, *addr);
// uint32 packetNumber = *(uint32 *)packet; // uint32 packetNumber = *(uint32 *)packet;
// nlinfo ("time %"NL_I64"u sending now packet %5u", CTime::getLocalTime (), packetNumber); // nlinfo ("time %" NL_I64 "u sending now packet %5u", CTime::getLocalTime (), packetNumber);
} }
void sendUDP (CUdpSock *client, const uint8 *packet, uint32 packetSize, const CInetAddress *addr) void sendUDP (CUdpSock *client, const uint8 *packet, uint32 packetSize, const CInetAddress *addr)

View file

@ -236,7 +236,7 @@ private:
break; break;
default: default:
fprintf(stderr,"\n"__FILE__":%d: BUG: invlid special code in CTextOutput object: %d\n",__LINE__,(int)code); fprintf(stderr,"\n" __FILE__ ":%d: BUG: invlid special code in CTextOutput object: %d\n",__LINE__,(int)code);
} }
} }

View file

@ -561,13 +561,13 @@ bool SExportOptions::loadcf (CConfigFile &cf)
bool SExportOptions::save (FILE *f) bool SExportOptions::save (FILE *f)
{ {
fprintf (f,"\n// Export Options\n"); fprintf (f,"\n// Export Options\n");
fprintf (f, "EXP_OutIGDir = \"%s\";\n", OutIGDir); fprintf (f, "EXP_OutIGDir = \"%s\";\n", OutIGDir.c_str());
fprintf (f, "EXP_ZoneWDir = \"%s\";\n", InLandscapeDir); fprintf (f, "EXP_ZoneWDir = \"%s\";\n", InLandscapeDir.c_str());
fprintf (f, "EXP_SmallBank = \"%s\";\n", LandBankFile); fprintf (f, "EXP_SmallBank = \"%s\";\n", LandBankFile.c_str());
fprintf (f, "EXP_FarBank = \"%s\";\n", LandFarBankFile); fprintf (f, "EXP_FarBank = \"%s\";\n", LandFarBankFile.c_str());
fprintf (f, "EXP_DisplaceDir = \"%s\";\n", LandTileNoiseDir); fprintf (f, "EXP_DisplaceDir = \"%s\";\n", LandTileNoiseDir.c_str());
fprintf (f, "EXP_CellSize = %f;\n", CellSize); fprintf (f, "EXP_CellSize = %f;\n", CellSize);
fprintf (f, "EXP_PrimFloraDir = \"%s\";\n", PrimFloraDir); fprintf (f, "EXP_PrimFloraDir = \"%s\";\n", PrimFloraDir.c_str());
return true; return true;
} }

View file

@ -379,7 +379,7 @@ void updateNetwork()
TextContext->setHotSpot (UTextContext::MiddleTop); TextContext->setHotSpot (UTextContext::MiddleTop);
TextContext->setColor (CRGBA(255, 255, 255, 255)); TextContext->setColor (CRGBA(255, 255, 255, 255));
TextContext->setFontSize (14); TextContext->setFontSize (14);
TextContext->printfAt (0.5f, 0.99f, "d:%"NL_I64"u u:%"NL_I64"u / d:%"NL_I64"u u:%"NL_I64"u / d:%"NL_I64"u u:%"NL_I64"u", TextContext->printfAt (0.5f, 0.99f, "d:%" NL_I64 "u u:%" NL_I64 "u / d:%" NL_I64 "u u:%" NL_I64 "u / d:%" NL_I64 "u u:%" NL_I64 "u",
Connection->bytesDownloaded (), Connection->bytesUploaded (), Connection->bytesDownloaded (), Connection->bytesUploaded (),
Connection->getBytesReceived (),Connection->getBytesSent (), Connection->getBytesReceived (),Connection->getBytesSent (),
newBytesDownloaded, newBytesUploaded); newBytesDownloaded, newBytesUploaded);