Browse Source

Merge pull request #72 from dpogue/mingw

Partial MinGW
Adam Johnson 14 years ago
parent
commit
109e389178
  1. 2
      Sources/Plasma/CoreLib/HeadSpin.cpp
  2. 12
      Sources/Plasma/CoreLib/hsConfig.h
  3. 36
      Sources/Plasma/CoreLib/hsMalloc.h
  4. 1
      Sources/Plasma/CoreLib/hsMemory.h
  5. 36
      Sources/Plasma/CoreLib/hsStlUtils.h
  6. 14
      Sources/Plasma/CoreLib/hsStream.cpp
  7. 6
      Sources/Plasma/CoreLib/hsTypes.h
  8. 44
      Sources/Plasma/CoreLib/hsUtils.h
  9. 2
      Sources/Plasma/CoreLibExe/Pch.h
  10. 2
      Sources/Plasma/CoreLibExe/hsExeError.cpp
  11. 2
      Sources/Plasma/CoreLibExe/hsExeMalloc.cpp
  12. 14
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp
  13. 15
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.cpp
  14. 12
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.h
  15. 6
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp
  16. 2
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.h
  17. 2
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp
  18. 2
      Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp
  19. 29
      Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.cpp
  20. 13
      Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.cpp
  21. 2
      Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.h
  22. 4
      Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp
  23. 4
      Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.h
  24. 256
      Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp
  25. 2
      Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h
  26. 6
      Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp
  27. 4
      Sources/Plasma/FeatureLib/pfPython/pyEnum.cpp
  28. 2
      Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.cpp
  29. 2
      Sources/Plasma/FeatureLib/pfPython/pyKeyMap.cpp
  30. 13
      Sources/Plasma/NucleusLib/inc/plProfileManager.cpp
  31. 4
      Sources/Plasma/NucleusLib/pnAddrInfo/pnAddrInfo.cpp
  32. 4
      Sources/Plasma/NucleusLib/pnAddrInfo/pnAddrInfo.h
  33. 2
      Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xSocket.cpp
  34. 2
      Sources/Plasma/NucleusLib/pnFactory/plFactory.cpp
  35. 4
      Sources/Plasma/NucleusLib/pnInputCore/plControlDefinition.h
  36. 2
      Sources/Plasma/NucleusLib/pnInputCore/plInputMap.cpp
  37. 14
      Sources/Plasma/NucleusLib/pnInputCore/plKeyDef.h
  38. 2
      Sources/Plasma/NucleusLib/pnInputCore/plKeyMap.h
  39. 2
      Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbAllIncludes.h
  40. 4
      Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbError.h
  41. 2
      Sources/Plasma/NucleusLib/pnNetBase/pnNbConst.h
  42. 2
      Sources/Plasma/NucleusLib/pnNetCommon/plNetSharedState.cpp
  43. 2
      Sources/Plasma/NucleusLib/pnNetCommon/plNetSharedState.h
  44. 2
      Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.cpp
  45. 123
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h
  46. 2
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMisc.h
  47. 43
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRef.h
  48. 2
      Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.cpp
  49. 2
      Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.h
  50. 2
      Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.cpp
  51. 2
      Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.h
  52. 2
      Sources/Plasma/PubUtilLib/plAvatar/plClothingLayout.h
  53. 1
      Sources/Plasma/PubUtilLib/plEncryption/plChecksum.cpp
  54. 2
      Sources/Plasma/PubUtilLib/plFile/hsFiles.cpp
  55. 4
      Sources/Plasma/PubUtilLib/plFile/plEncryptedStream.cpp
  56. 2
      Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp
  57. 2
      Sources/Plasma/PubUtilLib/plGImage/plFontCache.cpp
  58. 2
      Sources/Plasma/PubUtilLib/plGImage/plFontCache.h
  59. 2
      Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.cpp
  60. 2
      Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.h
  61. 24
      Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.h
  62. 2
      Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h
  63. 2
      Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.cpp
  64. 4
      Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp
  65. 2
      Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h
  66. 2
      Sources/Plasma/PubUtilLib/plPipeline/hsG3DDeviceSelector.cpp
  67. 2
      Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h
  68. 2
      Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp
  69. 4
      Sources/Plasma/PubUtilLib/plResMgr/plLocalization.cpp
  70. 6
      Sources/Plasma/PubUtilLib/plResMgr/plLocalization.h
  71. 3
      Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp
  72. 1
      Sources/Plasma/PubUtilLib/plResMgr/plResManager.h
  73. 1
      Sources/Plasma/PubUtilLib/plResMgr/plVersion.cpp
  74. 2
      Sources/Plasma/PubUtilLib/plSDL/plSDLMgr.cpp
  75. 14
      Sources/Plasma/PubUtilLib/plScene/plVisMgr.cpp
  76. 4
      Sources/Plasma/PubUtilLib/plScene/plVisMgr.h
  77. 2
      Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp

2
Sources/Plasma/CoreLib/HeadSpin.cpp

@ -37,7 +37,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#endif #endif
#if HS_BUILD_FOR_WIN32 #if HS_BUILD_FOR_WIN32
#ifdef _MSC_VER
# include <crtdbg.h> /* for _RPT_BASE */ # include <crtdbg.h> /* for _RPT_BASE */
#endif
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# define WIN32_EXTRA_LEAN # define WIN32_EXTRA_LEAN
# include <windows.h> // For OutputDebugString() # include <windows.h> // For OutputDebugString()

12
Sources/Plasma/CoreLib/hsConfig.h

@ -74,8 +74,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// 4018: signed/unsigned mismatch // 4018: signed/unsigned mismatch
// 4786: 255 character debug limit // 4786: 255 character debug limit
// 4284: STL template defined operator-> for a class it doesn't make sense for (int, etc) // 4284: STL template defined operator-> for a class it doesn't make sense for (int, etc)
#if !__MWERKS__ // 4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
#pragma warning( disable : 4305 4503 4018 4786 4284) #ifdef _MSC_VER
#pragma warning( disable : 4305 4503 4018 4786 4284 4800)
#endif #endif
// VC++ version greater than 6.0, must be building for .NET // VC++ version greater than 6.0, must be building for .NET
@ -88,6 +89,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#endif #endif
#ifdef HS_BUILD_FOR_WIN32
# define CDECL __cdecl
#else
# define CDECL
#endif
/////////////////////Debugging Defines /////////////////////////////////// /////////////////////Debugging Defines ///////////////////////////////////
#if (defined(_DEBUG)||defined(UNIX_DEBUG)) && !defined(HS_DISABLE_ASSERT) #if (defined(_DEBUG)||defined(UNIX_DEBUG)) && !defined(HS_DISABLE_ASSERT)

36
Sources/Plasma/CoreLib/hsMalloc.h

@ -97,21 +97,43 @@ void MemSetColor (unsigned short color);
#ifdef __cplusplus #ifdef __cplusplus
#include <new>
#ifndef _MSC_VER
#define THROW(x) throw(x)
#define THROW_EMPTY throw()
#else
#define THROW(x)
#define THROW_EMPTY
#endif
// standard new and delete // standard new and delete
inline void * __cdecl operator new (size_t bytes) { return MemAlloc((unsigned)bytes, 0, __FILE__, __LINE__); } inline void* CDECL operator new (size_t bytes) THROW(std::bad_alloc)
inline void __cdecl operator delete (void * ptr) { MemFree(ptr, 0); } { return MemAlloc((unsigned)bytes, 0, __FILE__, __LINE__); }
inline void* CDECL operator new [](size_t bytes) THROW(std::bad_alloc)
{ return MemAlloc((unsigned)bytes, 0, __FILE__, __LINE__); }
inline void CDECL operator delete (void * ptr) THROW_EMPTY
{ MemFree(ptr, 0); }
inline void CDECL operator delete [](void * ptr) THROW_EMPTY
{ MemFree(ptr, 0); }
// memcheck-friendly new // memcheck-friendly new
inline void * __cdecl operator new (size_t bytes, const char file[], unsigned line) { return MemAlloc((unsigned)bytes, 0, file, line); } inline void* CDECL operator new (size_t bytes, const char file[], unsigned line)
inline void __cdecl operator delete (void * ptr, const char [] , unsigned) { return MemFree(ptr, 0); } { return MemAlloc((unsigned)bytes, 0, file, line); }
inline void* CDECL operator new [](size_t bytes, const char file[], unsigned line)
{ return MemAlloc((unsigned)bytes, 0, file, line); }
inline void CDECL operator delete (void * ptr, const char [], unsigned)
{ return MemFree(ptr, 0); }
inline void CDECL operator delete [](void * ptr, const char [], unsigned)
{ return MemFree(ptr, 0); }
#define TRACKED_NEW new(__FILE__, __LINE__) #define TRACKED_NEW new(__FILE__, __LINE__)
// placement new // placement new
#ifndef __PLACEMENT_NEW_INLINE #if defined(_MSC_VER) && !defined(__PLACEMENT_NEW_INLINE)
#define __PLACEMENT_NEW_INLINE #define __PLACEMENT_NEW_INLINE
inline void * __cdecl operator new (size_t, void * ptr) { return ptr; } inline void* CDECL operator new (size_t, void * ptr) { return ptr; }
inline void __cdecl operator delete (void *, void *) {} inline void CDECL operator delete (void *, void *) {}
#endif // ifndef __PLACEMENT_NEW_INLINE #endif // ifndef __PLACEMENT_NEW_INLINE
#endif // ifdef __cplusplus #endif // ifdef __cplusplus

1
Sources/Plasma/CoreLib/hsMemory.h

