String conversion fix/extension
This was SVN commit r1285.
This commit is contained in:
parent
3136791492
commit
c32e6d5215
@ -94,6 +94,8 @@ struct _nm: public CNetMessage \
|
||||
|
||||
#ifdef NMT_CREATOR_IMPLEMENT
|
||||
|
||||
#include "StringConverters.h"
|
||||
|
||||
/*************************************************************************/
|
||||
// Pass 2, GetSerializedLength
|
||||
#define NMT_CREATOR_PASS_GETLENGTH
|
||||
@ -270,12 +272,12 @@ CStr _nm::GetString() const \
|
||||
|
||||
#define NMT_FIELD_INT(_nm, _hosttp, _netsz) \
|
||||
ret += #_nm _T(": "); \
|
||||
ret += CStr(thiz->_nm); \
|
||||
ret += NetMessageStringConvert(thiz->_nm); \
|
||||
ret += _T(", ");
|
||||
|
||||
#define NMT_FIELD(_tp, _nm) \
|
||||
ret += #_nm _T(": "); \
|
||||
ret += CStr(thiz->_nm); \
|
||||
ret += NetMessageStringConvert(thiz->_nm); \
|
||||
ret += _T(", ");
|
||||
|
||||
#define END_NMT_CLASS() \
|
||||
|
23
source/ps/Network/StringConverters.h
Executable file
23
source/ps/Network/StringConverters.h
Executable file
@ -0,0 +1,23 @@
|
||||
#ifndef _StringConverters_H
|
||||
#define _StringConverters_H
|
||||
|
||||
#include "CStr.h"
|
||||
#include "simulation/EntityHandles.h"
|
||||
|
||||
template <typename _T>
|
||||
CStr NetMessageStringConvert(const _T &arg);
|
||||
|
||||
// String Converters
|
||||
template <typename _T>
|
||||
inline CStr NetMessageStringConvert(const _T &arg)
|
||||
{
|
||||
return CStr(arg);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline CStr NetMessageStringConvert(const HEntity &arg)
|
||||
{
|
||||
return arg.operator CStr8();
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user