@ -27,6 +27,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define hsMemoryDefined #define hsMemoryDefined
#include "hsTypes.h" #include "hsTypes.h"
#include "hsMalloc.h"
//#include "hsTemplates.h" //#include "hsTemplates.h"
class HSMemory { class HSMemory {

36
Sources/Plasma/CoreLib/hsStlUtils.h

@ -27,7 +27,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define hsStlUtils_h_inc #define hsStlUtils_h_inc
#include "hsUtils.h" #include "hsUtils.h"
#include <xmemory> //#include <xmemory>
#include <functional> #include <functional>
#include <algorithm> #include <algorithm>
#include <string> #include <string>
@ -46,20 +46,20 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// TEMPLATE CLASS cyallocator // TEMPLATE CLASS cyallocator
template<class _Ty> template<class _Ty>
class cyallocator class cyallocator
: public std::_Allocator_base<_Ty> : public std::allocator<_Ty>
{ // generic cyallocator for objects of class _Ty { // generic cyallocator for objects of class _Ty
public: public:
typedef std::_Allocator_base<_Ty> _Mybase; typedef std::allocator<_Ty> _Mybase;
typedef typename _Mybase::value_type value_type; typedef typename _Mybase::value_type value_type;
typedef value_type _FARQ *pointer; typedef value_type* pointer;
typedef value_type _FARQ& reference; typedef value_type& reference;
typedef const value_type _FARQ *const_pointer; typedef const value_type* const_pointer;
typedef const value_type _FARQ& const_reference; typedef const value_type& const_reference;
typedef _SIZT size_type; typedef size_t size_type;
typedef _PDFT difference_type; typedef ptrdiff_t difference_type;
template<class _Other> template<class _Other>
struct rebind struct rebind
@ -106,7 +106,7 @@ public:
return (pointer)ALLOC(_Count * sizeof(_Ty)); return (pointer)ALLOC(_Count * sizeof(_Ty));
} }
pointer allocate(size_type _Count, const void _FARQ *) pointer allocate(size_type _Count, const void*)
{ // allocate array of _Count elements, ignore hint { // allocate array of _Count elements, ignore hint
return (allocate(_Count)); return (allocate(_Count));
} }
@ -121,9 +121,9 @@ public:
std::_Destroy(_Ptr); std::_Destroy(_Ptr);
} }
_SIZT max_size() const size_t max_size() const
{ // estimate maximum array size { // estimate maximum array size
_SIZT _Count = (_SIZT)(-1) / sizeof (_Ty); size_t _Count = (size_t)(-1) / sizeof (_Ty);
return (0 < _Count ? _Count : 1); return (0 < _Count ? _Count : 1);
} }
}; };
@ -143,13 +143,17 @@ template<class _Ty,
return (false); return (false);
} }
#ifndef _CRTIMP2
#define _CRTIMP2
#endif
// CLASS cyallocator<void> // CLASS cyallocator<void>
template<> class _CRTIMP2 cyallocator<void> template<> class _CRTIMP2 cyallocator<void>
{ // generic cyallocator for type void { // generic cyallocator for type void
public: public:
typedef void _Ty; typedef void _Ty;
typedef _Ty _FARQ *pointer; typedef _Ty* pointer;
typedef const _Ty _FARQ *const_pointer; typedef const _Ty* const_pointer;
typedef _Ty value_type; typedef _Ty value_type;
template<class _Other> template<class _Other>
@ -264,12 +268,12 @@ struct delete_map_ptr_T
struct stricmp_less : public std::binary_function<std::string, std::string, bool> struct stricmp_less : public std::binary_function<std::string, std::string, bool>
{ {
bool operator()(const std::string & _X, const std::string & _Y) const bool operator()(const std::string & _X, const std::string & _Y) const
{return ( _stricmp(_X.c_str(),_Y.c_str()) < 0); } {return ( stricmp(_X.c_str(),_Y.c_str()) < 0); }
}; };
struct wstricmp_less : public std::binary_function<std::wstring, std::wstring, bool> struct wstricmp_less : public std::binary_function<std::wstring, std::wstring, bool>
{ {
bool operator()(const std::wstring & _X, const std::wstring & _Y) const bool operator()(const std::wstring & _X, const std::wstring & _Y) const
{return ( _wcsicmp(_X.c_str(),_Y.c_str()) < 0); } {return ( wcsicmp(_X.c_str(),_Y.c_str()) < 0); }
}; };
// struct stricmp_char_traits // struct stricmp_char_traits

14
Sources/Plasma/CoreLib/hsStream.cpp

@ -416,15 +416,15 @@ hsBool hsStream::GetToken(char *s, UInt32 maxLen, const char beginComment, const
s[k] = 0; s[k] = 0;
if( (k > 0)&&!_stricmp(s, "skip") ) if( (k > 0)&&!stricmp(s, "skip") )
{ {
int depth = 1; int depth = 1;
while( depth && GetToken(s, maxLen, beginComment, endCom) ) while( depth && GetToken(s, maxLen, beginComment, endCom) )
{ {
if( !_stricmp(s, "skip") ) if( !stricmp(s, "skip") )
depth++; depth++;
else else
if( !_stricmp(s, "piks") ) if( !stricmp(s, "piks") )
depth--; depth--;
} }
return GetToken(s, maxLen, beginComment, endCom); return GetToken(s, maxLen, beginComment, endCom);
@ -466,15 +466,15 @@ hsBool hsStream::ReadLn(char *s, UInt32 maxLen, const char beginComment, const c
s[k] = 0; s[k] = 0;
if( (k > 0)&&!_stricmp(s, "skip") ) if( (k > 0)&&!stricmp(s, "skip") )
{ {
int depth = 1; int depth = 1;
while( depth && ReadLn(s, maxLen, beginComment, endCom) ) while( depth && ReadLn(s, maxLen, beginComment, endCom) )
{ {
if( !_stricmp(s, "skip") ) if( !stricmp(s, "skip") )
depth++; depth++;
else else
if( !_stricmp(s, "piks") ) if( !stricmp(s, "piks") )
depth--; depth--;
} }
return ReadLn(s, maxLen, beginComment, endCom); return ReadLn(s, maxLen, beginComment, endCom);
@ -987,7 +987,7 @@ hsBool hsUNIXStream::Open(const char *name, const char *mode)
hsBool hsUNIXStream::Open(const wchar *name, const wchar *mode) hsBool hsUNIXStream::Open(const wchar *name, const wchar *mode)
{ {
fPosition = 0; fPosition = 0;
fRef = _wfopen(name, mode); fRef = hsWFopen(name, mode);
return (fRef) ? true : false; return (fRef) ? true : false;
} }

6
Sources/Plasma/CoreLib/hsTypes.h

@ -521,8 +521,8 @@ hsDebugMessageProc hsSetDebugMessageProc(hsDebugMessageProc newProc);
extern hsDebugMessageProc gHSStatusProc; extern hsDebugMessageProc gHSStatusProc;
hsDebugMessageProc hsSetStatusMessageProc(hsDebugMessageProc newProc); hsDebugMessageProc hsSetStatusMessageProc(hsDebugMessageProc newProc);
void __cdecl ErrorAssert (int line, const char file[], const char fmt[], ...); void CDECL ErrorAssert (int line, const char file[], const char fmt[], ...);
void __cdecl ErrorFatal (int line, const char file[], const char fmt[], ...); void CDECL ErrorFatal (int line, const char file[], const char fmt[], ...);
void ErrorMinimizeAppWindow (); void ErrorMinimizeAppWindow ();
enum EErrorOption { enum EErrorOption {
@ -561,7 +561,7 @@ void DebugMsgV (const char fmt[], va_list args);
#define ASSERT(expr) NULL_STMT #define ASSERT(expr) NULL_STMT
#define ASSERTMSG(expr, msg) NULL_STMT #define ASSERTMSG(expr, msg) NULL_STMT
#define FATAL(msg) NULL_STMT #define FATAL(msg) NULL_STMT
#define DEBUG_MSG NULL_STMT #define DEBUG_MSG (void)
#define DEBUG_MSGV NULL_STMT #define DEBUG_MSGV NULL_STMT
#define DEBUG_BREAK_IF_DEBUGGER_PRESENT NULL_STMT #define DEBUG_BREAK_IF_DEBUGGER_PRESENT NULL_STMT

44
Sources/Plasma/CoreLib/hsUtils.h

@ -45,7 +45,7 @@ char * hsFormatStr(const char * fmt, ...); // You are responsible for returned
char * hsFormatStrV(const char * fmt, va_list args); // You are responsible for returned memory. char * hsFormatStrV(const char * fmt, va_list args); // You are responsible for returned memory.
// Use "correct" stricmp based on the selected compiler / library // Use "correct" stricmp based on the selected compiler / library
#ifdef _MSC_VER #if HS_BUILD_FOR_WIN32
# define stricmp _stricmp # define stricmp _stricmp
# define strnicmp _strnicmp # define strnicmp _strnicmp
# define wcsicmp _wcsicmp # define wcsicmp _wcsicmp
@ -125,41 +125,31 @@ inline hsBool hsCompare(hsScalar a, hsScalar b, hsScalar delta=0.0001)
#if HS_BUILD_FOR_WIN32 #if HS_BUILD_FOR_WIN32
// This is for Windows
# define hsVsnprintf _vsnprintf # define hsVsnprintf _vsnprintf
# define hsVsnwprintf _vsnwprintf # define hsVsnwprintf _vsnwprintf
# define hsSnprintf _snprintf
# define hsSnwprintf _snwprintf
# define snprintf _snprintf # define snprintf _snprintf
# define snwprintf _snwprintf # define snwprintf _snwprintf
#define hsSnprintf snprintf # define swprintf _snwprintf
#define hsSnwprintf snwprintf
# ifndef fileno
# define fileno(__F) _fileno(__F)
# endif
# define hsWFopen(name, mode) _wfopen(name, mode)
#else #else
// This is for Unix, Linux, OSX, etc.
# define hsVsnprintf vsnprintf # define hsVsnprintf vsnprintf
#define hsWvnwprintf vsnwprintf # define hsVsnwprintf vswprintf
# define hsSnprintf snprintf # define hsSnprintf snprintf
#define hsSnwprintf snwprintf # define hsSnwprintf swprintf
#define _snprintf snprintf
#define _snwprintf snwprintf
#endif
#if HS_BUILD_FOR_UNIX || HS_BUILD_FOR_PS2 # define hsWFopen(name, mode) fopen(hsWStringToString(name), hsWStringToString(mode))
#endif
#define _stricmp(s1, s2) strcasecmp(s1, s2)
#define _strnicmp(s1, s2, n) strncasecmp(s1, s2, n)
#define stricmp(s1, s2) strcasecmp(s1, s2)
#define strnicmp(s1, s2, n) strncasecmp(s1, s2, n)
#define _fileno(n) fileno(n)
#elif HS_BUILD_FOR_MAC // HS_BUILD_FOR_UNIX || HS_BUILD_FOR_PS2
int hsStrcasecmp(const char s1[], const char s2[]);
int hsStrncasecmp(const char s1[], const char s2[], int n);
#define _stricmp(s1, s2) hsStrcasecmp(s1, s2)
#define _strnicmp(s1, s2, n) hsStrncasecmp(s1, s2, n)
#endif // HS_BUILD_FOR_UNIX || HS_BUILD_FOR_PS2
///////////////////////////// /////////////////////////////
// Physical memory functions // Physical memory functions

2
Sources/Plasma/CoreLibExe/Pch.h

@ -51,6 +51,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <malloc.h> #include <malloc.h>
#ifdef HS_BUILD_FOR_WIN32 #if _MSC_VER
#include <crtdbg.h> #include <crtdbg.h>
#endif #endif

2
Sources/Plasma/CoreLibExe/hsExeError.cpp

@ -56,7 +56,7 @@ static bool s_options[kNumErrorOptions];
AUTO_INIT_FUNC(hsExeErrorInit) { AUTO_INIT_FUNC(hsExeErrorInit) {
// The critical section has to be initialized // The critical section has to be initialized
// before program startup and never freed // before program startup and never freed
static byte rawMemory[sizeof CCritSect]; static byte rawMemory[sizeof(CCritSect)];
s_critsect = new(rawMemory) CCritSect; s_critsect = new(rawMemory) CCritSect;
} }

2
Sources/Plasma/CoreLibExe/hsExeMalloc.cpp

@ -329,6 +329,7 @@ static void __cdecl CheckLeaksOnExit () {
#endif // MEM_DEBUG #endif // MEM_DEBUG
//============================================================================ //============================================================================
#ifdef MEM_DEBUG
static int __cdecl CrtAllocHook ( static int __cdecl CrtAllocHook (
int method, int method,
void * pUserData, void * pUserData,
@ -344,6 +345,7 @@ static int __cdecl CrtAllocHook (
return 1; return 1;
} }
#endif // MEM_DEBUG
//=========================================================================== //===========================================================================
#ifdef MEM_DEBUG #ifdef MEM_DEBUG

14
Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp

@ -841,7 +841,7 @@ PF_CONSOLE_CMD( Console, SetVar, "string name, string value",
hsBool oldF = ctx.GetAddWhenNotFound(); hsBool oldF = ctx.GetAddWhenNotFound();
ctx.SetAddWhenNotFound( true ); ctx.SetAddWhenNotFound( true );
ctx.SetVar( params[ 0 ], params[ 1 ] ); ctx.SetVar((char*)params[ 0 ], (char*)params[ 1 ] );
ctx.SetAddWhenNotFound( oldF ); ctx.SetAddWhenNotFound( oldF );
} }
@ -2251,17 +2251,17 @@ PF_CONSOLE_CMD( App,
char* eventStr = params[1]; char* eventStr = params[1];
CallbackEvent event; CallbackEvent event;
if( !_stricmp(eventStr, "Start") ) if( !stricmp(eventStr, "Start") )
{ {
event = kStart; event = kStart;
} }
else else
if( !_stricmp(eventStr, "Stop") ) if( !stricmp(eventStr, "Stop") )
{ {
event = kStop; event = kStop;
} }
else else
if( !_stricmp(eventStr, "Time") ) if( !stricmp(eventStr, "Time") )
{ {
event = kTime; event = kTime;
secs = params[2]; secs = params[2];
@ -2306,17 +2306,17 @@ PF_CONSOLE_CMD( App,
char* eventStr = params[1]; char* eventStr = params[1];
CallbackEvent event; CallbackEvent event;
if( !_stricmp(eventStr, "Start") ) if( !stricmp(eventStr, "Start") )
{ {
event = kStart; event = kStart;
} }
else else
if( !_stricmp(eventStr, "Stop") ) if( !stricmp(eventStr, "Stop") )
{ {
event = kStop; event = kStop;
} }
else else
if( !_stricmp(eventStr, "Time") ) if( !stricmp(eventStr, "Time") )
{ {
event = kTime; event = kTime;
secs = params[2]; secs = params[2];

15
Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.cpp

@ -43,7 +43,7 @@ UInt32 pfConsoleCmdGroup::fBaseCmdGroupRef = 0;
//// Constructor & Destructor //////////////////////////////////////////////// //// Constructor & Destructor ////////////////////////////////////////////////
pfConsoleCmdGroup::pfConsoleCmdGroup( char *name, char *parent ) pfConsoleCmdGroup::pfConsoleCmdGroup(const char *name, const char *parent )
{ {
fNext = nil; fNext = nil;
fPrevPtr = nil; fPrevPtr = nil;
@ -160,7 +160,7 @@ pfConsoleCmd *pfConsoleCmdGroup::FindNestedPartialCommand( char *name, UInt32
// Try us // Try us
for( cmd = fCommands; cmd != nil; cmd = cmd->GetNext() ) for( cmd = fCommands; cmd != nil; cmd = cmd->GetNext() )
{ {
if( _strnicmp( cmd->GetName(), name, strlen( name ) ) == 0 ) if(strnicmp( cmd->GetName(), name, strlen( name ) ) == 0 )
{ {
if( *counter == 0 ) if( *counter == 0 )
return cmd; return cmd;
@ -250,7 +250,7 @@ pfConsoleCmd *pfConsoleCmdGroup::FindCommandNoCase( char *name, UInt8 flags,
{ {
for( cmd = start; cmd != nil; cmd = cmd->GetNext() ) for( cmd = start; cmd != nil; cmd = cmd->GetNext() )
{ {
if( _strnicmp( cmd->GetName(), name, strlen( name ) ) == 0 ) if(strnicmp( cmd->GetName(), name, strlen( name ) ) == 0 )
return cmd; return cmd;
} }
} }
@ -285,7 +285,7 @@ pfConsoleCmdGroup *pfConsoleCmdGroup::FindSubGroupNoCase( char *name, UInt8 fl
{ {
for( group = start; group != nil; group = group->GetNext() ) for( group = start; group != nil; group = group->GetNext() )
{ {
if( _strnicmp( group->GetName(), name, strlen( name ) ) == 0 ) if(strnicmp( group->GetName(), name, strlen( name ) ) == 0 )
return group; return group;
} }
} }
@ -355,7 +355,8 @@ int pfConsoleCmdGroup::IterateCommands(pfConsoleCmdIterator* t, int depth)
char pfConsoleCmd::fSigTypes[ kNumTypes ][ 8 ] = { "int", "float", "bool", "string", "char", "void", "..." }; char pfConsoleCmd::fSigTypes[ kNumTypes ][ 8 ] = { "int", "float", "bool", "string", "char", "void", "..." };
pfConsoleCmd::pfConsoleCmd( char *group, char *name, char *paramList, char *help, pfConsoleCmd::pfConsoleCmd(const char *group, const char *name,
const char *paramList, const char *help,
pfConsoleCmdPtr func, hsBool localOnly ) pfConsoleCmdPtr func, hsBool localOnly )
{ {
fNext = nil; fNext = nil;
@ -390,7 +391,7 @@ pfConsoleCmd::~pfConsoleCmd()
//// ICreateSignature //////////////////////////////////////////////////////// //// ICreateSignature ////////////////////////////////////////////////////////
// Creates the signature and sig labels based on the given string. // Creates the signature and sig labels based on the given string.
void pfConsoleCmd::ICreateSignature( char *paramList ) void pfConsoleCmd::ICreateSignature(const char *paramList )
{ {
static char seps[] = " :-"; static char seps[] = " :-";
@ -461,7 +462,7 @@ void pfConsoleCmd::ICreateSignature( char *paramList )
// Finds the group this command should be in and registers it with that // Finds the group this command should be in and registers it with that
// group. // group.
void pfConsoleCmd::Register( char *group, char *name ) void pfConsoleCmd::Register(const char *group, const char *name )
{ {
pfConsoleCmdGroup *g; pfConsoleCmdGroup *g;

12
Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.h

@ -65,7 +65,7 @@ class pfConsoleCmdGroup
kFindPartial = 0x01 kFindPartial = 0x01
}; };
pfConsoleCmdGroup( char *name, char *parent ); pfConsoleCmdGroup(const char *name, const char *parent );
~pfConsoleCmdGroup(); ~pfConsoleCmdGroup();
void AddCommand( pfConsoleCmd *cmd ); void AddCommand( pfConsoleCmd *cmd );
@ -159,7 +159,7 @@ class pfConsoleCmd
{ {
protected: protected:
char fName[ 128 ]; char fName[ 128 ];
char *fHelpString; const char* fHelpString;
pfConsoleCmdPtr fFunction; pfConsoleCmdPtr fFunction;
hsBool fLocalOnly; hsBool fLocalOnly;
@ -172,7 +172,7 @@ class pfConsoleCmd
hsExpander<UInt8> fSignature; hsExpander<UInt8> fSignature;
hsExpander<char *> fSigLabels; hsExpander<char *> fSigLabels;
void ICreateSignature( char *paramList ); void ICreateSignature(const char *paramList );
public: public:
@ -192,10 +192,10 @@ class pfConsoleCmd
static char fSigTypes[ kNumTypes ][ 8 ]; static char fSigTypes[ kNumTypes ][ 8 ];
pfConsoleCmd( char *group, char *name, char *paramList, char *help, pfConsoleCmdPtr func, hsBool localOnly = false ); pfConsoleCmd(const char *group, const char *name, const char *paramList, const char *help, pfConsoleCmdPtr func, hsBool localOnly = false );
~pfConsoleCmd(); ~pfConsoleCmd();
void Register( char *group, char *name ); void Register(const char *group, const char *name );
void Unregister(); void Unregister();
void Execute( Int32 numParams, pfConsoleCmdParam *params, void (*PrintFn)( const char * ) = nil ); void Execute( Int32 numParams, pfConsoleCmdParam *params, void (*PrintFn)( const char * ) = nil );
@ -204,7 +204,7 @@ class pfConsoleCmd
pfConsoleCmd *GetNext( void ) { return fNext; } pfConsoleCmd *GetNext( void ) { return fNext; }
char *GetName( void ) { return fName; } char *GetName( void ) { return fName; }
char *GetHelp( void ) { return fHelpString; } const char *GetHelp( void ) { return fHelpString; }
const char *GetSignature( void ); const char *GetSignature( void );
pfConsoleCmdGroup *GetParent( void ) { return fParentGroup; } pfConsoleCmdGroup *GetParent( void ) { return fParentGroup; }

6
Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp

@ -149,8 +149,10 @@ hsBool pfConsoleEngine::PrintCmdHelp( char *name, void (*PrintFn)( const char *
PrintFn( " Commands:" ); PrintFn( " Commands:" );
for( cmd = group->GetFirstCommand(); cmd != nil; cmd = cmd->GetNext() ) for( cmd = group->GetFirstCommand(); cmd != nil; cmd = cmd->GetNext() )
{ {
for( ptr = cmd->GetHelp(), i = 0; ptr[ i ] != 0 && ptr[ i ] != '\n'; i++ ) const char* p = cmd->GetHelp();
tempString[ i ] = ptr[ i ]; for(i = 0; p[ i ] != 0 && p[ i ] != '\n'; i++) {
tempString[ i ] = p[ i ];
}
tempString[ i ] = 0; tempString[ i ] = 0;
sprintf( string, " %s: %s", cmd->GetName(), tempString ); sprintf( string, " %s: %s", cmd->GetName(), tempString );

2
Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.h

@ -58,7 +58,7 @@ class pfConsoleEngine
char fErrorMsg[ 128 ]; char fErrorMsg[ 128 ];
char fLastErrorLine[ 512 ]; char fLastErrorLine[ 512 ];
void ISetErrorMsg( char *msg ) { hsStrncpy( fErrorMsg, msg, sizeof( fErrorMsg ) ); } void ISetErrorMsg(const char *msg ) { hsStrncpy( fErrorMsg, msg, sizeof( fErrorMsg ) ); }
// Recursive function to build a string of the groups a command is in // Recursive function to build a string of the groups a command is in
void IBuildCmdNameRecurse( pfConsoleCmdGroup *group, char *string ); void IBuildCmdNameRecurse( pfConsoleCmdGroup *group, char *string );

2
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp

@ -428,7 +428,7 @@ static bool showBounds = false;
float y = sH * fControls[ i ]->fBoundsPoints[ j ].fY; float y = sH * fControls[ i ]->fBoundsPoints[ j ].fY;
plDebugText::Instance().DrawRect( (UInt16)(x - 2), (UInt16)(y - 2), (UInt16)(x + 2), (UInt16)(y + 2), color ); plDebugText::Instance().DrawRect( (UInt16)(x - 2), (UInt16)(y - 2), (UInt16)(x + 2), (UInt16)(y + 2), color );
char str[ 16 ]; char str[ 16 ];
itoa( j, str, 10 ); snprintf(str, 16, "%d", j);
plDebugText::Instance().DrawString( (UInt16)(x + 8), (UInt16)(y - 8), str, color ); plDebugText::Instance().DrawString( (UInt16)(x + 8), (UInt16)(y - 8), str, color );
} }
} }

2
Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp

@ -32,6 +32,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// // // //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#include <wchar.h>
#include "pfJournalBook.h" #include "pfJournalBook.h"
#include "hsUtils.h" #include "hsUtils.h"
#include "hsStlUtils.h" #include "hsStlUtils.h"

29
Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.cpp

@ -50,6 +50,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <bxwchar.h> #include <bxwchar.h>
#endif #endif
// MinGW sucks
#if defined(_WIN32) && !defined(_MSC_VER)
# define swprintf _snwprintf
#endif
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// //
// LocalizationXMLFile - a basic class for storing all the // LocalizationXMLFile - a basic class for storing all the
@ -422,7 +427,7 @@ bool LocalizationXMLFile::Parse(const std::string & fileName)
if (XML_Parse(fParser, Buff, (int)len, done) == XML_STATUS_ERROR) if (XML_Parse(fParser, Buff, (int)len, done) == XML_STATUS_ERROR)
{ {
wchar_t lineNumber[256]; wchar_t lineNumber[256];
_itow(XML_GetCurrentLineNumber(fParser), lineNumber, 10); swprintf(lineNumber, 256, L"%d", XML_GetCurrentLineNumber(fParser));
fLastError += L"ERROR: Parse error at line "; fLastError += L"ERROR: Parse error at line ";
fLastError += lineNumber; fLastError += lineNumber;
fLastError += L": "; fLastError += L": ";
@ -466,7 +471,7 @@ bool LocalizationXMLFile::Parse(const std::string & fileName)
void LocalizationXMLFile::AddError(const std::wstring & errorText) void LocalizationXMLFile::AddError(const std::wstring & errorText)
{ {
wchar_t lineNumber[256]; wchar_t lineNumber[256];
_itow(XML_GetCurrentLineNumber(fParser), lineNumber, 10); swprintf(lineNumber, 256, L"%d", XML_GetCurrentLineNumber(fParser));
fLastError += L"ERROR (line "; fLastError += L"ERROR (line ";
fLastError += lineNumber; fLastError += lineNumber;
fLastError += L"): " + errorText + L"\n"; fLastError += L"): " + errorText + L"\n";
@ -603,7 +608,7 @@ void LocalizationDatabase::IVerifyElement(const std::wstring &ageName, const std
int numLocales = plLocalization::GetNumLocales(); int numLocales = plLocalization::GetNumLocales();
for (int curLocale = 0; curLocale <= numLocales; curLocale++) for (int curLocale = 0; curLocale <= numLocales; curLocale++)
{ {
char *name = plLocalization::GetLanguageName((plLocalization::Language)curLocale); const char *name = plLocalization::GetLanguageName((plLocalization::Language)curLocale);
wchar_t *wName = hsStringToWString(name); wchar_t *wName = hsStringToWString(name);
languageNames.push_back(wName); languageNames.push_back(wName);
delete [] wName; delete [] wName;
@ -629,12 +634,7 @@ void LocalizationDatabase::IVerifyElement(const std::wstring &ageName, const std
{ {
fErrorString += L"ERROR: The language " + curTranslation->first + L" used by " + ageName + L"." + setName + L"."; fErrorString += L"ERROR: The language " + curTranslation->first + L" used by " + ageName + L"." + setName + L".";
fErrorString += elementName + L" is not supported, discarding translation\n"; fErrorString += elementName + L" is not supported, discarding translation\n";
#if !HS_BUILD_FOR_MAC
curTranslation = theElement.erase(curTranslation);
#else
// jfim: I thought std::map::erase returned void?
theElement.erase(curTranslation); theElement.erase(curTranslation);
#endif
curTranslation--; // because this will be incremented on the next run through the loop curTranslation--; // because this will be incremented on the next run through the loop
continue; continue;
} }
@ -645,12 +645,7 @@ void LocalizationDatabase::IVerifyElement(const std::wstring &ageName, const std
{ {
fErrorString += L"ERROR: Default language " + defaultLanguage + L" is missing from the translations in element "; fErrorString += L"ERROR: Default language " + defaultLanguage + L" is missing from the translations in element ";
fErrorString += ageName + L"." + setName + L"." + elementName + L", deleting element\n"; fErrorString += ageName + L"." + setName + L"." + elementName + L", deleting element\n";
#if !HS_BUILD_FOR_MAC
curElement = theSet.erase(curElement);
#else
// jfim: I thought std::map::erase returned void?
theSet.erase(curElement); theSet.erase(curElement);
#endif
curElement--; curElement--;
return; return;
} }
@ -918,7 +913,7 @@ pfLocalizationDataMgr::localizedElement pfLocalizationDataMgr::ICreateLocalizedE
for (int curLocale = 0; curLocale <= numLocales; curLocale++) for (int curLocale = 0; curLocale <= numLocales; curLocale++)
{ {
char *name = plLocalization::GetLanguageName((plLocalization::Language)curLocale); const char *name = plLocalization::GetLanguageName((plLocalization::Language)curLocale);
wchar_t *wName = hsStringToWString(name); wchar_t *wName = hsStringToWString(name);
retVal[wName] = L""; retVal[wName] = L"";
delete [] wName; delete [] wName;
@ -932,7 +927,7 @@ pfLocalizationDataMgr::localizedElement pfLocalizationDataMgr::ICreateLocalizedE
std::wstring pfLocalizationDataMgr::IGetCurrentLanguageName() std::wstring pfLocalizationDataMgr::IGetCurrentLanguageName()
{ {
std::wstring retVal; std::wstring retVal;
char *name = plLocalization::GetLanguageName(plLocalization::GetLanguage()); const char *name = plLocalization::GetLanguageName(plLocalization::GetLanguage());
wchar_t *wName = hsStringToWString(name); wchar_t *wName = hsStringToWString(name);
retVal = wName; retVal = wName;
delete [] wName; delete [] wName;
@ -948,7 +943,7 @@ std::vector<std::wstring> pfLocalizationDataMgr::IGetAllLanguageNames()
for (int curLocale = 0; curLocale <= numLocales; curLocale++) for (int curLocale = 0; curLocale <= numLocales; curLocale++)
{ {
char *name = plLocalization::GetLanguageName((plLocalization::Language)curLocale); const char *name = plLocalization::GetLanguageName((plLocalization::Language)curLocale);
wchar_t *wName = hsStringToWString(name); wchar_t *wName = hsStringToWString(name);
retVal.push_back(wName); retVal.push_back(wName);
delete [] wName; delete [] wName;
@ -1257,7 +1252,7 @@ std::wstring pfLocalizationDataMgr::GetElementPlainTextData(const std::wstring &
if (fLocalizedElements.exists(name)) if (fLocalizedElements.exists(name))
{ {
if (fLocalizedElements[name].find(languageName) != fLocalizedElements[name].end()) if (fLocalizedElements[name].find(languageName) != fLocalizedElements[name].end())
retVal = (std::wstring)fLocalizedElements[name][languageName]; retVal = fLocalizedElements[name][languageName];
} }
return retVal; return retVal;
} }

13
Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.cpp

@ -40,6 +40,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <bxwchar.h> #include <bxwchar.h>
#endif #endif
// MinGW sucks
#if defined(_WIN32) && !defined(_MSC_VER)
# define swprintf _snwprintf
#endif
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
//// pfLocalizedString functions ///////////////////////////////////// //// pfLocalizedString functions /////////////////////////////////////
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
@ -114,7 +119,7 @@ void pfLocalizedString::IConvertFromPlainText(const std::wstring & plainText)
curTextBlock.fText = L""; curTextBlock.fText = L"";
std::wstring number = plainText.substr(curIndex + 1, (endArgPos - (curIndex + 1))); std::wstring number = plainText.substr(curIndex + 1, (endArgPos - (curIndex + 1)));
curTextBlock.fParamIndex = _wtoi(number.c_str()) - 1; // args are 1-based, vectors are 0-based curTextBlock.fParamIndex = (UInt8)wcstol(number.c_str(), NULL, 10) - 1; // args are 1-based, vectors are 0-based
fText.push_back(curTextBlock); fText.push_back(curTextBlock);
curTextBlock.fIsParam = false; curTextBlock.fIsParam = false;
@ -150,7 +155,7 @@ void pfLocalizedString::IUpdatePlainText()
{ {
std::wstring paramStr = L"%"; std::wstring paramStr = L"%";
wchar_t buff[256]; wchar_t buff[256];
_itow(curTextBlock.fParamIndex + 1, buff, 10); swprintf(buff, 256, L"%d", curTextBlock.fParamIndex + 1);
paramStr += buff; paramStr += buff;
paramStr += L"s"; paramStr += L"s";
fPlainTextRep += paramStr; fPlainTextRep += paramStr;
@ -223,7 +228,7 @@ void pfLocalizedString::IConvertFromXML(const std::wstring & xml)
curTextBlock.fText = L""; curTextBlock.fText = L"";
std::wstring number = xml.substr(curIndex + 1, (endArgPos - (curIndex + 1))); std::wstring number = xml.substr(curIndex + 1, (endArgPos - (curIndex + 1)));
curTextBlock.fParamIndex = _wtoi(number.c_str()) - 1; // args are 1-based, vectors are 0-based curTextBlock.fParamIndex = (UInt8)wcstol(number.c_str(), nil, 10) - 1; // args are 1-based, vectors are 0-based
fText.push_back(curTextBlock); fText.push_back(curTextBlock);
curTextBlock.fIsParam = false; curTextBlock.fIsParam = false;
@ -260,7 +265,7 @@ void pfLocalizedString::IUpdateXML()
{ {
std::wstring paramStr = L"%"; std::wstring paramStr = L"%";
wchar_t buff[256]; wchar_t buff[256];
_itow(curTextBlock.fParamIndex + 1, buff, 10); swprintf(buff, 256, L"%d", curTextBlock.fParamIndex + 1);
paramStr += buff; paramStr += buff;
paramStr += L"s"; paramStr += L"s";
fXMLRep += paramStr; fXMLRep += paramStr;

2
Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizedString.h

@ -86,7 +86,7 @@ public:
bool operator>=(pfLocalizedString &obj); bool operator>=(pfLocalizedString &obj);
bool operator!=(pfLocalizedString &obj); bool operator!=(pfLocalizedString &obj);
operator const wchar_t *() {return fPlainTextRep.c_str();} //operator const wchar_t *() {return fPlainTextRep.c_str();}
operator std::wstring() {return fPlainTextRep;} operator std::wstring() {return fPlainTextRep;}
pfLocalizedString operator+(pfLocalizedString &obj); pfLocalizedString operator+(pfLocalizedString &obj);

4
Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.cpp

@ -1919,7 +1919,7 @@ void PythonInterface::WriteToStdErr(const char* text)
// //
// PURPOSE : Find module. If it doesn't exist then don't create, return nil. // PURPOSE : Find module. If it doesn't exist then don't create, return nil.
// //
PyObject* PythonInterface::FindModule(char* module) PyObject* PythonInterface::FindModule(const char* module)
{ {
PyObject *m; PyObject *m;
// first we must get rid of any old modules of the same name, we'll replace it // first we must get rid of any old modules of the same name, we'll replace it
@ -1960,7 +1960,7 @@ hsBool PythonInterface::IsModuleNameUnique(char* module)
// //
// PURPOSE : create a new module with built-ins // PURPOSE : create a new module with built-ins
// //
PyObject* PythonInterface::CreateModule(char* module) PyObject* PythonInterface::CreateModule(const char* module)
{ {
PyObject *m, *d; PyObject *m, *d;
// first we must get rid of any old modules of the same name, we'll replace it // first we must get rid of any old modules of the same name, we'll replace it

4
Sources/Plasma/FeatureLib/pfPython/cyPythonInterface.h

@ -123,10 +123,10 @@ public:
static void WriteToStdErr(const char* text); static void WriteToStdErr(const char* text);
// Find module. If it doesn't exist then don't create, return nil. // Find module. If it doesn't exist then don't create, return nil.
static PyObject* FindModule(char* module); static PyObject* FindModule(const char* module);
// create a new module with built-ins // create a new module with built-ins
static PyObject* CreateModule(char* module); static PyObject* CreateModule(const char* module);
// checks to see if a specific function is defined in this module // checks to see if a specific function is defined in this module
// get an item (probably a function) from the Plasma module // get an item (probably a function) from the Plasma module

256
Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp

@ -133,47 +133,47 @@ plProfile_CreateTimer("Update", "Python", PythonUpdate);
// //
// fFunctionNames - the actual names of the functions for On[event] types // fFunctionNames - the actual names of the functions for On[event] types
// //
char* plPythonFileMod::fFunctionNames[] = const char* plPythonFileMod::fFunctionNames[] =
{ {
{ "OnFirstUpdate" }, // kfunc_FirstUpdate "OnFirstUpdate", // kfunc_FirstUpdate
{ "OnUpdate" }, // kfunc_Update "OnUpdate", // kfunc_Update
{ "OnNotify" }, // kfunc_Notify "OnNotify", // kfunc_Notify
{ "OnTimer" }, // kfunc_AtTimer "OnTimer", // kfunc_AtTimer
{ "OnControlKeyEvent" }, // kfunc_OnKeyEvent "OnControlKeyEvent", // kfunc_OnKeyEvent
{ "Load" }, // kfunc_Load "Load", // kfunc_Load
{ "Save" }, // kfunc_Save "Save", // kfunc_Save
{ "OnGUINotify" }, // kfunc_GUINotify "OnGUINotify", // kfunc_GUINotify
{ "OnPageLoad" }, // kfunc_PageLoad "OnPageLoad", // kfunc_PageLoad
{ "OnClothingUpdate" }, // kfunc_ClothingUpdate "OnClothingUpdate", // kfunc_ClothingUpdate
{ "OnKIMsg" }, // kfunc_KIMsg, "OnKIMsg", // kfunc_KIMsg,
{ "OnMemberUpdate" }, // kfunc_MemberUpdate, "OnMemberUpdate", // kfunc_MemberUpdate,
{ "OnRemoteAvatarInfo" }, // kfunc_RemoteAvatarInfo, "OnRemoteAvatarInfo", // kfunc_RemoteAvatarInfo,
{ "OnRTChat" }, // kfunc_RTChat, "OnRTChat", // kfunc_RTChat,
{ "OnVaultEvent" }, // kfunc_VaultEvent, "OnVaultEvent", // kfunc_VaultEvent,
{ "AvatarPage" }, // kfunc_AvatarPage, "AvatarPage", // kfunc_AvatarPage,
{ "OnSDLNotify" }, // kfunc_SDLNotify "OnSDLNotify", // kfunc_SDLNotify
{ "OnOwnershipChanged" }, // kfunc_OwnershipNotify "OnOwnershipChanged", // kfunc_OwnershipNotify
{ "OnAgeVaultEvent" }, // kfunc_AgeVaultEvent "OnAgeVaultEvent", // kfunc_AgeVaultEvent
{ "OnInit" }, // kfunc_Init, "OnInit", // kfunc_Init,
{ "OnCCRMsg" }, // kfunc_OnCCRMsg, "OnCCRMsg", // kfunc_OnCCRMsg,
{ "OnServerInitComplete" }, // kfunc_OnServerInitComplete "OnServerInitComplete", // kfunc_OnServerInitComplete
{ "OnVaultNotify" }, // kfunc_OnVaultNotify "OnVaultNotify", // kfunc_OnVaultNotify
{ "OnDefaultKeyCaught" }, // kfunc_OnDefaultKeyCaught "OnDefaultKeyCaught", // kfunc_OnDefaultKeyCaught
{ "OnMarkerMsg" }, // kfunc_OnMarkerMsg, "OnMarkerMsg", // kfunc_OnMarkerMsg,
{ "OnBackdoorMsg" }, // kfunc_OnBackdoorMsg, "OnBackdoorMsg", // kfunc_OnBackdoorMsg,
{ "OnBehaviorNotify" }, // kfunc_OnBehaviorNotify, "OnBehaviorNotify", // kfunc_OnBehaviorNotify,
{ "OnLOSNotify" }, // kfunc_OnLOSNotify, "OnLOSNotify", // kfunc_OnLOSNotify,
{ "BeginAgeUnLoad" }, // kfunc_OnBeginAgeLoad, "BeginAgeUnLoad", // kfunc_OnBeginAgeLoad,
{ "OnMovieEvent" }, // kfunc_OnMovieEvent, "OnMovieEvent", // kfunc_OnMovieEvent,
{ "OnScreenCaptureDone" }, // kfunc_OnScreenCaptureDone, "OnScreenCaptureDone", // kfunc_OnScreenCaptureDone,
{ "OnClimbingBlockerEvent"},// kFunc_OnClimbingBlockerEvent, "OnClimbingBlockerEvent",// kFunc_OnClimbingBlockerEvent,
{ "OnAvatarSpawn"}, // kFunc_OnAvatarSpawn "OnAvatarSpawn", // kFunc_OnAvatarSpawn
{ "OnAccountUpdate"}, // kFunc_OnAccountUpdate "OnAccountUpdate", // kFunc_OnAccountUpdate
{ "gotPublicAgeList"}, // kfunc_gotPublicAgeList "gotPublicAgeList", // kfunc_gotPublicAgeList
{ "OnGameMgrMsg" }, // kfunc_OnGameMgrMsg "OnGameMgrMsg", // kfunc_OnGameMgrMsg
{ "OnGameCliMsg" }, // kfunc_OnGameCliMsg "OnGameCliMsg", // kfunc_OnGameCliMsg
{ "OnAIMsg" }, // kfunc_OnAIMsg "OnAIMsg", // kfunc_OnAIMsg
{ nil } nil
}; };
//// Callback From the Vault Events ////////////////////////////////////////////// //// Callback From the Vault Events //////////////////////////////////////////////
@ -199,8 +199,9 @@ public:
PyTuple_SetItem(ptuple, 0, pyVaultNodeRef::New(parentNode, childNode)); PyTuple_SetItem(ptuple, 0, pyVaultNodeRef::New(parentNode, childNode));
// call it // call it
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFileMod->fPyFunctionInstances[fFunctionIdx], PyObject* retVal = PyObject_CallMethod(
fPyFileMod->fFunctionNames[fFunctionIdx], fPyFileMod->fPyFunctionInstances[fFunctionIdx],
(char*)fPyFileMod->fFunctionNames[fFunctionIdx],
"lO",pyVault::kVaultNodeRefAdded,ptuple); "lO",pyVault::kVaultNodeRefAdded,ptuple);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -228,8 +229,9 @@ public:
PyTuple_SetItem(ptuple, 0, pyVaultNodeRef::New(parentNode, childNode)); PyTuple_SetItem(ptuple, 0, pyVaultNodeRef::New(parentNode, childNode));
// call it // call it
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFileMod->fPyFunctionInstances[fFunctionIdx], PyObject* retVal = PyObject_CallMethod(
fPyFileMod->fFunctionNames[fFunctionIdx], fPyFileMod->fPyFunctionInstances[fFunctionIdx],
(char*)fPyFileMod->fFunctionNames[fFunctionIdx],
"lO",pyVault::kVaultRemovingNodeRef,ptuple); "lO",pyVault::kVaultRemovingNodeRef,ptuple);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -257,8 +259,9 @@ public:
PyTuple_SetItem(ptuple, 0, pyVaultNode::New(changedNode)); PyTuple_SetItem(ptuple, 0, pyVaultNode::New(changedNode));
// call it // call it
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFileMod->fPyFunctionInstances[fFunctionIdx], PyObject* retVal = PyObject_CallMethod(
fPyFileMod->fFunctionNames[fFunctionIdx], fPyFileMod->fPyFunctionInstances[fFunctionIdx],
(char*)fPyFileMod->fFunctionNames[fFunctionIdx],
"lO",pyVault::kVaultNodeSaved,ptuple); "lO",pyVault::kVaultNodeSaved,ptuple);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -686,7 +689,7 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj)
} }
// - find functions in class they've defined. // - find functions in class they've defined.
PythonInterface::CheckInstanceForFunctions(fInstance,fFunctionNames,fPyFunctionInstances); PythonInterface::CheckInstanceForFunctions(fInstance,(char**)fFunctionNames,fPyFunctionInstances);
// clear any errors created by checking for methods in a class // clear any errors created by checking for methods in a class
PyErr_Clear(); // clear the error PyErr_Clear(); // clear the error
// register for messages that they have functions defined for // register for messages that they have functions defined for
@ -818,7 +821,9 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj)
{ {
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
// call it // call it
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_Init],fFunctionNames[kfunc_Init],nil); PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_Init],
(char*)fFunctionNames[kfunc_Init], nil);
if ( retVal == nil ) if ( retVal == nil )
{ {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
@ -894,8 +899,9 @@ void plPythonFileMod::HandleDiscardedKey( plKeyEventMsg *msg )
plProfile_BeginTiming( PythonUpdate ); plProfile_BeginTiming( PythonUpdate );
PyObject* retVal = PyObject_CallMethod( fPyFunctionInstances[ kfunc_OnDefaultKeyCaught ], PyObject* retVal = PyObject_CallMethod(
fFunctionNames[ kfunc_OnDefaultKeyCaught ], fPyFunctionInstances[ kfunc_OnDefaultKeyCaught ],
(char*)fFunctionNames[ kfunc_OnDefaultKeyCaught ],
"ciiiii", "ciiiii",
msg->GetKeyChar(), msg->GetKeyChar(),
(int)msg->GetKeyDown(), (int)msg->GetKeyDown(),
@ -1123,7 +1129,9 @@ hsBool plPythonFileMod::IEval(double secs, hsScalar del, UInt32 dirty)
{ {
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
// call it // call it
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_FirstUpdate],fFunctionNames[kfunc_FirstUpdate],nil); PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_FirstUpdate],
(char*)fFunctionNames[kfunc_FirstUpdate], nil);
if ( retVal == nil ) if ( retVal == nil )
{ {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
@ -1145,7 +1153,10 @@ hsBool plPythonFileMod::IEval(double secs, hsScalar del, UInt32 dirty)
{ {
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
// call it // call it
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_Update],fFunctionNames[kfunc_Update],"df",secs,del); PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_Update],
(char*)fFunctionNames[kfunc_Update],
"df", secs, del);
if ( retVal == nil ) if ( retVal == nil )
{ {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
@ -1495,7 +1506,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
// call it // call it
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_Notify],fFunctionNames[kfunc_Notify], PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_Notify],
(char*)fFunctionNames[kfunc_Notify],
"flO", pNtfyMsg->fState, id, levents); "flO", pNtfyMsg->fState, id, levents);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -1525,8 +1538,11 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
{ {
// call it // call it
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnKeyEvent],fFunctionNames[kfunc_OnKeyEvent], PyObject* retVal = PyObject_CallMethod(
"ll",pEMsg->GetControlCode(),pEMsg->ControlActivated()); fPyFunctionInstances[kfunc_OnKeyEvent],
(char*)fFunctionNames[kfunc_OnKeyEvent],
"ll", pEMsg->GetControlCode(),
pEMsg->ControlActivated());
if ( retVal == nil ) if ( retVal == nil )
{ {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
@ -1556,7 +1572,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
// yes... // yes...
// call it // call it
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_AtTimer],fFunctionNames[kfunc_AtTimer], PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_AtTimer],
(char*)fFunctionNames[kfunc_AtTimer],
"l", pTimerMsg->fID); "l", pTimerMsg->fID);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -1690,7 +1708,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
// call their OnGUINotify method // call their OnGUINotify method
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_GUINotify],fFunctionNames[kfunc_GUINotify], PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_GUINotify],
(char*)fFunctionNames[kfunc_GUINotify],
"lOl", id, pyControl, pGUIMsg->GetEvent()); "lOl", id, pyControl, pGUIMsg->GetEvent());
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -1725,7 +1745,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
roomname = (char*)pRLNMsg->GetRoom()->GetName(); roomname = (char*)pRLNMsg->GetRoom()->GetName();
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_PageLoad],fFunctionNames[kfunc_PageLoad], PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_PageLoad],
(char*)fFunctionNames[kfunc_PageLoad],
"ls", pRLNMsg->GetWhatHappen(), roomname); "ls", pRLNMsg->GetWhatHappen(), roomname);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -1756,7 +1778,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
// yes... // yes...
// call it // call it
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_ClothingUpdate],fFunctionNames[kfunc_ClothingUpdate],nil); PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_ClothingUpdate],
(char*)fFunctionNames[kfunc_ClothingUpdate], nil);
if ( retVal == nil ) if ( retVal == nil )
{ {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
@ -1850,7 +1874,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
} }
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_KIMsg],fFunctionNames[kfunc_KIMsg], PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_KIMsg],
(char*)fFunctionNames[kfunc_KIMsg],
"lO", pkimsg->GetCommand(), value); "lO", pkimsg->GetCommand(), value);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -1880,7 +1906,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
{ {
// yes... then call it // yes... then call it
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_MemberUpdate],fFunctionNames[kfunc_MemberUpdate],nil); PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_MemberUpdate],
(char*)fFunctionNames[kfunc_MemberUpdate], nil);
if ( retVal == nil ) if ( retVal == nil )
{ {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
@ -1931,7 +1959,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
} }
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_RemoteAvatarInfo],fFunctionNames[kfunc_RemoteAvatarInfo], PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_RemoteAvatarInfo],
(char*)fFunctionNames[kfunc_RemoteAvatarInfo],
"O", player); "O", player);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -1964,8 +1994,11 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
if ( textmessage == nil) if ( textmessage == nil)
textmessage = ""; textmessage = "";
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnCCRMsg],fFunctionNames[kfunc_OnCCRMsg], PyObject* retVal = PyObject_CallMethod(
"lsl",ccrmsg->GetType(),textmessage,ccrmsg->GetCCRPlayerID()); fPyFunctionInstances[kfunc_OnCCRMsg],
(char*)fFunctionNames[kfunc_OnCCRMsg],
"lsl", ccrmsg->GetType(), textmessage,
ccrmsg->GetCCRPlayerID());
if ( retVal == nil ) if ( retVal == nil )
{ {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
@ -2023,7 +2056,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
} }
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnVaultNotify],fFunctionNames[kfunc_OnVaultNotify], PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_OnVaultNotify],
(char*)fFunctionNames[kfunc_OnVaultNotify],
"lO", vaultNotifyMsg->GetType(), ptuple); "lO", vaultNotifyMsg->GetType(), ptuple);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -2077,8 +2112,11 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
} }
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_RTChat],fFunctionNames[kfunc_RTChat], PyObject* retVal = PyObject_CallMethod(
"Osl",player,pkimsg->GetString().c_str(),pkimsg->GetFlags()); fPyFunctionInstances[kfunc_RTChat],
(char*)fFunctionNames[kfunc_RTChat],
"Osl", player, pkimsg->GetString().c_str(),
pkimsg->GetFlags());
if ( retVal == nil ) if ( retVal == nil )
{ {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
@ -2110,7 +2148,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
plSynchEnabler ps(true); // enable dirty state tracking during shutdown plSynchEnabler ps(true); // enable dirty state tracking during shutdown
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_AvatarPage],fFunctionNames[kfunc_AvatarPage], PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_AvatarPage],
(char*)fFunctionNames[kfunc_AvatarPage],
"Oli", pSobj, !ppMsg->fUnload, ppMsg->fLastOut); "Oli", pSobj, !ppMsg->fUnload, ppMsg->fLastOut);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -2143,7 +2183,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
plSynchEnabler ps(true); // enable dirty state tracking during shutdown plSynchEnabler ps(true); // enable dirty state tracking during shutdown
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnBeginAgeLoad],fFunctionNames[kfunc_OnBeginAgeLoad], PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_OnBeginAgeLoad],
(char*)fFunctionNames[kfunc_OnBeginAgeLoad],
"O", pSobj); "O", pSobj);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -2176,7 +2218,10 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
} }
if (fPyFunctionInstances[kfunc_OnServerInitComplete]) if (fPyFunctionInstances[kfunc_OnServerInitComplete])
{ {
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnServerInitComplete],fFunctionNames[kfunc_OnServerInitComplete],nil); PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_OnServerInitComplete],
(char*)fFunctionNames[kfunc_OnServerInitComplete],
nil);
if ( retVal == nil ) if ( retVal == nil )
{ {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
@ -2207,8 +2252,11 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
tag = ""; tag = "";
// yes... then call it // yes... then call it
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_SDLNotify],fFunctionNames[kfunc_SDLNotify], PyObject* retVal = PyObject_CallMethod(
"ssls",sn->fVar->GetName(),sn->fSDLName.c_str(),sn->fPlayerID,tag); fPyFunctionInstances[kfunc_SDLNotify],
(char*)fFunctionNames[kfunc_SDLNotify],
"ssls", sn->fVar->GetName(), sn->fSDLName.c_str(),
sn->fPlayerID, tag);
if ( retVal == nil ) if ( retVal == nil )
{ {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
@ -2235,7 +2283,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
{ {
// yes... then call it // yes... then call it
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OwnershipNotify],fFunctionNames[kfunc_OwnershipNotify], PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_OwnershipNotify],
(char*)fFunctionNames[kfunc_OwnershipNotify],
nil); nil);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -2274,7 +2324,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
break; break;
} }
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnMarkerMsg], fFunctionNames[kfunc_OnMarkerMsg], PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_OnMarkerMsg],
(char*)fFunctionNames[kfunc_OnMarkerMsg],
"lO", (UInt32)markermsg->fType, ptuple); "lO", (UInt32)markermsg->fType, ptuple);
if (retVal == nil) if (retVal == nil)
{ {
@ -2305,8 +2357,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
{ {
// yes... then call it // yes... then call it
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnBackdoorMsg], PyObject* retVal = PyObject_CallMethod(
fFunctionNames[kfunc_OnBackdoorMsg], fPyFunctionInstances[kfunc_OnBackdoorMsg],
(char*)fFunctionNames[kfunc_OnBackdoorMsg],
"ss", dt->GetTarget(), dt->GetString()); "ss", dt->GetTarget(), dt->GetString());
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -2348,8 +2401,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
hitpoint = Py_None; hitpoint = Py_None;
} }
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnLOSNotify], PyObject* retVal = PyObject_CallMethod(
fFunctionNames[kfunc_OnLOSNotify], fPyFunctionInstances[kfunc_OnLOSNotify],
(char*)fFunctionNames[kfunc_OnLOSNotify],
"llOOf", pLOSMsg->fRequestID, pLOSMsg->fNoHit, "llOOf", pLOSMsg->fRequestID, pLOSMsg->fNoHit,
scobj, hitpoint, pLOSMsg->fDistance); scobj, hitpoint, pLOSMsg->fDistance);
if ( retVal == nil ) if ( retVal == nil )
@ -2395,9 +2449,11 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
Py_INCREF(Py_None); Py_INCREF(Py_None);
pSobj = Py_None; pSobj = Py_None;
} }
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnBehaviorNotify], PyObject* retVal = PyObject_CallMethod(
fFunctionNames[kfunc_OnBehaviorNotify], fPyFunctionInstances[kfunc_OnBehaviorNotify],
"lOl",behNotifymsg->fType,pSobj,behNotifymsg->state); (char*)fFunctionNames[kfunc_OnBehaviorNotify],
"lOl", behNotifymsg->fType, pSobj,
behNotifymsg->state);
if ( retVal == nil ) if ( retVal == nil )
{ {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
@ -2426,8 +2482,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
{ {
// yes... then call it // yes... then call it
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnMovieEvent], PyObject* retVal = PyObject_CallMethod(
fFunctionNames[kfunc_OnMovieEvent], fPyFunctionInstances[kfunc_OnMovieEvent],
(char*)fFunctionNames[kfunc_OnMovieEvent],
"si", moviemsg->fMovieName, (UInt32)moviemsg->fReason); "si", moviemsg->fMovieName, (UInt32)moviemsg->fReason);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -2468,8 +2525,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
Py_INCREF(Py_None); Py_INCREF(Py_None);
pSobj = Py_None; pSobj = Py_None;
} }
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnScreenCaptureDone], PyObject* retVal = PyObject_CallMethod(
fFunctionNames[kfunc_OnScreenCaptureDone], fPyFunctionInstances[kfunc_OnScreenCaptureDone],
(char*)fFunctionNames[kfunc_OnScreenCaptureDone],
"O", pSobj); "O", pSobj);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -2498,8 +2556,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
PyObject* pSobj = pySceneObject::New(pEvent->GetSender(), fSelfKey); PyObject* pSobj = pySceneObject::New(pEvent->GetSender(), fSelfKey);
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnClimbBlockerEvent], PyObject* retVal = PyObject_CallMethod(
fFunctionNames[kfunc_OnClimbBlockerEvent], fPyFunctionInstances[kfunc_OnClimbBlockerEvent],
(char*)fFunctionNames[kfunc_OnClimbBlockerEvent],
"O", pSobj); "O", pSobj);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -2520,8 +2579,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
plAvatarSpawnNotifyMsg* pSpawn = plAvatarSpawnNotifyMsg::ConvertNoRef(msg); plAvatarSpawnNotifyMsg* pSpawn = plAvatarSpawnNotifyMsg::ConvertNoRef(msg);
if (pSpawn) if (pSpawn)
{ {
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnAvatarSpawn], PyObject* retVal = PyObject_CallMethod(
fFunctionNames[kfunc_OnAvatarSpawn], fPyFunctionInstances[kfunc_OnAvatarSpawn],
(char*)fFunctionNames[kfunc_OnAvatarSpawn],
"l", 1); "l", 1);
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -2543,8 +2603,12 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
if (pUpdateMsg) if (pUpdateMsg)
{ {
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod(fPyFunctionInstances[kfunc_OnAccountUpdate], fFunctionNames[kfunc_OnAccountUpdate], PyObject* retVal = PyObject_CallMethod(
"iii", (int)pUpdateMsg->GetUpdateType(), (int)pUpdateMsg->GetResult(), (int)pUpdateMsg->GetPlayerInt() fPyFunctionInstances[kfunc_OnAccountUpdate],
(char*)fFunctionNames[kfunc_OnAccountUpdate],
"iii", (int)pUpdateMsg->GetUpdateType(),
(int)pUpdateMsg->GetResult(),
(int)pUpdateMsg->GetPlayerInt()
); );
if ( retVal == nil ) if ( retVal == nil )
{ {
@ -2586,7 +2650,7 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
PyObject* retVal = PyObject_CallMethod( PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_gotPublicAgeList], fPyFunctionInstances[kfunc_gotPublicAgeList],
fFunctionNames[kfunc_gotPublicAgeList], (char*)fFunctionNames[kfunc_gotPublicAgeList],
"O", "O",
pyEL pyEL
); );
@ -2617,7 +2681,7 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
PyObject* pythonMsg = pyGameMgrMsg::New(gameMgrMsg); PyObject* pythonMsg = pyGameMgrMsg::New(gameMgrMsg);
PyObject* retVal = PyObject_CallMethod( PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_OnGameMgrMsg], fPyFunctionInstances[kfunc_OnGameMgrMsg],
fFunctionNames[kfunc_OnGameMgrMsg], (char*)fFunctionNames[kfunc_OnGameMgrMsg],
"O", "O",
pythonMsg pythonMsg
); );
@ -2649,7 +2713,7 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
PyObject* pythonMsg = pyGameCliMsg::New(gameMgrMsg); PyObject* pythonMsg = pyGameCliMsg::New(gameMgrMsg);
PyObject* retVal = PyObject_CallMethod( PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_OnGameCliMsg], fPyFunctionInstances[kfunc_OnGameCliMsg],
fFunctionNames[kfunc_OnGameCliMsg], (char*)fFunctionNames[kfunc_OnGameCliMsg],
"O", "O",
pythonMsg pythonMsg
); );
@ -2720,7 +2784,7 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
// call the function with the above arguments // call the function with the above arguments
PyObject* retVal = PyObject_CallMethod( PyObject* retVal = PyObject_CallMethod(
fPyFunctionInstances[kfunc_OnAIMsg], fPyFunctionInstances[kfunc_OnAIMsg],
fFunctionNames[kfunc_OnAIMsg], (char*)fFunctionNames[kfunc_OnAIMsg],
"OisO", "OisO",
brainObj, msgType, aiMsg->BrainUserString().c_str(), args brainObj, msgType, aiMsg->BrainUserString().c_str(), args
); );

2
Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h

@ -191,7 +191,7 @@ public:
// array of matching Python instance where the functions are, if defined // array of matching Python instance where the functions are, if defined
PyObject* fPyFunctionInstances[kfunc_lastone]; PyObject* fPyFunctionInstances[kfunc_lastone];
// array of the names of the standard functions that can be called // array of the names of the standard functions that can be called
static char* fFunctionNames[]; static const char* fFunctionNames[];
// The konstant hard-coded name to be used for all global pythonFileMods // The konstant hard-coded name to be used for all global pythonFileMods
static char kGlobalNameKonstant[]; static char kGlobalNameKonstant[];

6
Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp

@ -273,8 +273,10 @@ void plPythonSDLModifier::ISetCurrentStateFrom(const plStateDataRecord* srcState
// Notify the Python code that we updated the SDL record // Notify the Python code that we updated the SDL record
if (fOwner->fPyFunctionInstances[plPythonFileMod::kfunc_Load] != nil) if (fOwner->fPyFunctionInstances[plPythonFileMod::kfunc_Load] != nil)
{ {
PyObject* retVal = PyObject_CallMethod(fOwner->fPyFunctionInstances[plPythonFileMod::kfunc_Load], PyObject* retVal = PyObject_CallMethod(
fOwner->fFunctionNames[plPythonFileMod::kfunc_Load], nil); fOwner->fPyFunctionInstances[plPythonFileMod::kfunc_Load],
(char*)fOwner->fFunctionNames[plPythonFileMod::kfunc_Load],
nil);
if (retVal == nil) if (retVal == nil)
{ {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE

4
Sources/Plasma/FeatureLib/pfPython/pyEnum.cpp

@ -274,7 +274,7 @@ PyObject *EnumValue_oct(EnumValue *v)
if (x == 0) if (x == 0)
strcpy(buf, "0"); strcpy(buf, "0");
else else
_snprintf(buf, sizeof(buf), "0%lo", x); snprintf(buf, sizeof(buf), "0%lo", x);
return PyString_FromString(buf); return PyString_FromString(buf);
} }
@ -287,7 +287,7 @@ PyObject *EnumValue_hex(EnumValue *v)
Py_INCREF(Py_NotImplemented); Py_INCREF(Py_NotImplemented);
return Py_NotImplemented; return Py_NotImplemented;
} }
_snprintf(buf, sizeof(buf), "0x%lx", x); snprintf(buf, sizeof(buf), "0x%lx", x);
return PyString_FromString(buf); return PyString_FromString(buf);
} }

2
Sources/Plasma/FeatureLib/pfPython/pyGUIControlListBox.cpp

@ -234,7 +234,7 @@ class pfColorListElement : public pfGUIListText
{ {
size_t length = wcslen( fString1 ) + wcslen( fString2 ) + 3; size_t length = wcslen( fString1 ) + wcslen( fString2 ) + 3;
thestring = TRACKED_NEW wchar_t[ length ]; thestring = TRACKED_NEW wchar_t[ length ];
swprintf( thestring, length, L"%s %s", fString1, fString2 ); snwprintf( thestring, length, L"%s %s", fString1, fString2 );
wemade_string = true; wemade_string = true;
} }
else if (fString1) else if (fString1)

2
Sources/Plasma/FeatureLib/pfPython/pyKeyMap.cpp

@ -38,7 +38,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// conversion functions // conversion functions
const char* pyKeyMap::ConvertVKeyToChar( UInt32 vk, UInt32 flags ) const char* pyKeyMap::ConvertVKeyToChar( UInt32 vk, UInt32 flags )
{ {
char *key = plKeyMap::ConvertVKeyToChar( vk ); const char *key = plKeyMap::ConvertVKeyToChar( vk );
static char shortKey[ 2 ]; static char shortKey[ 2 ];
if( key == nil ) if( key == nil )
{ {

13
Sources/Plasma/NucleusLib/inc/plProfileManager.cpp

@ -40,10 +40,16 @@ static UInt32 gCyclesPerMS = 0;
#pragma warning (push) #pragma warning (push)
#pragma warning (disable : 4035) // disable no return value warning #pragma warning (disable : 4035) // disable no return value warning
__forceinline UInt32 GetPentiumCounter() #ifdef _MSC_VER
{ #define forceinline __forceinline
__asm #else
#define forceinline inline
#endif
forceinline UInt32 GetPentiumCounter()
{ {
#ifdef _MSC_VER
__asm {
xor eax,eax // VC won't realize that eax is modified w/out this xor eax,eax // VC won't realize that eax is modified w/out this
// instruction to modify the val. // instruction to modify the val.
// Problem shows up in release mode builds // Problem shows up in release mode builds
@ -52,6 +58,7 @@ __forceinline UInt32 GetPentiumCounter()
xor edx,edx // so VC gets that edx is modified xor edx,edx // so VC gets that edx is modified
} }
#endif
} }
#pragma warning (pop) #pragma warning (pop)

4
Sources/Plasma/NucleusLib/pnAddrInfo/pnAddrInfo.cpp

@ -29,6 +29,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsTypes.h" #include "hsTypes.h"
#include "pnAddrInfo.h" #include "pnAddrInfo.h"
#include <string.h> #include <string.h>
#if HS_BUILD_FOR_UNIX #if HS_BUILD_FOR_UNIX
# include <unistd.h> # include <unistd.h>
# include <arpa/inet.h> # include <arpa/inet.h>
@ -138,7 +139,8 @@ void pnAddrInfo::GetLocalAddrs(List& addrslist, bool incLoopBack)
SOCKET s = socket(AF_INET, SOCK_DGRAM, 0); SOCKET s = socket(AF_INET, SOCK_DGRAM, 0);
if (WSAIoctl(s,SIO_GET_INTERFACE_LIST,NULL,NULL,(void*)infos,bufSize,&retSize,NULL,NULL) == 0) if (WSAIoctl(s, SIO_GET_INTERFACE_LIST, NULL, 0,
(void*)infos, bufSize, &retSize, NULL, NULL) == 0)
{ {
unsigned int entries = retSize/sizeof(INTERFACE_INFO); unsigned int entries = retSize/sizeof(INTERFACE_INFO);
int i; int i;

4
Sources/Plasma/NucleusLib/pnAddrInfo/pnAddrInfo.h

@ -37,11 +37,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
# include <sys/socket.h> # include <sys/socket.h>
# include <netdb.h> # include <netdb.h>
#elif HS_BUILD_FOR_WIN32 #elif HS_BUILD_FOR_WIN32
# if (_WIN32_WINNT < 0x0501)
# define _WIN32_WINNT 0x0501
# endif
# include <winsock2.h> # include <winsock2.h>
# include <ws2tcpip.h> # include <ws2tcpip.h>
#else #else
# error "pnAddrInfo Not Implemented!" # error "pnAddrInfo Not Implemented!"
#endif #endif
#include "hsTypes.h" #include "hsTypes.h"
#include "hsStlUtils.h" #include "hsStlUtils.h"

2
Sources/Plasma/NucleusLib/pnAsyncCoreExe/Private/W9x/pnAceW9xSocket.cpp

@ -605,7 +605,7 @@ void CSocket::ProcessQueue () {
// Dispatch it // Dispatch it
switch (command->code) { switch (command->code) {
case command->WRITE: { case Command::WRITE: {
AsyncNotifySocketWrite notify; AsyncNotifySocketWrite notify;
notify.param = command->param; notify.param = command->param;
notify.asyncId = 0; notify.asyncId = 0;

2
Sources/Plasma/NucleusLib/pnFactory/plFactory.cpp

@ -188,7 +188,7 @@ UInt16 plFactory::FindClassIndex(const char* className)
int i; int i;
for( i = 0; i < theFactory->fCreators.GetCount(); i++ ) for( i = 0; i < theFactory->fCreators.GetCount(); i++ )
{ {
if( theFactory->fCreators[i] && !_stricmp(className, theFactory->fCreators[i]->ClassName()) ) if( theFactory->fCreators[i] && !stricmp(className, theFactory->fCreators[i]->ClassName()) )
{ {
return theFactory->fCreators[i]->ClassIndex(); return theFactory->fCreators[i]->ClassIndex();
} }

4
Sources/Plasma/NucleusLib/pnInputCore/plControlDefinition.h

@ -97,13 +97,13 @@ enum
struct Win32keyConvert struct Win32keyConvert
{ {
UInt32 fVKey; UInt32 fVKey;
char* fKeyName; const char* fKeyName;
}; };
struct CommandConvert struct CommandConvert
{ {
ControlEventCode fCode; ControlEventCode fCode;
char* fDesc; const char* fDesc;
}; };

2
Sources/Plasma/NucleusLib/pnInputCore/plInputMap.cpp

@ -501,7 +501,7 @@ void plKeyMap::EraseBinding( ControlEventCode code )
} }
char* plKeyMap::ConvertVKeyToChar( UInt32 vk ) const char* plKeyMap::ConvertVKeyToChar( UInt32 vk )
{ {
Win32keyConvert* keyConvert = &fKeyConversionEnglish[0]; Win32keyConvert* keyConvert = &fKeyConversionEnglish[0];
switch (plLocalization::GetLanguage()) switch (plLocalization::GetLanguage())

14
Sources/Plasma/NucleusLib/pnInputCore/plKeyDef.h

@ -33,6 +33,20 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <windows.h> #include <windows.h>
#define VK_BACK_QUOTE 0xc0 #define VK_BACK_QUOTE 0xc0
// MinGW is missing these definitions:
#ifndef VK_OEM_PLUS
#define VK_OEM_PLUS 0xBB
#endif
#ifndef VK_OEM_COMMA
#define VK_OEM_COMMA 0xBC
#endif
#ifndef VK_OEM_MINUS
#define VK_OEM_MINUS 0xBD
#endif
#ifndef VK_OEM_PERIOD
#define VK_OEM_PERIOD 0xBE
#endif
// //
// keyboard definitions: // keyboard definitions:
// //

2
Sources/Plasma/NucleusLib/pnInputCore/plKeyMap.h

@ -208,7 +208,7 @@ class plKeyMap : public plInputMap
const plKeyBinding &GetBinding( UInt32 i ) const { return *fBindings[ i ]; } const plKeyBinding &GetBinding( UInt32 i ) const { return *fBindings[ i ]; }
void HandleAutoDualBinding( plKeyDef key1, plKeyDef key2 ); void HandleAutoDualBinding( plKeyDef key1, plKeyDef key2 );
static char *ConvertVKeyToChar( UInt32 vk ); static const char* ConvertVKeyToChar( UInt32 vk );
static plKeyDef ConvertCharToVKey( const char *c ); static plKeyDef ConvertCharToVKey( const char *c );
static Win32keyConvert fKeyConversionEnglish[]; static Win32keyConvert fKeyConversionEnglish[];

2
Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbAllIncludes.h

@ -35,7 +35,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnProduct/pnProduct.h" #include "pnProduct/pnProduct.h"
#include "pnNbConst.h" #include "../pnNbConst.h"
#include "pnNbError.h" #include "pnNbError.h"
#include "pnNbKeys.h" #include "pnNbKeys.h"
#include "pnNbProtocol.h" #include "pnNbProtocol.h"

4
Sources/Plasma/NucleusLib/pnNetBase/Private/pnNbError.h

@ -103,10 +103,10 @@ enum ENetError {
kNumNetErrors, kNumNetErrors,
// Net messages require ENetError to be sizeof(dword) // Net messages require ENetError to be sizeof(dword)
kNetErrorForceDword = (dword) -1 kNetErrorForceDword = (dword)(-1)
}; };
COMPILER_ASSERT_HEADER(pnNbError, sizeof(ENetError) == sizeof(dword)); //COMPILER_ASSERT_HEADER(pnNbError, sizeof(ENetError) == sizeof(dword));
#define IS_NET_ERROR(a) (((int)(a)) > kNetSuccess) #define IS_NET_ERROR(a) (((int)(a)) > kNetSuccess)
#define IS_NET_SUCCESS(a) (((int)(a)) == kNetSuccess) #define IS_NET_SUCCESS(a) (((int)(a)) == kNetSuccess)

2
Sources/Plasma/NucleusLib/pnNetBase/pnNbConst.h

@ -90,7 +90,7 @@ const unsigned kBillingTypeGameTap = 1 << 1;
struct AccountRoleInfo { struct AccountRoleInfo {
unsigned Role; unsigned Role;
char* Descriptor; const char* Descriptor;
}; };
// Account role flags // Account role flags

2
Sources/Plasma/NucleusLib/pnNetCommon/plNetSharedState.cpp

@ -28,7 +28,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plGenericVar.h" #include "plGenericVar.h"
#include "pnMessage/plMessage.h" #include "pnMessage/plMessage.h"
plNetSharedState::plNetSharedState(char* name) : fServerMayDelete(false) plNetSharedState::plNetSharedState(const char* name) : fServerMayDelete(false)
{ {
SetName(name); SetName(name);
} }

2
Sources/Plasma/NucleusLib/pnNetCommon/plNetSharedState.h

@ -44,7 +44,7 @@ protected:
bool fServerMayDelete; // ok to delete (don't save) since this state is equivalent to the default state bool fServerMayDelete; // ok to delete (don't save) since this state is equivalent to the default state
public: public:
plNetSharedState(char* name=nil); plNetSharedState(const char* name=nil);
virtual ~plNetSharedState(); virtual ~plNetSharedState();
virtual void Copy(plNetSharedState* ss); virtual void Copy(plNetSharedState* ss);

2
Sources/Plasma/NucleusLib/pnNetCommon/plSynchedObject.cpp

@ -514,7 +514,7 @@ plSynchedObject::SDLStateList::const_iterator plSynchedObject::IFindInSDLStateLi
SDLStateList::const_iterator it = list.begin(); SDLStateList::const_iterator it = list.begin();
for(; it != list.end(); it++) for(; it != list.end(); it++)
if (!_stricmp((*it).c_str(), sdlName)) if (!stricmp((*it).c_str(), sdlName))
return it; return it;
return it; // .end(), false return it; // .end(), false

123
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtHash.h

@ -63,6 +63,13 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define HASHTABLEDECLSIZE(object,key,link,size) THashTableDecl<object, key, offsetof(object,link), size > #define HASHTABLEDECLSIZE(object,key,link,size) THashTableDecl<object, key, offsetof(object,link), size >
#if defined(_MSC_VER)
#define forceinline __forceinline
#else
#define forceinline inline
#endif
/**************************************************************************** /****************************************************************************
* *
* Forward declarations * Forward declarations
@ -76,6 +83,64 @@ template<class T>
class TBaseHashTable; class TBaseHashTable;
/****************************************************************************
*
* CHashValue
*
***/
class CHashValue {
private:
static const dword s_hashTable[];
dword m_result;
inline void Construct () { m_result = 0x325d1eae; }
public:
static dword LookupHashBits (unsigned value) { ASSERT(value < 0x100); return s_hashTable[value]; }
inline CHashValue () { Construct() ; }
inline CHashValue (const CHashValue & source) { m_result = source.m_result; }
inline CHashValue (const void * data, unsigned bytes) { Construct(); Hash(data, bytes); }
inline CHashValue & operator= (const CHashValue & source) { m_result = source.m_result; return *this; }
inline bool operator== (const CHashValue & source) const { return (m_result == source.m_result); }
inline dword GetHash () const { return m_result; }
forceinline void Hash (const void * data, unsigned bytes);
forceinline void Hash8 (unsigned data);
forceinline void Hash16 (unsigned data);
forceinline void Hash32 (unsigned data);
};
//===========================================================================
void CHashValue::Hash (const void * data, unsigned bytes) {
for (const byte * curr = (const byte *)data, * term = curr + bytes; curr != term; ++curr)
Hash8(*curr);
}
//===========================================================================
void CHashValue::Hash8 (unsigned data) {
m_result += s_hashTable[m_result >> 24] ^ (m_result >> 6) ^ s_hashTable[data & 0xff];
}
//===========================================================================
void CHashValue::Hash16 (unsigned data) {
Hash8(data);
Hash8(data >> 8);
}
//===========================================================================
void CHashValue::Hash32 (unsigned data) {
Hash8(data);
Hash8(data >> 8);
Hash8(data >> 16);
Hash8(data >> 24);
}
/**************************************************************************** /****************************************************************************
* *
* THashLink * THashLink
@ -661,61 +726,3 @@ typedef THashKeyStr< wchar, THashKeyStrCmp<wchar> > CHashKeyStr;
typedef THashKeyStr< wchar, THashKeyStrCmpI<wchar> > CHashKeyStrI; typedef THashKeyStr< wchar, THashKeyStrCmpI<wchar> > CHashKeyStrI;
typedef THashKeyStr< char, THashKeyStrCmp<char> > CHashKeyStrChar; typedef THashKeyStr< char, THashKeyStrCmp<char> > CHashKeyStrChar;
typedef THashKeyStr< char, THashKeyStrCmpI<char> > CHashKeyStrCharI; typedef THashKeyStr< char, THashKeyStrCmpI<char> > CHashKeyStrCharI;
/****************************************************************************
*
* CHashValue
*
***/
class CHashValue {
private:
static const dword s_hashTable[];
dword m_result;
inline void Construct () { m_result = 0x325d1eae; }
public:
static dword LookupHashBits (unsigned value) { ASSERT(value < 0x100); return s_hashTable[value]; }
inline CHashValue () { Construct() ; }
inline CHashValue (const CHashValue & source) { m_result = source.m_result; }
inline CHashValue (const void * data, unsigned bytes) { Construct(); Hash(data, bytes); }
inline CHashValue & operator= (const CHashValue & source) { m_result = source.m_result; return *this; }
inline bool operator== (const CHashValue & source) const { return (m_result == source.m_result); }
inline dword GetHash () const { return m_result; }
__forceinline void Hash (const void * data, unsigned bytes);
__forceinline void Hash8 (unsigned data);
__forceinline void Hash16 (unsigned data);
__forceinline void Hash32 (unsigned data);
};
//===========================================================================
void CHashValue::Hash (const void * data, unsigned bytes) {
for (const byte * curr = (const byte *)data, * term = curr + bytes; curr != term; ++curr)
Hash8(*curr);
}
//===========================================================================
void CHashValue::Hash8 (unsigned data) {
m_result += s_hashTable[m_result >> 24] ^ (m_result >> 6) ^ s_hashTable[data & 0xff];
}
//===========================================================================
void CHashValue::Hash16 (unsigned data) {
Hash8(data);
Hash8(data >> 8);
}
//===========================================================================
void CHashValue::Hash32 (unsigned data) {
Hash8(data);
Hash8(data >> 8);
Hash8(data >> 16);
Hash8(data >> 24);
}

2
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtMisc.h

@ -79,7 +79,7 @@ void MachineGetName (wchar * computerName, unsigned length = 32);
***/ ***/
// used to dump the internal state of a module // used to dump the internal state of a module
typedef void (__cdecl * FStateDump)( typedef void (CDECL * FStateDump)(
void * param, void * param,
const wchar fmt[], const wchar fmt[],
... ...

43
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRef.h

@ -35,19 +35,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTREF_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTREF_H
/*****************************************************************************
*
* Debug macros
*
***/
#ifdef REFCOUNT_DEBUGGING
#define REFTRACE DEBUG_MSG
#else
#define REFTRACE NULL_STMT
#endif
/**************************************************************************** /****************************************************************************
* *
* AtomicRef * AtomicRef
@ -78,7 +65,9 @@ public:
ASSERT(!zeroed); ASSERT(!zeroed);
#endif #endif
long prev = AtomicAdd(&m_ref, 1); long prev = AtomicAdd(&m_ref, 1);
REFTRACE("Inc %p: %u", this, prev+1); #ifdef REFCOUNT_DEBUGGING
DEBUG_MSG("Inc %p: %u", this, prev+1);
#endif
return prev+1; return prev+1;
} }
inline long IncRef (const char tag[]) { inline long IncRef (const char tag[]) {
@ -86,7 +75,9 @@ public:
ASSERT(!zeroed); ASSERT(!zeroed);
#endif #endif
long prev = AtomicAdd(&m_ref, 1); long prev = AtomicAdd(&m_ref, 1);
REFTRACE("Inc %p %s: %u", this, tag, prev+1); #ifdef REFCOUNT_DEBUGGING
DEBUG_MSG("Inc %p %s: %u", this, tag, prev+1);
#endif
return prev+1; return prev+1;
} }
inline long IncRef (unsigned n) { inline long IncRef (unsigned n) {
@ -94,7 +85,9 @@ public:
ASSERT(!zeroed); ASSERT(!zeroed);
#endif #endif
long prev = AtomicAdd(&m_ref, n); long prev = AtomicAdd(&m_ref, n);
REFTRACE("Inc %p: %u", this, prev+n); #ifdef REFCOUNT_DEBUGGING
DEBUG_MSG("Inc %p: %u", this, prev+n);
#endif
return prev+n; return prev+n;
} }
inline long IncRef (unsigned n, const char tag[]) { inline long IncRef (unsigned n, const char tag[]) {
@ -102,7 +95,9 @@ public:
ASSERT(!zeroed); ASSERT(!zeroed);
#endif #endif
long prev = AtomicAdd(&m_ref, n); long prev = AtomicAdd(&m_ref, n);
REFTRACE("Inc %p %s: %u", this, tag, prev+n); #ifdef REFCOUNT_DEBUGGING
DEBUG_MSG("Inc %p %s: %u", this, tag, prev+n);
#endif
return prev+n; return prev+n;
} }
@ -117,7 +112,9 @@ public:
#endif #endif
OnZeroRef(); OnZeroRef();
} }
REFTRACE("Dec %p: %u", this, prev-1); #ifdef REFCOUNT_DEBUGGING
DEBUG_MSG("Dec %p: %u", this, prev-1);
#endif
return prev-1; return prev-1;
} }
inline long DecRef (const char tag[]) { inline long DecRef (const char tag[]) {
@ -131,7 +128,9 @@ public:
#endif #endif
OnZeroRef(); OnZeroRef();
} }
REFTRACE("Dec %p %s: %u", this, tag, prev-1); #ifdef REFCOUNT_DEBUGGING
DEBUG_MSG("Dec %p %s: %u", this, tag, prev-1);
#endif
return prev-1; return prev-1;
} }
@ -142,8 +141,10 @@ public:
#ifdef HS_DEBUGGING #ifdef HS_DEBUGGING
ASSERT(!zeroed); ASSERT(!zeroed);
#endif #endif
REFTRACE("Inc %p %s: (xfer)", this, newTag); #ifdef REFCOUNT_DEBUGGING
REFTRACE("Dec %p %s: (xfer)", this, oldTag); DEBUG_MSG("Inc %p %s: (xfer)", this, newTag);
DEBUG_MSG("Dec %p %s: (xfer)", this, oldTag);
#endif
} }
inline unsigned GetRefCount () { inline unsigned GetRefCount () {

2
Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.cpp

@ -147,7 +147,7 @@ char *plAgePage::GetAsString( void ) const
// static // static
char plAgeDescription::kAgeDescPath[]={"dat"PATH_SEPARATOR_STR}; char plAgeDescription::kAgeDescPath[]={"dat"PATH_SEPARATOR_STR};
char *plAgeDescription::fCommonPages[] = { "Textures", "BuiltIn" }; const char* plAgeDescription::fCommonPages[] = { "Textures", "BuiltIn" };
// Also gotta init the separators for our helper reading function // Also gotta init the separators for our helper reading function
plAgeDescription::plAgeDescription() : plInitSectionTokenReader() plAgeDescription::plAgeDescription() : plInitSectionTokenReader()

2
Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.h

@ -96,7 +96,7 @@ private:
Int32 fSeqPrefix; Int32 fSeqPrefix;
UInt32 fReleaseVersion; // 0 for pre-release, 1+ for actual released ages UInt32 fReleaseVersion; // 0 for pre-release, 1+ for actual released ages
static char *fCommonPages[]; static const char* fCommonPages[];
void IInit( void ); void IInit( void );
void IDeInit( void ); void IDeInit( void );

2
Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.cpp

@ -100,7 +100,7 @@ bool plManifestFile::LocalExists()
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
char* plManifest::fTimeFormat = "%m/%d/%y %H:%M:%S"; const char* plManifest::fTimeFormat = "%m/%d/%y %H:%M:%S";
static const UInt32 kLatestFormatVersion = 5; static const UInt32 kLatestFormatVersion = 5;
plManifest::plManifest() plManifest::plManifest()

2
Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.h

@ -98,7 +98,7 @@ protected:
void IReset(); void IReset();
public: public:
static char* fTimeFormat; // Standard string for the printed version of our timestamps static const char* fTimeFormat; // Standard string for the printed version of our timestamps
void SetFormatVersion(UInt32 v) { fFormatVersion = v; } void SetFormatVersion(UInt32 v) { fFormatVersion = v; }
void AddFile(plManifestFile* file); void AddFile(plManifestFile* file);

2
Sources/Plasma/PubUtilLib/plAvatar/plClothingLayout.h

@ -61,7 +61,7 @@ public:
UInt32 fWidth; UInt32 fWidth;
UInt32 fHeight; UInt32 fHeight;
plClothingElement(char *name, UInt32 xPos, UInt32 yPos, UInt32 width, UInt32 height) plClothingElement(const char *name, UInt32 xPos, UInt32 yPos, UInt32 width, UInt32 height)
{ {
fName = hsStrcpy(name); fName = hsStrcpy(name);
fXPos = xPos; fXPos = xPos;

1
Sources/Plasma/PubUtilLib/plEncryption/plChecksum.cpp

@ -26,6 +26,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plChecksum.h" #include "plChecksum.h"
#include "hsStream.h" #include "hsStream.h"
#include <cstring>
plChecksum::plChecksum(unsigned int bufsize, const char* buffer) plChecksum::plChecksum(unsigned int bufsize, const char* buffer)
{ {

2
Sources/Plasma/PubUtilLib/plFile/hsFiles.cpp

@ -133,7 +133,7 @@ hsBool hsFolderIterator::NextFileSuffix(const char suffix[])
{ {
while (this->NextFile()) while (this->NextFile())
{ const char* fileSuffix = ::strrchr(this->GetFileName(), '.'); { const char* fileSuffix = ::strrchr(this->GetFileName(), '.');
if (fileSuffix != nil && ::_stricmp(fileSuffix, suffix) == 0) if (fileSuffix != nil && stricmp(fileSuffix, suffix) == 0)
return true; return true;
} }
return false; return false;

4
Sources/Plasma/PubUtilLib/plFile/plEncryptedStream.cpp

@ -114,7 +114,7 @@ hsBool plEncryptedStream::Open(const wchar* name, const wchar* mode)
{ {
if (wcscmp(mode, L"rb") == 0) if (wcscmp(mode, L"rb") == 0)
{ {
fRef = _wfopen(name, mode); fRef = hsWFopen(name, mode);
fPosition = 0; fPosition = 0;
if (!fRef) if (!fRef)
@ -515,7 +515,7 @@ bool plEncryptedStream::IsEncryptedFile(const char* fileName)
bool plEncryptedStream::IsEncryptedFile(const wchar* fileName) bool plEncryptedStream::IsEncryptedFile(const wchar* fileName)
{ {
FILE* fp = _wfopen(fileName, L"rb"); FILE* fp = hsWFopen(fileName, L"rb");
if (!fp) if (!fp)
return false; return false;

2
Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp

@ -206,7 +206,7 @@ bool plFileUtils::FileMove(const wchar* existingFile, const wchar* newFile)
bool plFileUtils::FileExists(const wchar* file) bool plFileUtils::FileExists(const wchar* file)
{ {
FILE* fp = _wfopen(file, L"rb"); FILE* fp = hsWFopen(file, L"rb");
bool retVal = (fp != nil); bool retVal = (fp != nil);
if (fp) if (fp)
fclose(fp); fclose(fp);

2
Sources/Plasma/PubUtilLib/plGImage/plFontCache.cpp

@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnKeyedObject/plUoid.h" #include "pnKeyedObject/plUoid.h"
char *plFontCache::kCustFontExtension = ".prf"; const char* plFontCache::kCustFontExtension = ".prf";
plFontCache *plFontCache::fInstance = nil; plFontCache *plFontCache::fInstance = nil;

2
Sources/Plasma/PubUtilLib/plGImage/plFontCache.h

@ -83,7 +83,7 @@ class plFontCache : public hsKeyedObject
void LoadCustomFonts( const char *dir ); void LoadCustomFonts( const char *dir );
// Our custom font extension // Our custom font extension
static char *kCustFontExtension; static const char* kCustFontExtension;
}; };

2
Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.cpp

@ -55,7 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <wingdi.h> #include <wingdi.h>
char *plWinFontCache::kCustFontExtension = ".prf"; const char* plWinFontCache::kCustFontExtension = ".prf";
plWinFontCache::plWinFontCache() plWinFontCache::plWinFontCache()

2
Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.h

@ -107,7 +107,7 @@ class plWinFontCache
void LoadCustomFonts( const char *dir ); void LoadCustomFonts( const char *dir );
// Our custom font extension // Our custom font extension
static char *kCustFontExtension; static const char* kCustFontExtension;
}; };

24
Sources/Plasma/PubUtilLib/plInputCore/plAvatarInputInterface.h

@ -66,7 +66,7 @@ class plAvatarInputMap
plAvatarInputMap(); plAvatarInputMap();
virtual ~plAvatarInputMap(); virtual ~plAvatarInputMap();
virtual char *GetName() = 0; virtual const char *GetName() = 0;
virtual hsBool IsBasic() { return false; } virtual hsBool IsBasic() { return false; }
plMouseMap *fMouseMap; plMouseMap *fMouseMap;
@ -78,7 +78,7 @@ class plSuspendedMovementMap : public plAvatarInputMap
{ {
public: public:
plSuspendedMovementMap(); plSuspendedMovementMap();
virtual char *GetName() { return "Suspended Movement"; } virtual const char *GetName() { return "Suspended Movement"; }
}; };
// The above, plus movement // The above, plus movement
@ -86,7 +86,7 @@ class plBasicControlMap : public plSuspendedMovementMap
{ {
public: public:
plBasicControlMap(); plBasicControlMap();
virtual char *GetName() { return "Basic"; } virtual const char *GetName() { return "Basic"; }
virtual hsBool IsBasic() { return true; } virtual hsBool IsBasic() { return true; }
}; };
@ -95,28 +95,28 @@ class plBasicThirdPersonControlMap : public plBasicControlMap
{ {
public: public:
plBasicThirdPersonControlMap(); plBasicThirdPersonControlMap();
virtual char *GetName() { return "Basic Third Person"; } virtual const char *GetName() { return "Basic Third Person"; }
}; };
class plLadderControlMap : public plSuspendedMovementMap class plLadderControlMap : public plSuspendedMovementMap
{ {
public: public:
plLadderControlMap(); plLadderControlMap();
virtual char *GetName() { return "LadderClimb"; } virtual const char *GetName() { return "LadderClimb"; }
}; };
class plLadderMountMap : public plSuspendedMovementMap class plLadderMountMap : public plSuspendedMovementMap
{ {
public: public:
plLadderMountMap(); plLadderMountMap();
virtual char *GetName() { return "Ladder Mount"; } virtual const char *GetName() { return "Ladder Mount"; }
}; };
class plLadderDismountMap : public plSuspendedMovementMap class plLadderDismountMap : public plSuspendedMovementMap
{ {
public: public:
plLadderDismountMap(); plLadderDismountMap();
virtual char *GetName() { return "Ladder Dismount"; } virtual const char *GetName() { return "Ladder Dismount"; }
}; };
@ -124,7 +124,7 @@ class plBasicFirstPersonControlMap : public plBasicControlMap
{ {
public: public:
plBasicFirstPersonControlMap(); plBasicFirstPersonControlMap();
virtual char *GetName() { return "Basic First Person"; } virtual const char *GetName() { return "Basic First Person"; }
}; };
// Mouse walk mode // Mouse walk mode
@ -139,21 +139,21 @@ class pl3rdWalkForwardMap : public pl3rdWalkMap
{ {
public: public:
pl3rdWalkForwardMap(); pl3rdWalkForwardMap();
virtual char *GetName() { return "Walking Forward"; } virtual const char *GetName() { return "Walking Forward"; }
}; };
class pl3rdWalkBackwardMap : public pl3rdWalkMap class pl3rdWalkBackwardMap : public pl3rdWalkMap
{ {
public: public:
pl3rdWalkBackwardMap(); pl3rdWalkBackwardMap();
virtual char *GetName() { return "Walking Backward"; } virtual const char *GetName() { return "Walking Backward"; }
}; };
class pl3rdWalkBackwardLBMap : public pl3rdWalkMap class pl3rdWalkBackwardLBMap : public pl3rdWalkMap
{ {
public: public:
pl3rdWalkBackwardLBMap(); pl3rdWalkBackwardLBMap();
virtual char *GetName() { return "Walking Backward (LB)"; } virtual const char *GetName() { return "Walking Backward (LB)"; }
}; };
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
@ -215,7 +215,7 @@ class plAvatarInputInterface : public plInputInterface
virtual UInt32 GetPriorityLevel( void ) const { return kAvatarInputPriority; } virtual UInt32 GetPriorityLevel( void ) const { return kAvatarInputPriority; }
virtual UInt32 GetCurrentCursorID( void ) const { return fCurrentCursor; } virtual UInt32 GetCurrentCursorID( void ) const { return fCurrentCursor; }
virtual hsScalar GetCurrentCursorOpacity( void ) const { return fCursorOpacity; } virtual hsScalar GetCurrentCursorOpacity( void ) const { return fCursorOpacity; }
char* GetInputMapName() { return fInputMap ? fInputMap->GetName() : ""; } const char* GetInputMapName() { return fInputMap ? fInputMap->GetName() : ""; }
virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg ); virtual hsBool InterpretInputEvent( plInputEventMsg *pMsg );
virtual void MissedInputEvent( plInputEventMsg *pMsg ); virtual void MissedInputEvent( plInputEventMsg *pMsg );

2
Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h

@ -32,10 +32,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsWindows.h" #include "hsWindows.h"
//#include "pnInputCore/plControlDefinition.h" //#include "pnInputCore/plControlDefinition.h"
#include "pnInputCore/plOSMsg.h" #include "pnInputCore/plOSMsg.h"
#include "pnInputCore/plKeyDef.h"
#include "hsBitVector.h" #include "hsBitVector.h"
#include "hsTemplates.h" #include "hsTemplates.h"
class plMessage; class plMessage;
enum plKeyDef;
struct plMouseInfo; struct plMouseInfo;
class plPipeline; class plPipeline;

2
Sources/Plasma/PubUtilLib/plInputCore/plInputInterfaceMgr.cpp

@ -861,7 +861,7 @@ const char *plInputInterfaceMgr::IKeyComboToString( const plKeyCombo &combo )
sprintf( str, "(unmapped)" ); sprintf( str, "(unmapped)" );
else else
{ {
char *c = plKeyMap::ConvertVKeyToChar( combo.fKey ); const char *c = plKeyMap::ConvertVKeyToChar( combo.fKey );
if( c != nil ) if( c != nil )
strncpy( str, c, sizeof( str ) ); strncpy( str, c, sizeof( str ) );
else else

4
Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp

@ -692,11 +692,11 @@ bool plNetServerSessionInfo::IsEqualTo(const plNetServerSessionInfo * other) con
if (match && IsFlagSet(kHasServerGuid) && other->IsFlagSet(kHasServerGuid)) if (match && IsFlagSet(kHasServerGuid) && other->IsFlagSet(kHasServerGuid))
match = match && fServerGuid.IsEqualTo(other->GetServerGuid()); match = match && fServerGuid.IsEqualTo(other->GetServerGuid());
if (match && IsFlagSet(kHasServerName) && other->IsFlagSet(kHasServerName)) if (match && IsFlagSet(kHasServerName) && other->IsFlagSet(kHasServerName))
match = match && (_stricmp(fServerName.c_str(),other->fServerName.c_str())==0); match = match && (stricmp(fServerName.c_str(),other->fServerName.c_str())==0);
if (match && IsFlagSet(kHasServerType) && other->IsFlagSet(kHasServerType)) if (match && IsFlagSet(kHasServerType) && other->IsFlagSet(kHasServerType))
match = match && fServerType==other->fServerType; match = match && fServerType==other->fServerType;
if (match && IsFlagSet(kHasServerAddr) && other->IsFlagSet(kHasServerAddr)) if (match && IsFlagSet(kHasServerAddr) && other->IsFlagSet(kHasServerAddr))
match = match && (_stricmp(fServerAddr.c_str(),other->fServerAddr.c_str())==0); match = match && (stricmp(fServerAddr.c_str(),other->fServerAddr.c_str())==0);
if (match && IsFlagSet(kHasServerPort) && other->IsFlagSet(kHasServerPort)) if (match && IsFlagSet(kHasServerPort) && other->IsFlagSet(kHasServerPort))
match = match && fServerPort==other->fServerPort; match = match && fServerPort==other->fServerPort;
return match; return match;

2
Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h

@ -232,7 +232,7 @@ public:
// debug // debug
virtual std::string AsStdString() const virtual std::string AsStdString() const
{ {
char * delim = ""; const char* delim = "";
std::stringstream ss; std::stringstream ss;
if ( GetHasPlayerID() ) if ( GetHasPlayerID() )

2
Sources/Plasma/PubUtilLib/plPipeline/hsG3DDeviceSelector.cpp

@ -229,7 +229,7 @@ void hsG3DDeviceRecord::SetDeviceDesc( const char *s )
const char* hsG3DDeviceRecord::GetG3DDeviceTypeName() const const char* hsG3DDeviceRecord::GetG3DDeviceTypeName() const
{ {
static char* deviceNames[hsG3DDeviceSelector::kNumDevTypes] = { static const char* deviceNames[hsG3DDeviceSelector::kNumDevTypes] = {
"Unknown", "Unknown",
"Glide", "Glide",
"Direct3D", "Direct3D",

2
Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h

@ -121,7 +121,7 @@ class plDebugText
void SetManager( plDebugTextManager *m ) { fManager = m; } void SetManager( plDebugTextManager *m ) { fManager = m; }
void SetFont( char *face, UInt16 size ) { hsStrncpy( fFontFace, face, sizeof( fFontFace ) ); fFontSize = size; } void SetFont(const char *face, UInt16 size ) { hsStrncpy( fFontFace, face, sizeof( fFontFace ) ); fFontSize = size; }
const char *GetFontFace( void ) { return fFontFace; } const char *GetFontFace( void ) { return fFontFace; }
const UInt16 GetFontSize( void ) { return fFontSize; } const UInt16 GetFontSize( void ) { return fFontSize; }
UInt16 GetFontHeight(); UInt16 GetFontHeight();

2
Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp

@ -88,7 +88,7 @@ hsBool NameMatches(const char* obName, const char* pKName, hsBool subString)
if (!subString) if (!subString)
{ {
if (!_stricmp(o, p)) if (!stricmp(o, p))
return true; // FOUND IT!!!!!!!!!!!!!!!!!!! return true; // FOUND IT!!!!!!!!!!!!!!!!!!!
} }
else else

4
Sources/Plasma/PubUtilLib/plResMgr/plLocalization.cpp

@ -30,7 +30,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
plLocalization::Language plLocalization::fLanguage = plLocalization::kEnglish; plLocalization::Language plLocalization::fLanguage = plLocalization::kEnglish;
char* plLocalization::fLangTags[] = const char* plLocalization::fLangTags[] =
{ {
"_eng", // kEnglish "_eng", // kEnglish
"_fre", // kFrench "_fre", // kFrench
@ -41,7 +41,7 @@ char* plLocalization::fLangTags[] =
}; };
const int kLangTagLen = 4; const int kLangTagLen = 4;
char* plLocalization::fLangNames[] = const char* plLocalization::fLangNames[] =
{ {
"English", // kEnglish "English", // kEnglish
"French", // kFrench "French", // kFrench

6
Sources/Plasma/PubUtilLib/plResMgr/plLocalization.h

@ -59,8 +59,8 @@ public:
protected: protected:
static Language fLanguage; static Language fLanguage;
static char* fLangTags[kNumLanguages]; static const char* fLangTags[kNumLanguages];
static char* fLangNames[kNumLanguages]; static const char* fLangNames[kNumLanguages];
static bool fUsesUnicode[kNumLanguages]; static bool fUsesUnicode[kNumLanguages];
static encodingTypes fUnicodeEncoding[kNumLanguages]; static encodingTypes fUnicodeEncoding[kNumLanguages];
@ -73,7 +73,7 @@ public:
static void SetLanguage(Language lang) { fLanguage = lang; } static void SetLanguage(Language lang) { fLanguage = lang; }
static Language GetLanguage() { return fLanguage; } static Language GetLanguage() { return fLanguage; }
static char* GetLanguageName(Language lang) { return fLangNames[lang]; } static const char* GetLanguageName(Language lang) { return fLangNames[lang]; }
static hsBool UsingUnicode() { return fUsesUnicode[fLanguage]; } static hsBool UsingUnicode() { return fUsesUnicode[fLanguage]; }
static encodingTypes UnicodeEncoding() { return fUnicodeEncoding[fLanguage]; } static encodingTypes UnicodeEncoding() { return fUnicodeEncoding[fLanguage]; }

3
Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp

@ -298,7 +298,8 @@ hsBool plResManager::ReadObject(plKeyImp* key)
// it will just inc/dec the open/close count during its read, and not actually // it will just inc/dec the open/close count during its read, and not actually
// close the stream, so we don't lose our place, lose our file handle, and thrash. // close the stream, so we don't lose our place, lose our file handle, and thrash.
kResMgrLog(4, ILog(4, " ...Opening page data stream for location 0x%x...", key->GetUoid().GetLocation())); char locstr[64];
kResMgrLog(4, ILog(4, " ...Opening page data stream for location %s...", key->GetUoid().GetLocation().StringIze(locstr)));
plRegistryPageNode *pageNode = FindPage(key->GetUoid().GetLocation()); plRegistryPageNode *pageNode = FindPage(key->GetUoid().GetLocation());
if (!pageNode) if (!pageNode)
{ {

1
Sources/Plasma/PubUtilLib/plResMgr/plResManager.h

@ -30,6 +30,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <set> #include <set>
#include <map> #include <map>
#include <vector> #include <vector>
#include <string>
class plRegistryPageNode; class plRegistryPageNode;
class plRegistryKeyIterator; class plRegistryKeyIterator;

1
Sources/Plasma/PubUtilLib/plResMgr/plVersion.cpp

@ -26,6 +26,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plVersion.h" #include "plVersion.h"
#include "pnFactory/plFactory.h" #include "pnFactory/plFactory.h"
#include <vector> #include <vector>
#include <cstring>
#include "plCreatableIndex.h" #include "plCreatableIndex.h"
#define ChangedCreatable(ver, creatable) if (minorVersion == ver) creatables.push_back(CLASS_INDEX_SCOPED(creatable)); #define ChangedCreatable(ver, creatable) if (minorVersion == ver) creatables.push_back(CLASS_INDEX_SCOPED(creatable));

2
Sources/Plasma/PubUtilLib/plSDL/plSDLMgr.cpp

@ -100,7 +100,7 @@ plStateDescriptor* plSDLMgr::FindDescriptor(const char* name, int version, const
int highestFound = -1; int highestFound = -1;
for(it=(*dl).begin(); it!= (*dl).end(); it++) for(it=(*dl).begin(); it!= (*dl).end(); it++)
{ {
if (!_stricmp((*it)->GetName(), name) ) if (!stricmp((*it)->GetName(), name) )
{ {
if ( (*it)->GetVersion()==version ) if ( (*it)->GetVersion()==version )
{ {

14
Sources/Plasma/PubUtilLib/plScene/plVisMgr.cpp

@ -60,13 +60,13 @@ void plVisMgr::Write(hsStream* s, hsResMgr* mgr)
hsKeyedObject::Write(s, mgr); hsKeyedObject::Write(s, mgr);
} }
void plVisMgr::Register(plVisRegion* reg, hsBool not) void plVisMgr::Register(plVisRegion* reg, hsBool bnot)
{ {
// This should happen pretty infrequently, or // This should happen pretty infrequently, or
// I wouldn't be doing it so cloth-headed-ly. // I wouldn't be doing it so cloth-headed-ly.
hsTArray<plVisRegion*>& regions = not ? fNotRegions : fRegions; hsTArray<plVisRegion*>& regions = bnot ? fNotRegions : fRegions;
hsBitVector& indices = not ? fIdxNot : fIdxSet; hsBitVector& indices = bnot ? fIdxNot : fIdxSet;
int& maxIdx = not ? fMaxNot : fMaxSet; int& maxIdx = bnot ? fMaxNot : fMaxSet;
int i; int i;
for( i = kNumReserved; ; i++ ) for( i = kNumReserved; ; i++ )
{ {
@ -84,14 +84,14 @@ void plVisMgr::Register(plVisRegion* reg, hsBool not)
hsAssert(false, "Infinite bitvector has all bits set?"); hsAssert(false, "Infinite bitvector has all bits set?");
} }
void plVisMgr::UnRegister(plVisRegion* reg, hsBool not) void plVisMgr::UnRegister(plVisRegion* reg, hsBool bnot)
{ {
// Mark our index for recycling // Mark our index for recycling
hsBitVector& indices= not ? fIdxNot : fIdxSet; hsBitVector& indices= bnot ? fIdxNot : fIdxSet;
indices.ClearBit(reg->GetIndex()); indices.ClearBit(reg->GetIndex());
// Nuke the region from our list. // Nuke the region from our list.
hsTArray<plVisRegion*>& regions = not ? fNotRegions : fRegions; hsTArray<plVisRegion*>& regions = bnot ? fNotRegions : fRegions;
int idx = regions.Find(reg); int idx = regions.Find(reg);
if( regions.kMissingIndex != idx ) if( regions.kMissingIndex != idx )
regions.Remove(idx); regions.Remove(idx);

4
Sources/Plasma/PubUtilLib/plScene/plVisMgr.h

@ -82,8 +82,8 @@ public:
virtual void Read(hsStream* stream, hsResMgr* mgr); virtual void Read(hsStream* stream, hsResMgr* mgr);
virtual void Write(hsStream* stream, hsResMgr* mgr); virtual void Write(hsStream* stream, hsResMgr* mgr);
void Register(plVisRegion* reg, hsBool not); void Register(plVisRegion* reg, hsBool bnot);
void UnRegister(plVisRegion* reg, hsBool not); void UnRegister(plVisRegion* reg, hsBool bnot);
void Eval(const hsPoint3& pos); void Eval(const hsPoint3& pos);

2
Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp

@ -497,7 +497,7 @@ namespace pvt_strptime
#define match_char(ch1, ch2) if (ch1 != ch2) return NULL #define match_char(ch1, ch2) if (ch1 != ch2) return NULL
#define match_string(cs1, s2) \ #define match_string(cs1, s2) \
(_strnicmp((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1)) (strnicmp((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
#define get_number(from, to, n) \ #define get_number(from, to, n) \
do { \ do { \
int __n = n; \ int __n = n; \

Loading…
Cancel
Save