diff --git a/Sources/Plasma/Apps/plClient/plClient.cpp b/Sources/Plasma/Apps/plClient/plClient.cpp index 77173c1c..539ca629 100644 --- a/Sources/Plasma/Apps/plClient/plClient.cpp +++ b/Sources/Plasma/Apps/plClient/plClient.cpp @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsTimer.h" #include "plPipeline/hsG3DDeviceSelector.h" #include "plFile/plEncryptedStream.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" #include "plInputCore/plInputManager.h" #include "plInputCore/plInputInterfaceMgr.h" #include "plInputCore/plInputDevice.h" @@ -83,7 +83,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pfConsole/pfConsoleDirSrc.h" #include "plScene/plPageTreeMgr.h" #include "plScene/plVisMgr.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "pfKI/pfKI.h" @@ -1286,7 +1286,7 @@ void plClient::IRoomUnloaded(plSceneNode* node) void plClient::IReadKeyedObjCallback(plKey key) { - fInstance->IIncProgress(1, _TEMP_CONVERT_TO_CONST_CHAR(key->GetName())); + fInstance->IIncProgress(1, key->GetName().c_str()); } //============================================================================ diff --git a/Sources/Plasma/Apps/plClient/winmain.cpp b/Sources/Plasma/Apps/plClient/winmain.cpp index 36ef2cf6..4d0780d3 100644 --- a/Sources/Plasma/Apps/plClient/winmain.cpp +++ b/Sources/Plasma/Apps/plClient/winmain.cpp @@ -71,7 +71,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plStatusLog/plStatusLog.h" #include "pnProduct/pnProduct.h" #include "plNetGameLib/plNetGameLib.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" #include "plPhysX/plSimulationMgr.h" @@ -964,12 +964,12 @@ BOOL CALLBACK UruTOSDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (stream.Open("TOS.txt", "rt")) { uint32_t dataLen = stream.GetSizeLeft(); - char* eulaData = new char[dataLen + 1]; + plStringBuffer eula; + char* eulaData = eula.CreateWritableBuffer(dataLen); memset(eulaData, 0, dataLen + 1); stream.Read(dataLen, eulaData); - plString str = plString::Steal(eulaData); - SetDlgItemTextW(hwndDlg, IDC_URULOGIN_EULATEXT, _TEMP_CONVERT_TO_WCHAR_T(str)); + SetDlgItemTextW(hwndDlg, IDC_URULOGIN_EULATEXT, plString(eula).ToWchar()); } else // no TOS found, go ahead EndDialog(hwndDlg, true); @@ -998,15 +998,15 @@ static void SaveUserPass (LoginDialogParam *pLoginParam, char *password) memset(cryptKey, 0, sizeof(cryptKey)); GetCryptKey(cryptKey, arrsize(cryptKey)); - plString theUser = _TEMP_CONVERT_FROM_LITERAL(pLoginParam->username); - plString thePass = (_TEMP_CONVERT_FROM_LITERAL(password)).Left(kMaxPasswordLength); + plString theUser = pLoginParam->username; + plString thePass = plString(password).Left(kMaxPasswordLength); // if the password field is the fake string then we've already // loaded the namePassHash from the file if (thePass.Compare(FAKE_PASS_STRING) != 0) { wchar_t domain[15]; - PathSplitEmail(_TEMP_CONVERT_TO_WCHAR_T(theUser), nil, 0, domain, arrsize(domain), nil, 0, nil, 0, 0); + PathSplitEmail(theUser.ToWchar(), nil, 0, domain, arrsize(domain), nil, 0, nil, 0, 0); if (StrLen(domain) == 0 || StrCmpI(domain, L"gametap") == 0) { plSHA1Checksum shasum(StrLen(password) * sizeof(password[0]), (uint8_t*)password); @@ -1026,7 +1026,7 @@ static void SaveUserPass (LoginDialogParam *pLoginParam, char *password) } } - NetCommSetAccountUsernamePassword(_TEMP_CONVERT_TO_WCHAR_T(theUser), pLoginParam->namePassHash); + NetCommSetAccountUsernamePassword(theUser.ToWchar(), pLoginParam->namePassHash); if (TGIsCider) NetCommSetAuthTokenAndOS(nil, L"mac"); else @@ -1436,7 +1436,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC if (!eventExists) // if it is missing, assume patcher wasn't launched { - cmdLine << _TEMP_CONVERT_FROM_WCHAR_T(s_patcherExeName); + cmdLine << plString::FromWchar(s_patcherExeName); GetAuthSrvHostnames(&addrs); if(strlen(addrs[0])) diff --git a/Sources/Plasma/Apps/plFileEncrypt/main.cpp b/Sources/Plasma/Apps/plFileEncrypt/main.cpp index 2a52b1b1..b1002da2 100644 --- a/Sources/Plasma/Apps/plFileEncrypt/main.cpp +++ b/Sources/Plasma/Apps/plFileEncrypt/main.cpp @@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "plFile/plEncryptedStream.h" #include "pnProduct/pnProduct.h" diff --git a/Sources/Plasma/Apps/plFileSecure/main.cpp b/Sources/Plasma/Apps/plFileSecure/main.cpp index 4d8172ed..5b8bd6be 100644 --- a/Sources/Plasma/Apps/plFileSecure/main.cpp +++ b/Sources/Plasma/Apps/plFileSecure/main.cpp @@ -39,8 +39,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "plFile/hsFiles.h" -#include "plFile/plFileUtils.h" +#include "hsFiles.h" +#include "plFileUtils.h" #include "plFile/plSecureStream.h" #include "pnProduct/pnProduct.h" @@ -61,15 +61,15 @@ void print_help() { printf("\tplFileSecure ( )|[/generate /default]\n"); printf("\n"); printf(" : The directory and extension of files to secure. Cannot\n"); - printf(" be used with /generate. Uses the %s file in\n", plFileUtils::kKeyFilename); + printf(" be used with /generate. Uses the %s file in\n", plSecureStream::kKeyFilename); printf(" the current directory (or default key if no file exists)\n"); - printf("/generate : Generates a random key and writes it to a %s\n", plFileUtils::kKeyFilename); + printf("/generate : Generates a random key and writes it to a %s\n", plSecureStream::kKeyFilename); printf(" file in the current directory. Cannot be used with\n"); printf(" \n"); - printf("/default : If used with /generate, creates a %s file\n", plFileUtils::kKeyFilename); + printf("/default : If used with /generate, creates a %s file\n", plSecureStream::kKeyFilename); printf(" with the default key. If used with , it\n"); printf(" secures with the default key instead of the\n"); - printf(" %s file's key\n", plFileUtils::kKeyFilename); + printf(" %s file's key\n", plSecureStream::kKeyFilename); printf("\n"); } @@ -103,7 +103,7 @@ void GenerateKey(bool useDefault) } hsUNIXStream out; - out.Open(plFileUtils::kKeyFilename, "wb"); + out.Open(plSecureStream::kKeyFilename, "wb"); out.Write(sizeof(uint32_t) * arrsize(key), (void*)key); out.Close(); } @@ -204,7 +204,7 @@ int main(int argc, char *argv[]) else { uint32_t key[4]; - plFileUtils::GetSecureEncryptionKey(plFileUtils::kKeyFilename, key, arrsize(key)); + plSecureStream::GetSecureEncryptionKey(plSecureStream::kKeyFilename, key, arrsize(key)); SecureFiles(directory, ext, key); } return 0; diff --git a/Sources/Plasma/Apps/plPageInfo/plPageInfo.cpp b/Sources/Plasma/Apps/plPageInfo/plPageInfo.cpp index 0ec17dc2..1337d955 100644 --- a/Sources/Plasma/Apps/plPageInfo/plPageInfo.cpp +++ b/Sources/Plasma/Apps/plPageInfo/plPageInfo.cpp @@ -41,8 +41,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "hsTimer.h" -#include "plFile/hsFiles.h" -#include "plFile/plFileUtils.h" +#include "hsFiles.h" +#include "plFileUtils.h" #include "plResMgr/plResManager.h" #include "plResMgr/plResMgrSettings.h" diff --git a/Sources/Plasma/Apps/plPythonPack/main.cpp b/Sources/Plasma/Apps/plPythonPack/main.cpp index ea5b33f4..65442f27 100644 --- a/Sources/Plasma/Apps/plPythonPack/main.cpp +++ b/Sources/Plasma/Apps/plPythonPack/main.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "PythonInterface.h" #include "hsStream.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include #include diff --git a/Sources/Plasma/Apps/plUruLauncher/Pch.h b/Sources/Plasma/Apps/plUruLauncher/Pch.h index 990524d8..3f425a06 100644 --- a/Sources/Plasma/Apps/plUruLauncher/Pch.h +++ b/Sources/Plasma/Apps/plUruLauncher/Pch.h @@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnNetCli/pnNetCli.h" #include "plNetGameLib/plNetGameLib.h" #include "pnEncryption/plChecksum.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" #include "plCompression/plZlibStream.h" #include "plClientPatcher/UruPlayer.h" diff --git a/Sources/Plasma/CoreLib/CMakeLists.txt b/Sources/Plasma/CoreLib/CMakeLists.txt index e87d7754..c632ef18 100644 --- a/Sources/Plasma/CoreLib/CMakeLists.txt +++ b/Sources/Plasma/CoreLib/CMakeLists.txt @@ -1,3 +1,4 @@ +include_directories(../PubUtilLib/plUnifiedTime) # EVIL: For plFileUtils.cpp add_definitions(-D_LIB) if(NOT WCHAR_BYTES) @@ -19,6 +20,7 @@ set(CoreLib_SOURCES hsCritSect.cpp hsExceptionStack.cpp hsFastMath.cpp + hsFiles.cpp hsGeometry3.cpp hsMatrix33.cpp hsMatrix44.cpp @@ -34,6 +36,7 @@ set(CoreLib_SOURCES hsThread.cpp hsWide.cpp pcSmallRect.cpp + plFileUtils.cpp plGeneric.cpp plLoadMask.cpp plString.cpp @@ -43,14 +46,15 @@ set(CoreLib_SOURCES if(WIN32 AND NOT CYGWIN) set(CoreLib_SOURCES ${CoreLib_SOURCES} hsThread_Win.cpp + hsFiles_Win.cpp ) endif(WIN32 AND NOT CYGWIN) if(UNIX) set(CoreLib_SOURCES ${CoreLib_SOURCES} hsThread_Unix.cpp + hsFiles_Unix.cpp ) endif(UNIX) - set(CoreLib_HEADERS HeadSpin.h @@ -62,6 +66,7 @@ set(CoreLib_HEADERS hsCritSect.h hsExceptions.h hsFastMath.h + hsFiles.h hsGeometry3.h hsHashTable.h hsMatrix44.h @@ -79,6 +84,7 @@ set(CoreLib_HEADERS hsThread.h hsWide.h pcSmallRect.h + plFileUtils.h plGeneric.h plLoadMask.h plQuality.h diff --git a/Sources/Plasma/CoreLib/HeadSpin.h b/Sources/Plasma/CoreLib/HeadSpin.h index 9a51bf29..08dc423e 100644 --- a/Sources/Plasma/CoreLib/HeadSpin.h +++ b/Sources/Plasma/CoreLib/HeadSpin.h @@ -366,7 +366,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. // Use "correct" stricmp based on the selected compiler / library -#if HS_BUILD_FOR_WIN32 +#if _MSC_VER # define stricmp _stricmp # define strnicmp _strnicmp # define wcsicmp _wcsicmp diff --git a/Sources/Plasma/PubUtilLib/plFile/hsFiles.cpp b/Sources/Plasma/CoreLib/hsFiles.cpp similarity index 100% rename from Sources/Plasma/PubUtilLib/plFile/hsFiles.cpp rename to Sources/Plasma/CoreLib/hsFiles.cpp diff --git a/Sources/Plasma/PubUtilLib/plFile/hsFiles.h b/Sources/Plasma/CoreLib/hsFiles.h similarity index 100% rename from Sources/Plasma/PubUtilLib/plFile/hsFiles.h rename to Sources/Plasma/CoreLib/hsFiles.h diff --git a/Sources/Plasma/PubUtilLib/plFile/hsFiles_Mac.cpp b/Sources/Plasma/CoreLib/hsFiles_Mac.cpp similarity index 100% rename from Sources/Plasma/PubUtilLib/plFile/hsFiles_Mac.cpp rename to Sources/Plasma/CoreLib/hsFiles_Mac.cpp diff --git a/Sources/Plasma/PubUtilLib/plFile/hsFiles_PS2.cpp b/Sources/Plasma/CoreLib/hsFiles_PS2.cpp similarity index 100% rename from Sources/Plasma/PubUtilLib/plFile/hsFiles_PS2.cpp rename to Sources/Plasma/CoreLib/hsFiles_PS2.cpp diff --git a/Sources/Plasma/PubUtilLib/plFile/hsFiles_Unix.cpp b/Sources/Plasma/CoreLib/hsFiles_Unix.cpp similarity index 100% rename from Sources/Plasma/PubUtilLib/plFile/hsFiles_Unix.cpp rename to Sources/Plasma/CoreLib/hsFiles_Unix.cpp diff --git a/Sources/Plasma/PubUtilLib/plFile/hsFiles_Win.cpp b/Sources/Plasma/CoreLib/hsFiles_Win.cpp similarity index 100% rename from Sources/Plasma/PubUtilLib/plFile/hsFiles_Win.cpp rename to Sources/Plasma/CoreLib/hsFiles_Win.cpp diff --git a/Sources/Plasma/CoreLib/hsStream.cpp b/Sources/Plasma/CoreLib/hsStream.cpp index ee0c9e34..3f172469 100644 --- a/Sources/Plasma/CoreLib/hsStream.cpp +++ b/Sources/Plasma/CoreLib/hsStream.cpp @@ -139,40 +139,35 @@ uint32_t hsStream::WriteFmtV(const char * fmt, va_list av) return Write( buf.length(), buf.data() ); } -uint32_t hsStream::WriteSafeStringLong(const char *string) +uint32_t hsStream::WriteSafeStringLong(const plString &string) { - uint32_t len = 0; - if (string) - len = strlen(string); + uint32_t len = string.GetSize(); WriteLE32(len); if (len > 0) { - char *buff = new char[len+1]; - int i; + const char *buffp = string.c_str(); + uint32_t i; for (i = 0; i < len; i++) { - buff[i] = ~string[i]; + WriteByte(~buffp[i]); } - buff[len] = '\0'; - uint32_t result = Write(len, buff); - delete [] buff; - return result; + return i; } else return 0; } -uint32_t hsStream::WriteSafeWStringLong(const wchar_t *string) +uint32_t hsStream::WriteSafeWStringLong(const plString &string) { - uint32_t len = wcslen(string); + plStringBuffer wbuff = string.ToWchar(); + uint32_t len = wbuff.GetSize(); WriteLE32(len); if (len > 0) { - int i; - for (i=0; i 0) { - char *buff = new char[len+1]; - int i; + uint32_t i; + const char *buffp = string.c_str(); for (i = 0; i < len; i++) { - buff[i] = ~string[i]; + WriteByte(~buffp[i]); } - buff[len] = '\0'; - uint32_t result = Write(len, buff); - delete [] buff; - return result; + return i; } else return 0; } -uint32_t hsStream::WriteSafeWString(const wchar_t *string) +uint32_t hsStream::WriteSafeWString(const plString &string) { - int len = wcslen(string); + plStringBuffer wbuff = string.ToWchar(); + uint32_t len = wbuff.GetSize(); hsAssert(len<0xf000, xtl::format("string len of %d is too long for WriteSafeWString, use WriteSafeWStringLong", len).c_str() ); WriteLE16(len | 0xf000); if (len > 0) { - int i; - for (i=0; i #include @@ -503,61 +501,3 @@ uint32_t plFileUtils::GetFileSize( const wchar_t *path ) return len; } - -//// GetSecureEncryptionKey ////////////////////////////////////////////////// - -bool plFileUtils::GetSecureEncryptionKey(const char* filename, uint32_t* key, unsigned length) -{ - wchar_t* wFilename = hsStringToWString(filename); - bool ret = GetSecureEncryptionKey(wFilename, key, length); - delete [] wFilename; - return ret; -} - -bool plFileUtils::GetSecureEncryptionKey(const wchar_t* filename, uint32_t* key, unsigned length) -{ - // looks for an encryption key file in the same directory, and reads it - std::wstring sFilename = filename; - - // grab parent directory - size_t loc = sFilename.rfind(L"\\"); - if (loc == std::wstring::npos) - loc = sFilename.rfind(L"/"); - - std::wstring sDir; - if (loc != std::wstring::npos) - sDir = sFilename.substr(0, loc); - else // no directory - sDir = L"./"; - if ((sDir[sDir.length()-1] != L'/') && (sDir[sDir.length()-1] != L'\\')) - sDir += L'/'; // add the slash, if it doesn't has one - - // now add the key filename - std::wstring keyFile = sDir + kWKeyFilename; - - if (FileExists(keyFile.c_str())) - { - // file exists, read from it - hsUNIXStream file; - file.Open(keyFile.c_str(), L"rb"); - - unsigned bytesToRead = length * sizeof(uint32_t); - uint8_t* buffer = (uint8_t*)malloc(bytesToRead); - unsigned bytesRead = file.Read(bytesToRead, buffer); - - file.Close(); - - unsigned memSize = min(bytesToRead, bytesRead); - memcpy(key, buffer, memSize); - free(buffer); - - return true; - } - - // file doesn't exist, use default key - unsigned memSize = min(length, arrsize(plSecureStream::kDefaultKey)); - memSize *= sizeof(uint32_t); - memcpy(key, plSecureStream::kDefaultKey, memSize); - - return false; -} diff --git a/Sources/Plasma/PubUtilLib/plFile/plFileUtils.h b/Sources/Plasma/CoreLib/plFileUtils.h similarity index 90% rename from Sources/Plasma/PubUtilLib/plFile/plFileUtils.h rename to Sources/Plasma/CoreLib/plFileUtils.h index 29f6d13f..fff955b0 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plFileUtils.h +++ b/Sources/Plasma/CoreLib/plFileUtils.h @@ -56,9 +56,6 @@ class plUnifiedTime; namespace plFileUtils { - static const char kKeyFilename[] = "encryption.key"; - static const wchar_t kWKeyFilename[] = L"encryption.key"; - // Creates the directory specified. Returns false if unsuccessful or directory already exists bool CreateDir( const char *path ); bool CreateDir( const wchar_t *path ); @@ -113,12 +110,6 @@ namespace plFileUtils // Concatenates fileName onto path, making sure to add a slash if necessary void ConcatFileName(char* path, const char* fileName); void ConcatFileName(wchar_t* path, const wchar_t* fileName); - - // searches the parent directory of filename for the encryption key file, and reads it - // into the key passed in. Returns false if the key file didn't exist (and sets key to - // the default key) - bool GetSecureEncryptionKey(const char* filename, uint32_t* key, unsigned length); - bool GetSecureEncryptionKey(const wchar_t* filename, uint32_t* key, unsigned length); }; diff --git a/Sources/Plasma/CoreLib/plGeneric.cpp b/Sources/Plasma/CoreLib/plGeneric.cpp index 7cb0ea10..1b60a671 100644 --- a/Sources/Plasma/CoreLib/plGeneric.cpp +++ b/Sources/Plasma/CoreLib/plGeneric.cpp @@ -50,24 +50,7 @@ plGeneric::plGeneric(const int& val): fType(kInt), fBoolVal(false), fIntVal(val) plGeneric::plGeneric(const double& val): fType(kFloat), fBoolVal(false), fIntVal(0), fFloatVal(val) {} -plGeneric::plGeneric(const char* val): fType(kString), fBoolVal(false), fIntVal(0), fFloatVal(0.0) -{ - wchar_t* temp = hsStringToWString(val); - fStringVal = temp; - delete [] temp; -} - -plGeneric::plGeneric(const std::string& val): fType(kString), fBoolVal(false), fIntVal(0), fFloatVal(0.0) -{ - wchar_t* temp = hsStringToWString(val.c_str()); - fStringVal = temp; - delete [] temp; -} - -plGeneric::plGeneric(const wchar_t* val): fType(kString), fBoolVal(false), fIntVal(0), fFloatVal(0.0), -fStringVal(val) {} - -plGeneric::plGeneric(const std::wstring& val): fType(kString), fBoolVal(false), fIntVal(0), fFloatVal(0.0), +plGeneric::plGeneric(const plString& val): fType(kString), fBoolVal(false), fIntVal(0), fFloatVal(0.0), fStringVal(val) {} void plGeneric::IReset() @@ -76,7 +59,7 @@ void plGeneric::IReset() fBoolVal = false; fIntVal = 0; fFloatVal = 0.0; - fStringVal = L""; + fStringVal = ""; } plGeneric& plGeneric::operator=(const bool& val) @@ -103,35 +86,7 @@ plGeneric& plGeneric::operator=(const double& val) return *this; } -plGeneric& plGeneric::operator=(const char* val) -{ - IReset(); - fType = kString; - wchar_t* temp = hsStringToWString(val); - fStringVal = temp; - delete [] temp; - return *this; -} - -plGeneric& plGeneric::operator=(const std::string& val) -{ - IReset(); - fType = kString; - wchar_t* temp = hsStringToWString(val.c_str()); - fStringVal = temp; - delete [] temp; - return *this; -} - -plGeneric& plGeneric::operator=(const wchar_t* val) -{ - IReset(); - fType = kString; - fStringVal = val; - return *this; -} - -plGeneric& plGeneric::operator=(const std::wstring& val) +plGeneric& plGeneric::operator=(const plString& val) { IReset(); fType = kString; @@ -161,7 +116,7 @@ int plGeneric::Write(hsStream* stream) break; case kString: - stream->WriteSafeWString(fStringVal.c_str()); + stream->WriteSafeWString(fStringVal); break; } return stream->GetPosition(); @@ -189,15 +144,8 @@ int plGeneric::Read(hsStream* stream) break; case kString: - { - wchar_t* temp = stream->ReadSafeWString(); - if (temp) - { - fStringVal = temp; - delete [] temp; - } - } + fStringVal = stream->ReadSafeWString_TEMP(); break; } return stream->GetPosition(); -} \ No newline at end of file +} diff --git a/Sources/Plasma/CoreLib/plGeneric.h b/Sources/Plasma/CoreLib/plGeneric.h index eb57d807..c73897a8 100644 --- a/Sources/Plasma/CoreLib/plGeneric.h +++ b/Sources/Plasma/CoreLib/plGeneric.h @@ -62,7 +62,7 @@ private: bool fBoolVal; int fIntVal; double fFloatVal; - std::wstring fStringVal; + plString fStringVal; void IReset(); @@ -71,19 +71,13 @@ public: plGeneric(const bool& val); plGeneric(const int& val); plGeneric(const double& val); - plGeneric(const char* val); - plGeneric(const std::string& val); - plGeneric(const wchar_t* val); - plGeneric(const std::wstring& val); + plGeneric(const plString& val); void SetToNull() {IReset();} plGeneric& operator=(const bool& val); plGeneric& operator=(const int& val); plGeneric& operator=(const double& val); - plGeneric& operator=(const char* val); - plGeneric& operator=(const std::string& val); - plGeneric& operator=(const wchar_t* val); - plGeneric& operator=(const std::wstring& val); + plGeneric& operator=(const plString& val); // the cast functions will NOT cast from one type to another, use // GetType() to determine the type of parameter, then cast it to that type @@ -91,8 +85,7 @@ public: operator bool() const {return fBoolVal;} operator int() const {return fIntVal;} operator double() const {return fFloatVal;} - operator const wchar_t*() const {return fStringVal.c_str();} - operator std::wstring() const {return fStringVal;} + operator plString() const {return fStringVal;} int Write(hsStream* stream); int Read(hsStream* stream); diff --git a/Sources/Plasma/CoreLib/plString.cpp b/Sources/Plasma/CoreLib/plString.cpp index 42b50970..c60440c9 100644 --- a/Sources/Plasma/CoreLib/plString.cpp +++ b/Sources/Plasma/CoreLib/plString.cpp @@ -16,6 +16,22 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . +Additional permissions under GNU GPL version 3 section 7 + +If you modify this Program, or any covered work, by linking or +combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, +NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent +JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK +(or a modified version of those libraries), +containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, +PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG +JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the +licensors of this Program grant you additional +permission to convey the resulting work. Corresponding Source for a +non-source form of such a combination shall include the source code for +the parts of OpenSSL and IJG JPEG Library used as well as that of the covered +work. + You can contact Cyan Worlds, Inc. by email legal@cyan.com or by snail mail at: Cyan Worlds, Inc. @@ -29,6 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include #include +#include const plString plString::Null; @@ -67,7 +84,7 @@ size_t wcsnlen(const wchar_t *s, size_t maxlen) #define BADCHAR_REPLACEMENT (0xFFFDul) -void plString::IConvertFromUtf8(const char *utf8, size_t size, bool steal) +void plString::IConvertFromUtf8(const char *utf8, size_t size) { if (utf8 == nil) { fUtf8Buffer = plStringBuffer(); @@ -77,10 +94,17 @@ void plString::IConvertFromUtf8(const char *utf8, size_t size, bool steal) if ((int32_t)size < 0) size = strnlen(utf8, -(int32_t)size); + operator=(plStringBuffer(utf8, size)); +} + +plString &plString::operator=(const plStringBuffer &init) +{ + fUtf8Buffer = init; + #ifdef _DEBUG // Check to make sure the string is actually valid UTF-8 - const char *sp = utf8; - while (sp < utf8 + size) { + const char *sp = fUtf8Buffer.GetData(); + while (sp < fUtf8Buffer.GetData() + fUtf8Buffer.GetSize()) { unsigned char unichar = *sp++; if ((unichar & 0xF8) == 0xF0) { // Four bytes @@ -102,16 +126,14 @@ void plString::IConvertFromUtf8(const char *utf8, size_t size, bool steal) } #endif - fUtf8Buffer = steal ? plStringBuffer::Steal(utf8, size) - : plStringBuffer(utf8, size); + return *this; } void plString::IConvertFromUtf16(const uint16_t *utf16, size_t size) { - if (utf16 == nil) { - fUtf8Buffer = plStringBuffer(); + fUtf8Buffer = plStringBuffer(); + if (utf16 == nil) return; - } if ((int32_t)size < 0) size = u16slen(utf16, -(int32_t)size); @@ -135,7 +157,7 @@ void plString::IConvertFromUtf16(const uint16_t *utf16, size_t size) } // And perform the actual conversion - char *utf8 = new char[convlen + 1]; + char *utf8 = fUtf8Buffer.CreateWritableBuffer(convlen); char *dp = utf8; sp = utf16; while (sp < utf16 + size) { @@ -174,8 +196,6 @@ void plString::IConvertFromUtf16(const uint16_t *utf16, size_t size) ++sp; } utf8[convlen] = 0; - - fUtf8Buffer = plStringBuffer::Steal(utf8, convlen); } void plString::IConvertFromWchar(const wchar_t *wstr, size_t size) @@ -184,10 +204,9 @@ void plString::IConvertFromWchar(const wchar_t *wstr, size_t size) // We assume that if sizeof(wchar_t) == 2, the data is UTF-16 already IConvertFromUtf16((const uint16_t *)wstr, size); #else - if (wstr == nil) { - fUtf8Buffer = plStringBuffer(); + fUtf8Buffer = plStringBuffer(); + if (wstr == nil) return; - } if ((int32_t)size < 0) size = wcsnlen(wstr, -(int32_t)size); @@ -212,7 +231,7 @@ void plString::IConvertFromWchar(const wchar_t *wstr, size_t size) } // And perform the actual conversion - char *utf8 = new char[convlen + 1]; + char *utf8 = fUtf8Buffer.CreateWritableBuffer(convlen); char *dp = utf8; sp = wstr; while (sp < wstr + size) { @@ -239,17 +258,14 @@ void plString::IConvertFromWchar(const wchar_t *wstr, size_t size) ++sp; } utf8[convlen] = 0; - - fUtf8Buffer = plStringBuffer::Steal(utf8, convlen); #endif } void plString::IConvertFromIso8859_1(const char *astr, size_t size) { - if (astr == nil) { - fUtf8Buffer = plStringBuffer(); + fUtf8Buffer = plStringBuffer(); + if (astr == nil) return; - } if ((int32_t)size < 0) size = strnlen(astr, -(int32_t)size); @@ -265,7 +281,7 @@ void plString::IConvertFromIso8859_1(const char *astr, size_t size) } // And perform the actual conversion - char *utf8 = new char[convlen + 1]; + char *utf8 = fUtf8Buffer.CreateWritableBuffer(convlen); char *dp = utf8; sp = astr; while (sp < astr + size) { @@ -278,14 +294,13 @@ void plString::IConvertFromIso8859_1(const char *astr, size_t size) ++sp; } utf8[convlen] = 0; - - fUtf8Buffer = plStringBuffer::Steal(utf8, convlen); } plStringBuffer plString::ToUtf16() const { - if (IsNull()) - return plStringBuffer(); + plStringBuffer result; + if (IsEmpty()) + return result; // Calculate the UTF-16 size size_t convlen = 0; @@ -308,7 +323,7 @@ plStringBuffer plString::ToUtf16() const } // And perform the actual conversion - uint16_t *ustr = new uint16_t[convlen + 1]; + uint16_t *ustr = result.CreateWritableBuffer(convlen); uint16_t *dp = ustr; sp = utf8; while (sp < utf8 + srcSize) { @@ -336,7 +351,7 @@ plStringBuffer plString::ToUtf16() const } ustr[convlen] = 0; - return plStringBuffer::Steal(ustr, convlen); + return result; } plStringBuffer plString::ToWchar() const @@ -346,8 +361,9 @@ plStringBuffer plString::ToWchar() const plStringBuffer utf16 = ToUtf16(); return *reinterpret_cast*>(&utf16); #else - if (IsNull()) - return plStringBuffer(); + plStringBuffer result; + if (IsEmpty()) + return result; // Calculate the UCS-4 size size_t convlen = 0; @@ -367,7 +383,7 @@ plStringBuffer plString::ToWchar() const } // And perform the actual conversion - wchar_t *wstr = new wchar_t[convlen + 1]; + wchar_t *wstr = result.CreateWritableBuffer(convlen); wchar_t *dp = wstr; sp = utf8; while (sp < utf8 + srcSize) { @@ -391,14 +407,15 @@ plStringBuffer plString::ToWchar() const } wstr[convlen] = 0; - return plStringBuffer::Steal(wstr, convlen); + return result; #endif } plStringBuffer plString::ToIso8859_1() const { - if (IsNull()) - return plStringBuffer(); + plStringBuffer result; + if (IsEmpty()) + return result; // Calculate the ASCII size size_t convlen = 0; @@ -418,7 +435,7 @@ plStringBuffer plString::ToIso8859_1() const } // And perform the actual conversion - char *astr = new char[convlen + 1]; + char *astr = result.CreateWritableBuffer(convlen); char *dp = astr; sp = utf8; while (sp < utf8 + srcSize) { @@ -442,45 +459,45 @@ plStringBuffer plString::ToIso8859_1() const } astr[convlen] = 0; - return plStringBuffer::Steal(astr, convlen); + return result; } plStringBuffer plString::GetUnicodeArray() const { - static UniChar empty[1] = {0}; - - if (IsNull()) - return plStringBuffer(empty, 0); + plStringBuffer result; + if (IsEmpty()) + return result; size_t convlen = GetUniCharCount(); - UniChar *ustr = new UniChar[convlen + 1]; + UniChar *ustr = result.CreateWritableBuffer(convlen); iterator iter = GetIterator(); size_t dp = 0; while (!iter.AtEnd()) ustr[dp++] = *iter++; ustr[convlen] = 0; - return plStringBuffer::Steal(ustr, convlen); + + return result; } int plString::ToInt(int base) const { - return static_cast(strtol(s_str(), nil, base)); + return static_cast(strtol(c_str(), nil, base)); } unsigned int plString::ToUInt(int base) const { - return static_cast(strtoul(s_str(), nil, base)); + return static_cast(strtoul(c_str(), nil, base)); } float plString::ToFloat() const { // strtof is C99, which MS doesn't support... - return (float)strtod(s_str(), nil); + return (float)strtod(c_str(), nil); } double plString::ToDouble() const { - return strtod(s_str(), nil); + return strtod(c_str(), nil); } // Microsoft doesn't provide this for us @@ -501,22 +518,21 @@ plString plString::IFormat(const char *fmt, va_list vptr) int size = 4096; for ( ;; ) { va_copy(vptr, vptr_save); - char *bigbuffer = new char[size]; - chars = vsnprintf(bigbuffer, size, fmt, vptr); + std::auto_ptr bigbuffer(new char[size]); + chars = vsnprintf(bigbuffer.get(), size, fmt, vptr); if (chars >= 0) - return plString::Steal(bigbuffer); + return plString::FromUtf8(bigbuffer.get(), chars); - delete [] bigbuffer; size *= 2; } } else if (chars >= 256) { va_copy(vptr, vptr_save); - char *bigbuffer = new char[chars+1]; - vsnprintf(bigbuffer, chars+1, fmt, vptr); - return plString::Steal(bigbuffer); + std::auto_ptr bigbuffer(new char[chars+1]); + vsnprintf(bigbuffer.get(), chars+1, fmt, vptr); + return plString::FromUtf8(bigbuffer.get(), chars); } - return plString::FromUtf8(buffer); + return plString::FromUtf8(buffer, chars); } plString plString::Format(const char *fmt, ...) @@ -531,11 +547,10 @@ plString plString::Format(const char *fmt, ...) int plString::Find(char ch, CaseSensitivity sense) const { if (sense == kCaseSensitive) { - const char *cp = strchr(s_str(), ch); + const char *cp = strchr(c_str(), ch); return cp ? (cp - c_str()) : -1; } else { - // No need to check for null, since s_str() will return { 0 } if it is null - const char *cp = s_str(); + const char *cp = c_str(); while (*cp) { if (tolower(*cp) == tolower(ch)) return cp - c_str(); @@ -550,7 +565,7 @@ int plString::FindLast(char ch, CaseSensitivity sense) const return -1; if (sense == kCaseSensitive) { - const char *cp = strrchr(s_str(), ch); + const char *cp = strrchr(c_str(), ch); return cp ? (cp - c_str()) : -1; } else { const char *cp = c_str(); @@ -570,7 +585,7 @@ int plString::Find(const char *str, CaseSensitivity sense) const return -1; if (sense == kCaseSensitive) { - const char *cp = strstr(s_str(), str); + const char *cp = strstr(c_str(), str); return cp ? (cp - c_str()) : -1; } else { // The easy way @@ -651,69 +666,49 @@ plString plString::Substr(int start, size_t size) const if (start == 0 && size == maxSize) return *this; - char *substr = new char[size + 1]; + plString sub; + char *substr = sub.fUtf8Buffer.CreateWritableBuffer(size); memcpy(substr, c_str() + start, size); substr[size] = 0; - // Don't re-check UTF-8 on this - plString str; - str.fUtf8Buffer = plStringBuffer::Steal(substr, size); - return str; + return sub; } plString plString::ToUpper() const { // TODO: Unicode-aware case conversion - size_t size = GetSize(); - char *dupe = new char[size + 1]; + plString str; + char *dupe = str.fUtf8Buffer.CreateWritableBuffer(fUtf8Buffer.GetSize()); const char *self = c_str(); - for (size_t i = 0; i < size; ++i) + for (size_t i = 0; i < fUtf8Buffer.GetSize(); ++i) dupe[i] = toupper(self[i]); + dupe[fUtf8Buffer.GetSize()] = 0; - // Don't re-check UTF-8 on this - plString str; - str.fUtf8Buffer = plStringBuffer::Steal(dupe, size); return str; } plString plString::ToLower() const { // TODO: Unicode-aware case conversion - size_t size = GetSize(); - char *dupe = new char[size + 1]; + plString str; + char *dupe = str.fUtf8Buffer.CreateWritableBuffer(fUtf8Buffer.GetSize()); const char *self = c_str(); - for (size_t i = 0; i < size; ++i) + for (size_t i = 0; i < fUtf8Buffer.GetSize(); ++i) dupe[i] = tolower(self[i]); + dupe[fUtf8Buffer.GetSize()] = 0; - // Don't re-check UTF-8 on this - plString str; - str.fUtf8Buffer = plStringBuffer::Steal(dupe, size); return str; } -plString &plString::operator+=(const plString &str) -{ - size_t catsize = GetSize() + str.GetSize(); - char *catstr = new char[catsize + 1]; - memcpy(catstr, s_str(), GetSize()); - memcpy(catstr + GetSize(), str.s_str(), str.GetSize()); - catstr[catsize] = 0; - fUtf8Buffer = plStringBuffer::Steal(catstr, catsize); - return *this; -} - plString operator+(const plString &left, const plString &right) { - size_t catsize = left.GetSize() + right.GetSize(); - char *catstr = new char[catsize + 1]; - memcpy(catstr, left.s_str(), left.GetSize()); - memcpy(catstr + left.GetSize(), right.s_str(), right.GetSize()); - catstr[catsize] = 0; + plString cat; + char *catstr = cat.fUtf8Buffer.CreateWritableBuffer(left.GetSize() + right.GetSize()); + memcpy(catstr, left.c_str(), left.GetSize()); + memcpy(catstr + left.GetSize(), right.c_str(), right.GetSize()); + catstr[cat.fUtf8Buffer.GetSize()] = 0; - // Don't re-check UTF-8 on this - plString str; - str.fUtf8Buffer = plStringBuffer::Steal(catstr, catsize); - return str; + return cat; } plStringStream &plStringStream::append(const char *data, size_t length) diff --git a/Sources/Plasma/CoreLib/plString.h b/Sources/Plasma/CoreLib/plString.h index 82234ded..2014abb3 100644 --- a/Sources/Plasma/CoreLib/plString.h +++ b/Sources/Plasma/CoreLib/plString.h @@ -16,6 +16,22 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . +Additional permissions under GNU GPL version 3 section 7 + +If you modify this Program, or any covered work, by linking or +combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, +NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent +JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK +(or a modified version of those libraries), +containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, +PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG +JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the +licensors of this Program grant you additional +permission to convey the resulting work. Corresponding Source for a +non-source form of such a combination shall include the source code for +the parts of OpenSSL and IJG JPEG Library used as well as that of the covered +work. + You can contact Cyan Worlds, Inc. by email legal@cyan.com or by snail mail at: Cyan Worlds, Inc. @@ -29,21 +45,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include -#include -#include - -/* NOTE & TODO: - * These macros are intentionally annoyingly named, to mark what code - * needs to be cleaned up after a larger portion of Plasma is converted - * to plString. - */ -#define _TEMP_CONVERT_FROM_LITERAL(x) plString::FromUtf8((x)) -#define _TEMP_CONVERT_FROM_WCHAR_T(x) plString::FromWchar((x)) -#define _TEMP_CONVERT_TO_CONST_CHAR(x) ((x).c_str()) -#define _TEMP_CONVERT_TO_WCHAR_T(x) ((x).ToWchar().GetData()) typedef unsigned int UniChar; +#define SSO_CHARS (16) + template class plStringBuffer { @@ -52,10 +58,9 @@ private: { unsigned int fRefs; const _Ch *fStringData; - const size_t fSize; - StringRef(const _Ch *data, const size_t size) - : fRefs(1), fStringData(data), fSize(size) { } + StringRef(const _Ch *data) + : fRefs(1), fStringData(data) { } inline void AddRef() { ++fRefs; } inline void DecRef() @@ -67,52 +72,74 @@ private: } }; - StringRef *fData; + union { + StringRef *fData; + _Ch fShort[SSO_CHARS]; + }; + size_t fSize; + + bool IHaveACow() const { return fSize >= SSO_CHARS; } public: - plStringBuffer() : fData(nil) { } + plStringBuffer() : fSize(0) { memset(fShort, 0, sizeof(fShort)); } - plStringBuffer(const plStringBuffer<_Ch> ©) + plStringBuffer(const plStringBuffer<_Ch> ©) : fSize(copy.fSize) { - fData = copy.fData; - if (fData) + memcpy(fShort, copy.fShort, sizeof(fShort)); + if (IHaveACow()) fData->AddRef(); } - plStringBuffer(const _Ch *data, size_t size) + plStringBuffer(const _Ch *data, size_t size) : fSize(size) { - _Ch *copyData = new _Ch[size + 1]; + memset(fShort, 0, sizeof(fShort)); + _Ch *copyData = IHaveACow() ? new _Ch[size + 1] : fShort; memcpy(copyData, data, size); copyData[size] = 0; - fData = new StringRef(copyData, size); + if (IHaveACow()) + fData = new StringRef(copyData); } ~plStringBuffer<_Ch>() { - if (fData) + if (IHaveACow()) fData->DecRef(); } - static plStringBuffer<_Ch> Steal(const _Ch *data, size_t size) - { - plStringBuffer<_Ch> string; - string.fData = new StringRef(data, size); - return string; - } - plStringBuffer<_Ch> &operator=(const plStringBuffer<_Ch> ©) { - if (copy.fData) + if (copy.IHaveACow()) copy.fData->AddRef(); - if (fData) + if (IHaveACow()) fData->DecRef(); - fData = copy.fData; + + memcpy(fShort, copy.fShort, sizeof(fShort)); + fSize = copy.fSize; return *this; } - const _Ch *GetData() const { return fData ? fData->fStringData : 0; } - size_t GetSize() const { return fData ? fData->fSize : 0; } + const _Ch *GetData() const { return IHaveACow() ? fData->fStringData : fShort; } + size_t GetSize() const { return fSize; } + + operator const _Ch *() const { return GetData(); } + + // From Haxxia with love + // NOTE: The client is expected to nul-terminate the returned buffer! + _Ch *CreateWritableBuffer(size_t size) + { + if (IHaveACow()) + fData->DecRef(); + + fSize = size; + if (IHaveACow()) { + _Ch *writable = new _Ch[fSize + 1]; + fData = new StringRef(writable); + return writable; + } else { + return fShort; + } + } }; @@ -128,7 +155,7 @@ public: private: plStringBuffer fUtf8Buffer; - void IConvertFromUtf8(const char *utf8, size_t size, bool steal); + void IConvertFromUtf8(const char *utf8, size_t size); void IConvertFromUtf16(const uint16_t *utf16, size_t size); void IConvertFromWchar(const wchar_t *wstr, size_t size); void IConvertFromIso8859_1(const char *astr, size_t size); @@ -136,20 +163,24 @@ private: public: plString() { } - //plString(const char *utf8) { IConvertFromUtf8(utf8, kSizeAuto, false); } - //plString(const wchar_t *wstr) { IConvertFromWchar(wstr, kSizeAuto); } +#ifndef PLSTRING_POLLUTE_ASCII_CAST + plString(const char *cstr) { IConvertFromUtf8(cstr, kSizeAuto); } +#endif plString(const plString ©) : fUtf8Buffer(copy.fUtf8Buffer) { } + plString(const plStringBuffer &init) { operator=(init); } - //plString &operator=(const char *utf8) { IConvertFromUtf8(utf8, kSizeAuto, false); return *this; } - //plString &operator=(const wchar_t *wstr) { IConvertFromWchar(wstr, kSizeAuto); return *this; } +#ifndef PLSTRING_POLLUTE_ASCII_CAST + plString &operator=(const char *cstr) { IConvertFromUtf8(cstr, kSizeAuto); return *this; } +#endif plString &operator=(const plString ©) { fUtf8Buffer = copy.fUtf8Buffer; return *this; } + plString &operator=(const plStringBuffer &init); - plString &operator+=(const plString &str); + plString &operator+=(const plString &str) { return operator=(*this + str); } static inline plString FromUtf8(const char *utf8, size_t size = kSizeAuto) { plString str; - str.IConvertFromUtf8(utf8, size, false); + str.IConvertFromUtf8(utf8, size); return str; } @@ -174,8 +205,11 @@ public: return str; } - const char *c_str() const { return fUtf8Buffer.GetData(); } - const char *s_str(const char *safe = "") const { return c_str() ? c_str() : safe; } +#ifndef PLSTRING_POLLUTE_C_STR + const char *c_str(const char *substitute = "") const + { return IsEmpty() ? substitute : fUtf8Buffer.GetData(); } +#endif + char CharAt(size_t position) const { return c_str()[position]; } plStringBuffer ToUtf8() const { return fUtf8Buffer; } @@ -188,7 +222,10 @@ public: size_t GetSize() const { return fUtf8Buffer.GetSize(); } bool IsEmpty() const { return fUtf8Buffer.GetSize() == 0; } - bool IsNull() const { return fUtf8Buffer.GetData() == 0; } + + // TODO: Evaluate whether Plasma actually needs to distinguish between + // empty and NULL strings. Ideally, only IsEmpty should be required. + bool IsNull() const { return IsEmpty(); } int ToInt(int base = 0) const; unsigned int ToUInt(int base = 0) const; @@ -197,12 +234,6 @@ public: static plString Format(const char *fmt, ...); static plString IFormat(const char *fmt, va_list vptr); - static plString Steal(const char *utf8, size_t size = kSizeAuto) - { - plString str; - str.IConvertFromUtf8(utf8, size, true); - return str; - } enum CaseSensitivity { kCaseSensitive, kCaseInsensitive @@ -210,32 +241,26 @@ public: int Compare(const plString &str, CaseSensitivity sense = kCaseSensitive) const { - if (c_str() == str.c_str()) - return 0; - - return (sense == kCaseSensitive) ? strcmp(s_str(), str.s_str()) - : stricmp(s_str(), str.s_str()); + return (sense == kCaseSensitive) ? strcmp(c_str(), str.c_str()) + : stricmp(c_str(), str.c_str()); } int Compare(const char *str, CaseSensitivity sense = kCaseSensitive) const { - return (sense == kCaseSensitive) ? strcmp(s_str(), str) - : stricmp(s_str(), str); + return (sense == kCaseSensitive) ? strcmp(c_str(), str) + : stricmp(c_str(), str); } int CompareN(const plString &str, size_t count, CaseSensitivity sense = kCaseSensitive) const { - if (c_str() == str.c_str()) - return 0; - - return (sense == kCaseSensitive) ? strncmp(s_str(), str.s_str(), count) - : strnicmp(s_str(), str.s_str(), count); + return (sense == kCaseSensitive) ? strncmp(c_str(), str.c_str(), count) + : strnicmp(c_str(), str.c_str(), count); } int CompareN(const char *str, size_t count, CaseSensitivity sense = kCaseSensitive) const { - return (sense == kCaseSensitive) ? strncmp(s_str(), str, count) - : strnicmp(s_str(), str, count); + return (sense == kCaseSensitive) ? strncmp(c_str(), str, count) + : strnicmp(c_str(), str, count); } bool operator<(const plString &other) const { return Compare(other) < 0; } @@ -263,25 +288,25 @@ public: plString ToLower() const; public: - struct less : public std::binary_function + struct less { bool operator()(const plString &_L, const plString &_R) const { return _L.Compare(_R, kCaseSensitive) < 0; } }; - struct less_i : public std::binary_function + struct less_i { bool operator()(const plString &_L, const plString &_R) const { return _L.Compare(_R, kCaseInsensitive) < 0; } }; - struct equal : public std::binary_function + struct equal { bool operator()(const plString &_L, const plString &_R) const { return _L.Compare(_R, kCaseSensitive) == 0; } }; - struct equal_i : public std::binary_function + struct equal_i { bool operator()(const plString &_L, const plString &_R) const { return _L.Compare(_R, kCaseInsensitive) == 0; } @@ -376,7 +401,7 @@ public: const char *m_end; }; - iterator GetIterator() const { return iterator(s_str(), GetSize()); } + iterator GetIterator() const { return iterator(c_str(), GetSize()); } size_t GetUniCharCount() const { @@ -414,7 +439,7 @@ public: plStringStream &operator<<(const plString &text) { - return append(text.s_str(), text.GetSize()); + return append(text.c_str(), text.GetSize()); } size_t GetLength() const { return fLength; } diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plAnimDebugList.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plAnimDebugList.cpp index 7f3f0ed3..3df1e750 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plAnimDebugList.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plAnimDebugList.cpp @@ -127,7 +127,7 @@ void plAnimDebugList::ShowReport() str = plString::Format("%s: %s %.3f (%.3f)", mat->GetKeyName().c_str(), layerAnim->GetKeyName().c_str(), layerAnim->GetTimeConvert().CurrentAnimTime(), layerAnim->GetTimeConvert().WorldToAnimTimeNoUpdate(hsTimer::GetSysSeconds())); - txt.DrawString(x, y, _TEMP_CONVERT_TO_CONST_CHAR(str)); + txt.DrawString(x, y, str.c_str()); y += yOff; } layer = layer->GetOverLay(); @@ -149,7 +149,7 @@ void plAnimDebugList::ShowReport() continue; str = plString::Format(" %s", so->GetKeyName().c_str()); - txt.DrawString(x, y, _TEMP_CONVERT_TO_CONST_CHAR(str)); + txt.DrawString(x, y, str.c_str()); y += yOff; for (j = 0; j < mod->GetNumATCAnimations(); j++) @@ -158,7 +158,7 @@ void plAnimDebugList::ShowReport() str = plString::Format(" %s: %.3f (%.3f)", anim->GetAnimation()->GetName().c_str(), anim->GetTimeConvert()->CurrentAnimTime(), anim->GetTimeConvert()->WorldToAnimTimeNoUpdate(hsTimer::GetSysSeconds())); - txt.DrawString(x, y, _TEMP_CONVERT_TO_CONST_CHAR(str)); + txt.DrawString(x, y, str.c_str()); y += yOff; } } diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp index ec0f4a36..cc555c37 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plRandomCommandMod.cpp @@ -41,6 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include +#include #include "HeadSpin.h" #include "plRandomCommandMod.h" diff --git a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h index d950233b..aebfbfc5 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h +++ b/Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h @@ -46,6 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnKeyedObject/hsKeyedObject.h" #include "hsMatrix44.h" #include "hsBitVector.h" +#include class plPipeline; class plCameraModifier1; diff --git a/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerInfo.cpp b/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerInfo.cpp index 2b8175d3..6acd87bb 100644 --- a/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerInfo.cpp +++ b/Sources/Plasma/FeatureLib/pfCharacter/pfMarkerInfo.cpp @@ -77,7 +77,7 @@ void pfMarkerInfo::Init() plLocation markerLoc = plKeyFinder::Instance().FindLocation("GlobalMarkers", "Markers"); if (markerLoc.IsValid()) - fMarkerUoid = plUoid(markerLoc, plSceneObject::Index(), _TEMP_CONVERT_FROM_LITERAL("MarkerRoot")); + fMarkerUoid = plUoid(markerLoc, plSceneObject::Index(), "MarkerRoot"); else fMarkerUoid.Invalidate(); } @@ -101,7 +101,7 @@ void pfMarkerInfo::Spawn(MarkerType type) plLocation markerLoc = plKeyFinder::Instance().FindLocation("GlobalMarkers", "Markers"); if (markerLoc.IsValid()) - fMarkerUoid = plUoid(markerLoc, plSceneObject::Index(), _TEMP_CONVERT_FROM_LITERAL("MarkerRoot")); + fMarkerUoid = plUoid(markerLoc, plSceneObject::Index(), "MarkerRoot"); else { hsAssert(false, "Unable to spawn markers because the marker age was not loaded or found"); diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp index 00a6c920..35623df8 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp @@ -173,7 +173,7 @@ PF_CONSOLE_CMD( Avatar_Spawn, Show, "", "Print a list of spawn points.") const plSpawnModifier * spawn = mgr->GetSpawnPoint(i); if(spawn) { - plString soName = _TEMP_CONVERT_FROM_LITERAL("(none)"); + plString soName = "(none)"; if (spawn->GetNumTargets() > 0) { diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp index 86b43120..bc262f0e 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp @@ -334,7 +334,7 @@ bool pfConsole::MsgReceive( plMessage *msg ) case kSrv2Cli_GameMgr_InviteReceived: { const Srv2Cli_GameMgr_InviteReceived & gmMsg = *(const Srv2Cli_GameMgr_InviteReceived *)gameMgrMsg->netMsg; const plString & inviterName = plNetClientMgr::GetInstance()->GetPlayerNameById(gmMsg.inviterId); - AddLineF("[GameMgr] Invite received: %S, %u. Inviter: %s", pfGameMgr::GetInstance()->GetGameNameByTypeId(gmMsg.gameTypeId), gmMsg.newGameId, inviterName.s_str("")); + AddLineF("[GameMgr] Invite received: %S, %u. Inviter: %s", pfGameMgr::GetInstance()->GetGameNameByTypeId(gmMsg.gameTypeId), gmMsg.newGameId, inviterName.c_str("")); } return true; @@ -343,7 +343,7 @@ bool pfConsole::MsgReceive( plMessage *msg ) case kSrv2Cli_GameMgr_InviteRevoked: { const Srv2Cli_GameMgr_InviteRevoked & gmMsg = *(const Srv2Cli_GameMgr_InviteRevoked *)gameMgrMsg->netMsg; const plString & inviterName = plNetClientMgr::GetInstance()->GetPlayerNameById(gmMsg.inviterId); - AddLineF("[GameMgr] Invite revoked: %S, %u. Inviter: %s", pfGameMgr::GetInstance()->GetGameNameByTypeId(gmMsg.gameTypeId), gmMsg.newGameId, inviterName.s_str("")); + AddLineF("[GameMgr] Invite revoked: %S, %u. Inviter: %s", pfGameMgr::GetInstance()->GetGameNameByTypeId(gmMsg.gameTypeId), gmMsg.newGameId, inviterName.c_str("")); } return true; diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp index 616a0c7d..f3df05e9 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp @@ -155,7 +155,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plUnifiedTime/plUnifiedTime.h" //end for agedefn test -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "pnSceneObject/plAudioInterface.h" #include "plStatusLog/plStatusLog.h" @@ -6980,7 +6980,7 @@ PF_CONSOLE_CMD( Python, args = plString::Format("(%s,)", tmp); } else - args = _TEMP_CONVERT_FROM_LITERAL("()"); + args = "()"; PythonInterface::RunFunctionSafe("xCheat", params[0], args.c_str()); diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp index 14cee051..124aa516 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp @@ -84,7 +84,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plUnifiedTime/plUnifiedTime.h" //end for agedefn test -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "plStatusLog/plStatusLog.h" @@ -231,12 +231,12 @@ PF_CONSOLE_CMD( Net, // groupName { // send chat text plString text=plNetClientMgr::GetInstance()->GetPlayerName(); - text += _TEMP_CONVERT_FROM_LITERAL(":"); + text += ":"; int i; for(i=0;iSetBCastFlag(plMessage::kNetPropagate | plMessage::kNetForce); diff --git a/Sources/Plasma/FeatureLib/pfCrashHandler/plCrashSrv.cpp b/Sources/Plasma/FeatureLib/pfCrashHandler/plCrashSrv.cpp index 5d5926e2..22fc9430 100644 --- a/Sources/Plasma/FeatureLib/pfCrashHandler/plCrashSrv.cpp +++ b/Sources/Plasma/FeatureLib/pfCrashHandler/plCrashSrv.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plCrashSrv.h" #include "plCrash_Private.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" #include "pnProduct/pnProduct.h" #ifdef HS_BUILD_FOR_WIN32 diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp index 67e277bb..a463bc44 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIDialogMod.cpp @@ -498,7 +498,7 @@ static bool showBounds = false; if( showBounds ) { const hsBounds3 &bnds = fMousedCtrl->GetBounds(); - plDebugText::Instance().DrawString( (uint16_t)(bnds.GetMins().fX), (uint16_t)(bnds.GetMins().fY), _TEMP_CONVERT_TO_CONST_CHAR( fMousedCtrl->GetKeyName() ), (uint32_t)0xffffff00 ); + plDebugText::Instance().DrawString( (uint16_t)(bnds.GetMins().fX), (uint16_t)(bnds.GetMins().fY), fMousedCtrl->GetKeyName().c_str(), (uint32_t)0xffffff00 ); } #endif diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.cpp index bc5c84c6..6728b07a 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIEditBoxMod.cpp @@ -388,7 +388,7 @@ bool pfGUIEditBoxMod::HandleKeyEvent( pfGameGUIMgr::EventType event, plKeyDef { if (key == KEY_C) { - plClipboard::GetInstance().SetClipboardText(_TEMP_CONVERT_FROM_WCHAR_T(fBuffer)); + plClipboard::GetInstance().SetClipboardText(plString::FromWchar(fBuffer)); } else if (key == KEY_V) { diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp index aea1fd26..eccf512c 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIMultiLineEditCtrl.cpp @@ -1113,7 +1113,7 @@ bool pfGUIMultiLineEditCtrl::HandleKeyEvent( pfGameGUIMgr::EventType event, p // Too lazy to worry about that... if (key == KEY_C) { - plClipboard::GetInstance().SetClipboardText(_TEMP_CONVERT_FROM_WCHAR_T(fBuffer.AcquireArray())); + plClipboard::GetInstance().SetClipboardText(plString::FromWchar(fBuffer.AcquireArray())); } else if (key == KEY_V) { diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.cpp index 9df6032a..b090c37d 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.cpp @@ -121,8 +121,8 @@ void pfGUITextBoxMod::IUpdate( void ) fDynTextMap->ClearToColor( GetColorScheme()->fBackColor ); std::wstring drawStr; - if (fUseLocalizationPath && !fLocalizationPath.empty() && pfLocalizationMgr::InstanceValid()) - drawStr = pfLocalizationMgr::Instance().GetString(fLocalizationPath.c_str()); + if (fUseLocalizationPath && !fLocalizationPath.IsEmpty() && pfLocalizationMgr::InstanceValid()) + drawStr = pfLocalizationMgr::Instance().GetString(fLocalizationPath.ToWchar().GetData()); else { if( fText != nil ) @@ -170,9 +170,7 @@ void pfGUITextBoxMod::Read( hsStream *s, hsResMgr *mgr ) fUseLocalizationPath = s->ReadBool(); if (fUseLocalizationPath) { - wchar_t* temp = s->ReadSafeWString(); - fLocalizationPath = temp; - delete [] temp; + fLocalizationPath = s->ReadSafeWString_TEMP(); } } @@ -192,11 +190,11 @@ void pfGUITextBoxMod::Write( hsStream *s, hsResMgr *mgr ) // Make sure we only write out to use localization path if the box is checked // and the path isn't empty - bool useLoc = fUseLocalizationPath && !fLocalizationPath.empty(); + bool useLoc = fUseLocalizationPath && !fLocalizationPath.IsEmpty(); s->WriteBool(useLoc); if (useLoc) - s->WriteSafeWString(fLocalizationPath.c_str()); + s->WriteSafeWString(fLocalizationPath); } //// HandleMouseDown/Up ////////////////////////////////////////////////////// @@ -240,22 +238,12 @@ void pfGUITextBoxMod::SetText( const wchar_t *text ) IUpdate(); } -void pfGUITextBoxMod::SetLocalizationPath(const wchar_t* path) +void pfGUITextBoxMod::SetLocalizationPath(const plString& path) { - if (path) + if (!path.IsNull()) fLocalizationPath = path; } -void pfGUITextBoxMod::SetLocalizationPath(const char* path) -{ - if (path) - { - wchar_t* wPath = hsStringToWString(path); - fLocalizationPath = wPath; - delete [] wPath; - } -} - void pfGUITextBoxMod::SetUseLocalizationPath(bool use) { fUseLocalizationPath = use; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.h b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.h index 621c360c..bde8a374 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.h +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUITextBoxMod.h @@ -59,7 +59,7 @@ class pfGUITextBoxMod : public pfGUIControlMod protected: wchar_t *fText; - std::wstring fLocalizationPath; + plString fLocalizationPath; bool fUseLocalizationPath; @@ -99,8 +99,7 @@ class pfGUITextBoxMod : public pfGUIControlMod void SetText( const char *text ); void SetText( const wchar_t *text ); - void SetLocalizationPath(const wchar_t* path); - void SetLocalizationPath(const char* path); + void SetLocalizationPath(const plString& path); void SetUseLocalizationPath(bool use); virtual void UpdateColorScheme() { IPostSetUpDynTextMap(); IUpdate(); } diff --git a/Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.cpp b/Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.cpp index 8650a3b6..7abcd867 100644 --- a/Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfGameScoreMgr/pfGameScoreMgr.cpp @@ -143,7 +143,7 @@ static void OnScoreCreate( int32_t value ) { ScoreUpdateParam* p = (ScoreUpdateParam*)param; - pfGameScore* score = new pfGameScore(scoreId, ownerId, _TEMP_CONVERT_FROM_LITERAL(gameName), gameType, value); + pfGameScore* score = new pfGameScore(scoreId, ownerId, gameName, gameType, value); pfGameScoreUpdateMsg* msg = new pfGameScoreUpdateMsg(result, score, value); msg->Send(p->fReceiver); delete p; @@ -165,7 +165,7 @@ static void OnScoreFound( for (uint32_t i = 0; i < scoreCount; ++i) { const NetGameScore ngs = scores[i]; - vec[i] = new pfGameScore(ngs.scoreId, ngs.ownerId, _TEMP_CONVERT_FROM_WCHAR_T(ngs.gameName), ngs.gameType, ngs.value); + vec[i] = new pfGameScore(ngs.scoreId, ngs.ownerId, plString::FromWchar(ngs.gameName), ngs.gameType, ngs.value); } ScoreFindParam* p = (ScoreFindParam*)param; diff --git a/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp b/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp index e1641973..0ff2c533 100644 --- a/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp +++ b/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp @@ -472,7 +472,7 @@ pfBookData::pfBookData(const plString &guiName /* = nil */) if (!guiName.IsEmpty()) fGUIName = guiName; else - fGUIName = _TEMP_CONVERT_FROM_LITERAL("BkBook"); + fGUIName = "BkBook"; } pfBookData::~pfBookData() @@ -1140,9 +1140,9 @@ std::map pfJournalBook::fBookGUIs; void pfJournalBook::SingletonInit( void ) { - fBookGUIs[_TEMP_CONVERT_FROM_LITERAL("BkBook")] = new pfBookData(); // load the default book data object - hsgResMgr::ResMgr()->NewKey(_TEMP_CONVERT_FROM_LITERAL("BkBook"),fBookGUIs[_TEMP_CONVERT_FROM_LITERAL("BkBook")],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation()); - fBookGUIs[_TEMP_CONVERT_FROM_LITERAL("BkBook")]->LoadGUI(); + fBookGUIs["BkBook"] = new pfBookData(); // load the default book data object + hsgResMgr::ResMgr()->NewKey("BkBook",fBookGUIs["BkBook"],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation()); + fBookGUIs["BkBook"]->LoadGUI(); } void pfJournalBook::SingletonShutdown( void ) @@ -1207,7 +1207,7 @@ pfJournalBook::pfJournalBook( const char *esHTMLSource, plKey coverImageKey, plK if (!guiName.IsEmpty()) fCurBookGUI = guiName; else - fCurBookGUI = _TEMP_CONVERT_FROM_LITERAL("BkBook"); + fCurBookGUI = "BkBook"; if (fBookGUIs.find(fCurBookGUI) == fBookGUIs.end()) { fBookGUIs[fCurBookGUI] = new pfBookData(fCurBookGUI); @@ -1243,7 +1243,7 @@ pfJournalBook::pfJournalBook( const wchar_t *esHTMLSource, plKey coverImageKey, if (!guiName.IsEmpty()) fCurBookGUI = guiName; else - fCurBookGUI = _TEMP_CONVERT_FROM_LITERAL("BkBook"); + fCurBookGUI = "BkBook"; if (fBookGUIs.find(fCurBookGUI) == fBookGUIs.end()) { fBookGUIs[fCurBookGUI] = new pfBookData(fCurBookGUI); @@ -1292,7 +1292,7 @@ void pfJournalBook::SetGUI( const plString &guiName ) if (!guiName.IsEmpty()) fCurBookGUI = guiName; if (fBookGUIs.find(fCurBookGUI) == fBookGUIs.end()) - fCurBookGUI = _TEMP_CONVERT_FROM_LITERAL("BkBook"); // requested GUI isn't loaded, so use default GUI + fCurBookGUI = "BkBook"; // requested GUI isn't loaded, so use default GUI SetEditable(fWantEditing); // make sure that if we want editing, to set it ICompileSource(fUncompiledSource.c_str(), fDefLoc); // recompile the source to be safe } @@ -2506,9 +2506,9 @@ plKey pfJournalBook::IGetMipmapKey( const wchar_t *name, const plLocation &loc // facilitate fast prototyping plMipmap *mip; if( cName.Find( ".png" ) >= 0 ) - mip = plPNG::Instance().ReadFromFile( _TEMP_CONVERT_TO_CONST_CHAR( cName ) ); + mip = plPNG::Instance().ReadFromFile( cName.c_str() ); else - mip = plJPEG::Instance().ReadFromFile( _TEMP_CONVERT_TO_CONST_CHAR( cName ) ); + mip = plJPEG::Instance().ReadFromFile( cName.c_str() ); hsgResMgr::ResMgr()->NewKey( cName, mip, loc ); return mip->GetKey(); diff --git a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.cpp b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.cpp index f73c74d0..205e8ec6 100644 --- a/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfLocalizationMgr/pfLocalizationDataMgr.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plResMgr/plLocalization.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "plFile/plEncryptedStream.h" #include "plStatusLog/plStatusLog.h" diff --git a/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.cpp b/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.cpp index bf8bb474..12ddcc60 100644 --- a/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.cpp +++ b/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.cpp @@ -49,18 +49,3 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com const char* pfKIMsg::kChronicleKILevel = "PlayerKILevel"; - -void pfKIMsg::SetString( const char *str ) -{ - wchar_t *temp = hsStringToWString( str ); - fString = temp; - delete [] temp; -} - -std::string pfKIMsg::GetString( void ) -{ - char *temp = hsWStringToString( fString.c_str() ); - std::string retVal = temp; - delete [] temp; - return retVal; -} diff --git a/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h b/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h index 190dcdd4..f7155e5b 100644 --- a/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h +++ b/Sources/Plasma/FeatureLib/pfMessage/pfKIMsg.h @@ -67,7 +67,7 @@ class pfKIMsg : public plMessage // for the hack chat message thingy char *fUser; uint32_t fPlayerID; - std::wstring fString; + plString fString; // for the SetChatFadeDelay float fDelay; @@ -78,7 +78,7 @@ class pfKIMsg : public plMessage void IInit() { fCommand = kNoCommand; - fString = L""; + fString = ""; fUser = nil; fPlayerID = 0; fFlags = 0; @@ -192,14 +192,7 @@ class pfKIMsg : public plMessage s->ReadLE( &fCommand ); fUser = s->ReadSafeString(); fPlayerID = s->ReadLE32(); - - wchar_t *temp = s->ReadSafeWString(); - if (temp) // apparently ReadSafeWString can return null, which std::wstring doesn't like being assigned - fString = temp; - else - fString = L""; - delete [] temp; - + fString = s->ReadSafeWString_TEMP(); fFlags = s->ReadLE32(); fDelay = s->ReadLEScalar(); fValue = s->ReadLE32(); @@ -211,31 +204,29 @@ class pfKIMsg : public plMessage s->WriteLE( fCommand ); s->WriteSafeString( fUser ); s->WriteLE32( fPlayerID ); - s->WriteSafeWString( fString.c_str() ); + s->WriteSafeWString( fString ); s->WriteLE32( fFlags ); s->WriteLEScalar(fDelay); s->WriteLE32( fValue ); } - uint8_t GetCommand( void ) const { return fCommand; } + uint8_t GetCommand( void ) const { return fCommand; } - void SetString( const char *str ); - void SetString( const wchar_t *str ) { fString = str; } - std::string GetString( void ); - std::wstring GetStringU( void ) { return fString; } + void SetString( const plString &str ) { fString = str; } + plString GetString( void ) { return fString; } void SetUser( const char *str, uint32_t pid=0 ) { fUser = hsStrcpy( str ); fPlayerID = pid; } const char *GetUser( void ) { return fUser; } - uint32_t GetPlayerID( void ) { return fPlayerID; } + uint32_t GetPlayerID( void ) { return fPlayerID; } void SetFlags( uint32_t flags ) { fFlags = flags; } - uint32_t GetFlags( void ) const { return fFlags; } + uint32_t GetFlags( void ) const { return fFlags; } void SetDelay( float delay ) { fDelay = delay; } - float GetDelay( void ) { return fDelay; } + float GetDelay( void ) { return fDelay; } void SetIntValue( int32_t value ) { fValue = value; } - int32_t GetIntValue( void ) { return fValue; } + int32_t GetIntValue( void ) { return fValue; } #endif // def KI_CONSTANTS_ONLY }; diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp index 2c3a599a..1efb9e2e 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp @@ -1127,7 +1127,7 @@ uint32_t cyMisc::SendRTChat(pyPlayer& from, const std::vector & tolis { // create the messge that will contain the chat message pfKIMsg *msg = new pfKIMsg( pfKIMsg::kHACKChatMsg ); - msg->SetString( message ); + msg->SetString( plString::FromWchar(message) ); msg->SetUser( from.GetPlayerName(), from.GetPlayerID() ); msg->SetFlags( flags ); msg->SetBCastFlag(plMessage::kNetPropagate | plMessage::kNetForce); @@ -1199,7 +1199,7 @@ void cyMisc::SendKIMessageS(uint32_t command, const wchar_t* value) // create the mesage to send pfKIMsg *msg = new pfKIMsg( (uint8_t)command ); - msg->SetString( value ); + msg->SetString( plString::FromWchar( value ) ); // send it off plgDispatch::MsgSend( msg ); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp index 8fcf12f4..94a75835 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp @@ -115,7 +115,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtGetClientName, args, "Params: avatarKey=None\n PYTHON_RETURN_ERROR; } pyKey* key = pyKey::ConvertFrom(keyObj); - return PyString_FromString(cyMisc::GetClientName(*key).s_str()); + return PyString_FromString(cyMisc::GetClientName(*key).c_str()); } else return PyString_FromString(cyMisc::GetLocalClientName().c_str()); diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp index fb3ee21d..63d97889 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp @@ -1862,7 +1862,7 @@ bool plPythonFileMod::MsgReceive(plMessage* msg) // yes... // find the value that would go with a command PyObject* value; - std::wstring str; + plStringBuffer str; switch (pkimsg->GetCommand()) { case pfKIMsg::kSetChatFadeDelay: @@ -1873,8 +1873,8 @@ bool plPythonFileMod::MsgReceive(plMessage* msg) break; case pfKIMsg::kYesNoDialog: value = PyTuple_New(2); - str = pkimsg->GetStringU(); - PyTuple_SetItem(value, 0, PyUnicode_FromWideChar(str.c_str(), str.length())); + str = pkimsg->GetString().ToWchar(); + PyTuple_SetItem(value, 0, PyUnicode_FromWideChar(str, str.GetSize())); PyTuple_SetItem(value, 1, pyKey::New(pkimsg->GetSender())); break; case pfKIMsg::kGZInRange: @@ -1884,23 +1884,23 @@ bool plPythonFileMod::MsgReceive(plMessage* msg) break; case pfKIMsg::kRateIt: value = PyTuple_New(3); - str = pkimsg->GetStringU(); + str = pkimsg->GetString().ToWchar(); PyTuple_SetItem(value,0,PyString_FromString(pkimsg->GetUser())); - PyTuple_SetItem(value,1,PyUnicode_FromWideChar(str.c_str(), str.length())); + PyTuple_SetItem(value,1,PyUnicode_FromWideChar(str, str.GetSize())); PyTuple_SetItem(value,2,PyLong_FromLong(pkimsg->GetIntValue())); break; case pfKIMsg::kRegisterImager: value = PyTuple_New(2); - str = pkimsg->GetStringU(); - PyTuple_SetItem(value, 0, PyUnicode_FromWideChar(str.c_str(), str.length())); + str = pkimsg->GetString().ToWchar(); + PyTuple_SetItem(value, 0, PyUnicode_FromWideChar(str, str.GetSize())); PyTuple_SetItem(value, 1, pyKey::New(pkimsg->GetSender())); break; case pfKIMsg::kAddPlayerDevice: case pfKIMsg::kRemovePlayerDevice: { - str = pkimsg->GetStringU(); - if ( str.length() > 0 ) - value = PyUnicode_FromWideChar(str.c_str(), str.length()); + str = pkimsg->GetString().ToWchar(); + if ( str.GetSize() > 0 ) + value = PyUnicode_FromWideChar(str, str.GetSize()); else { Py_INCREF(Py_None); @@ -1915,8 +1915,8 @@ bool plPythonFileMod::MsgReceive(plMessage* msg) case pfKIMsg::kKIOKDialogNoQuit: case pfKIMsg::kGZFlashUpdate: case pfKIMsg::kKICreateMarkerNode: - str = pkimsg->GetStringU(); - value = PyUnicode_FromWideChar(str.c_str(), str.length()); + str = pkimsg->GetString().ToWchar(); + value = PyUnicode_FromWideChar(str, str.GetSize()); break; case pfKIMsg::kMGStartCGZGame: case pfKIMsg::kMGStopCGZGame: @@ -2905,7 +2905,7 @@ bool plPythonFileMod::MsgReceive(plMessage* msg) void plPythonFileMod::ReportError() { plString objectName = this->GetKeyName(); - objectName += _TEMP_CONVERT_FROM_LITERAL(" - "); + objectName += " - "; PythonInterface::WriteToStdErr(objectName.c_str()); @@ -3050,4 +3050,4 @@ void plPythonFileMod::Write(hsStream* stream, hsResMgr* mgr) //// kGlobalNameKonstant ///////////////////////////////////////////////// // My continued attempt to spread the CORRECT way to spell konstant. -mcn -plString plPythonFileMod::kGlobalNameKonstant = _TEMP_CONVERT_FROM_LITERAL("VeryVerySpecialPythonFileMod"); +plString plPythonFileMod::kGlobalNameKonstant("VeryVerySpecialPythonFileMod"); diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonPack.cpp b/Sources/Plasma/FeatureLib/pfPython/plPythonPack.cpp index b23d3483..e6a4a253 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonPack.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonPack.cpp @@ -54,7 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plPythonPack.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "plFile/plSecureStream.h" #include "plFile/plStreamSource.h" diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h b/Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h index 210c576e..a089b1ad 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h @@ -376,10 +376,11 @@ public: count = stream->ReadLE32(); if ( count != 0 ) { - char *buffer = new char[count]; + plStringBuffer str; + char *buffer = str.CreateWritableBuffer(count-1); stream->ReadLE(count, buffer); buffer[count-1] = 0; - fString = plString::Steal(buffer, count); + fString = str; } else fString = plString::Null; @@ -433,8 +434,7 @@ public: else count = 0; stream->WriteLE(count); - if ( count != 0 ) - stream->WriteLE(count, fString.c_str()); + stream->WriteLE(count, fString.c_str()); break; case kSceneObject: diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp b/Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp index 8cdc337e..a06811fd 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp @@ -607,7 +607,7 @@ const plPythonSDLModifier* plPythonSDLModifier::FindAgeSDL() return sdlMod; plNetClientApp::StaticErrorMsg("pfmod %s has a nil python SDL modifier for age sdl %s", - pfmod->GetKeyName().s_str("?"), ageName); + pfmod->GetKeyName().c_str("?"), ageName); } else { @@ -616,11 +616,11 @@ const plPythonSDLModifier* plPythonSDLModifier::FindAgeSDL() else if (!key->ObjectIsLoaded()) plNetClientApp::StaticErrorMsg("key %s not loaded for age sdl %s", - key->GetName().s_str("?"), ageName); + key->GetName().c_str("?"), ageName); else if (!plPythonFileMod::ConvertNoRef(key->ObjectIsLoaded())) plNetClientApp::StaticErrorMsg("key %s is not a python file mod for age sdl %s", - key->GetName().s_str("?"), ageName); + key->GetName().c_str("?"), ageName); } } else diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h index 9f8f5b00..bd7b49a9 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h @@ -51,6 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyGUIControl.h" #include "pyGlueHelpers.h" +#include class pyColor; class pfGUIColorScheme; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.h b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.h index 20d8c184..7298e925 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyGUIPopUpMenu.h @@ -52,6 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnKeyedObject/plKey.h" #include "pyGlueHelpers.h" #include "pnKeyedObject/plUoid.h" +#include class pfGUIPopUpMenu; class pyColor; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyGameScoreMsg.cpp b/Sources/Plasma/FeatureLib/pfPython/pyGameScoreMsg.cpp index c1c1289a..61cefafd 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyGameScoreMsg.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyGameScoreMsg.cpp @@ -61,8 +61,8 @@ PyObject* pyGameScoreMsg::CreateFinal(pfGameScoreMsg* msg) plString pyGameScoreMsg::GetError() const { if (fMsg) - return _TEMP_CONVERT_FROM_WCHAR_T(NetErrorToString(fMsg->GetResult())); - return _TEMP_CONVERT_FROM_LITERAL("pfGameScoreMsg is NULL"); + return plString::FromWchar(NetErrorToString(fMsg->GetResult())); + return "pfGameScoreMsg is NULL"; } bool pyGameScoreMsg::IsValid() const diff --git a/Sources/Plasma/FeatureLib/pfPython/pyImageGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyImageGlue.cpp index b4ef50d9..b5567e1d 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyImageGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyImageGlue.cpp @@ -291,7 +291,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtLoadJPEGFromDisk, args, "Params: filename,widt if (PyString_CheckEx(filenameObj)) { plString text = PyString_AsStringEx(filenameObj); - PyObject* ret = pyImage::LoadJPEGFromDisk(_TEMP_CONVERT_TO_WCHAR_T(text), width, height); + PyObject* ret = pyImage::LoadJPEGFromDisk(text.ToWchar(), width, height); return ret; } else @@ -313,7 +313,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtLoadPNGFromDisk, args, "Params: filename,width if (PyString_CheckEx(filenameObj)) { plString text = PyString_AsStringEx(filenameObj); - PyObject* ret = pyImage::LoadPNGFromDisk(_TEMP_CONVERT_TO_WCHAR_T(text), width, height); + PyObject* ret = pyImage::LoadPNGFromDisk(text.ToWchar(), width, height); return ret; } else diff --git a/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h b/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h index 3df7246c..6dc6e1ab 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com ////////////////////////////////////////////////////////////////////// #include "pyGlueHelpers.h" -#include +#include class cyAnimation; class pyImage; @@ -84,8 +84,8 @@ public: // required functions for PyObject interoperability PYTHON_CLASS_NEW_FRIEND(ptBook); - static PyObject *New(std::string htmlSource, plKey coverImageKey = nil, plKey callbackKey = nil, plString guiName = _TEMP_CONVERT_FROM_LITERAL("")); - static PyObject *New(std::wstring htmlSource, plKey coverImageKey = nil, plKey callbackKey = nil, plString guiName = _TEMP_CONVERT_FROM_LITERAL("")); + static PyObject *New(std::string htmlSource, plKey coverImageKey = nil, plKey callbackKey = nil, plString guiName = ""); + static PyObject *New(std::wstring htmlSource, plKey coverImageKey = nil, plKey callbackKey = nil, plString guiName = ""); PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyJournalBook object PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyJournalBook); // converts a PyObject to a pyJournalBook (throws error if not correct type) @@ -94,8 +94,8 @@ public: static void AddPlasmaConstantsClasses(PyObject *m); // Deletes the existing book and re-creates it, for use by the python glue - void MakeBook(std::string esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, plString guiName = _TEMP_CONVERT_FROM_LITERAL("")); - void MakeBook(std::wstring esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, plString guiName = _TEMP_CONVERT_FROM_LITERAL("")); + void MakeBook(std::string esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, plString guiName = ""); + void MakeBook(std::wstring esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, plString guiName = ""); // Interface functions per book virtual void Show( bool startOpened ); diff --git a/Sources/Plasma/FeatureLib/pfPython/pyPlayer.h b/Sources/Plasma/FeatureLib/pfPython/pyPlayer.h index 45e67865..7babf5f5 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyPlayer.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyPlayer.h @@ -51,6 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyGlueHelpers.h" #include "pnKeyedObject/plKey.h" +#include class pyPlayer { diff --git a/Sources/Plasma/FeatureLib/pfPython/pyPlayerGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyPlayerGlue.cpp index 2ba45171..190ceadc 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyPlayerGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyPlayerGlue.cpp @@ -103,7 +103,7 @@ PYTHON_INIT_DEFINITION(ptPlayer, args, keywords) PYTHON_RETURN_INIT_ERROR; } - self->fThis->Init(key, _TEMP_CONVERT_TO_CONST_CHAR(name), pid, distSeq); + self->fThis->Init(key, name.c_str(), pid, distSeq); PYTHON_RETURN_INIT_OK; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pySceneObject.cpp b/Sources/Plasma/FeatureLib/pfPython/pySceneObject.cpp index a2cff79c..0fce342f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySceneObject.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pySceneObject.cpp @@ -223,7 +223,7 @@ plString pySceneObject::GetName() { if ( fSceneObjects.Count() > 0 ) return fSceneObjects[0]->GetName(); - return _TEMP_CONVERT_FROM_LITERAL(""); + return ""; } PyObject* pySceneObject::findObj(const plString& name) diff --git a/Sources/Plasma/FeatureLib/pfPython/pySceneObject.h b/Sources/Plasma/FeatureLib/pfPython/pySceneObject.h index da952e35..9a257736 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySceneObject.h +++ b/Sources/Plasma/FeatureLib/pfPython/pySceneObject.h @@ -52,6 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pyGlueHelpers.h" #include "pnKeyedObject/plKey.h" #include "hsTemplates.h" +#include class pyMatrix44; diff --git a/Sources/Plasma/FeatureLib/pfPython/pyStatusLog.cpp b/Sources/Plasma/FeatureLib/pfPython/pyStatusLog.cpp index c9e947b3..c459b2fa 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyStatusLog.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyStatusLog.cpp @@ -72,7 +72,7 @@ bool pyStatusLog::Open(plString logName, uint32_t numLines, uint32_t flags) // create a status log guy for this fICreatedLog = true; - fLog = plStatusLogMgr::GetInstance().CreateStatusLog( (uint8_t)numLines, _TEMP_CONVERT_TO_CONST_CHAR(logName), flags ); + fLog = plStatusLogMgr::GetInstance().CreateStatusLog( (uint8_t)numLines, logName.c_str(), flags ); if (fLog) { fLog->SetForceLog(true); @@ -85,7 +85,7 @@ bool pyStatusLog::Write(plString text) { if (fLog) { - fLog->AddLine(_TEMP_CONVERT_TO_CONST_CHAR(text)); + fLog->AddLine(text.c_str()); return true; } @@ -100,7 +100,7 @@ bool pyStatusLog::WriteColor(plString text, pyColor& color) ((uint32_t)(color.getRed()*255)<<16) + ((uint32_t)(color.getGreen()*255)<<8) + ((uint32_t)(color.getBlue()*255)); - fLog->AddLine( _TEMP_CONVERT_TO_CONST_CHAR(text), st_color ); + fLog->AddLine( text.c_str(), st_color ); return true; } diff --git a/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp b/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp index d8c219ac..82284a3c 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyVault.cpp @@ -673,8 +673,8 @@ void pyVault::CreateNeighborhood() plUUID guid(GuidGenerate()); link.GetAgeInfo()->SetAgeInstanceGuid(&guid); - link.GetAgeInfo()->SetAgeUserDefinedName( _TEMP_CONVERT_TO_CONST_CHAR(title) ); - link.GetAgeInfo()->SetAgeDescription( _TEMP_CONVERT_TO_CONST_CHAR(desc) ); + link.GetAgeInfo()->SetAgeUserDefinedName( title.c_str() ); + link.GetAgeInfo()->SetAgeDescription( desc.c_str() ); VaultRegisterOwnedAge(&link); } diff --git a/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp b/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp index 33f0405a..0c264fb7 100644 --- a/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp +++ b/Sources/Plasma/FeatureLib/pfSecurePreloader/pfSecurePreloader.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plgDispatch.h" #include "plCompression/plZlibStream.h" #include "pnEncryption/plChecksum.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" #include "plFile/plSecureStream.h" #include "plFile/plStreamSource.h" #include "plMessage/plNetCommMsgs.h" diff --git a/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp b/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp index ff124551..966cd91a 100644 --- a/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp +++ b/Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp @@ -341,7 +341,7 @@ void plDispatch::IMsgDispatch() uint32_t rcvTicks = hsTimer::GetPrecTickCount(); // Object could be deleted by this message, so we need to log this stuff now - plString keyname = _TEMP_CONVERT_FROM_LITERAL("(unknown)"); + plString keyname = "(unknown)"; const char* className = "(unknown)"; uint32_t clonePlayerID = 0; if (plDispatchLogBase::IsLoggingLong()) diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/hsKeyedObject.cpp b/Sources/Plasma/NucleusLib/pnKeyedObject/hsKeyedObject.cpp index e6a729b0..4ad13c11 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/hsKeyedObject.cpp +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/hsKeyedObject.cpp @@ -70,7 +70,7 @@ plString hsKeyedObject::GetKeyName() const if (fpKey) return fpKey->GetName(); else - return _TEMP_CONVERT_FROM_LITERAL("(unknown)"); + return "(unknown)"; } hsKeyedObject::~hsKeyedObject() @@ -145,7 +145,7 @@ void hsKeyedObject::UnRegisterAsManual(plUoid& inUoid) #if !HS_BUILD_FOR_UNIX // disable for unix servers hsAssert(false, plString::Format("Request to Unregister wrong FixedKey, keyName=%s, inUoid=%s, myUoid=%s", - fpKey->GetName().s_str("?"), inUoid.StringIze().c_str(), myUoid.StringIze().c_str()).c_str()); + fpKey->GetName().c_str("?"), inUoid.StringIze().c_str(), myUoid.StringIze().c_str()).c_str()); #endif } ((plKeyImp*)fpKey)->UnRegister(); diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp b/Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp index fa39c127..491dac96 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp @@ -82,48 +82,47 @@ struct plKeySeed // 2) Be sure your ClassIndex CLASS_INDEX(plSceneObject) matches the type of object you want to have the fixedKey // 3) Make sure the Obj is unique for this location/Type Combo... (validated at runtime) -#define _TCFL _TEMP_CONVERT_FROM_LITERAL plKeySeed SeedList[] = { // Key Enum Type Obj - { kFirst_Fixed_KEY, CLASS_INDEX_SCOPED( plSceneObject ), _TCFL("kFirst_Fixed_KEY") }, - - { kLOSObject_KEY, CLASS_INDEX_SCOPED( plLOSDispatch ), _TCFL("kLOSObject_KEY"), }, - { kTimerCallbackManager_KEY, CLASS_INDEX_SCOPED( plTimerCallbackManager ), _TCFL("kTimerCallbackManager_KEY"), }, - { kConsoleObject_KEY, CLASS_INDEX_SCOPED( pfConsole ), _TCFL("kConsoleObject_KEY"), }, - { kAudioSystem_KEY, CLASS_INDEX_SCOPED( plAudioSystem ), _TCFL("kAudioSystem_KEY"), }, - { kInput_KEY, CLASS_INDEX_SCOPED( plInputManager ), _TCFL("kInput_KEY"), }, - { kClient_KEY, CLASS_INDEX_SCOPED( plClient ), _TCFL("kClient_KEY"), }, - { kNetClientMgr_KEY, CLASS_INDEX_SCOPED( plNetClientMgr ), _TCFL("kNetClientMgr_KEY"), }, - { kListenerMod_KEY, CLASS_INDEX_SCOPED( plListener ), _TCFL("kListenerMod_KEY"), }, - { kTransitionMgr_KEY, CLASS_INDEX_SCOPED( plTransitionMgr ), _TCFL("kTransitionMgr_KEY"), }, - { kLinkEffectsMgr_KEY, CLASS_INDEX_SCOPED( plLinkEffectsMgr ), _TCFL("kLinkEffectsMgr_KEY"), }, - { kGameGUIMgr_KEY, CLASS_INDEX_SCOPED( pfGameGUIMgr ), _TCFL("kGameGUIMgr_KEY"), }, - { kGameGUIDynamicDlg_KEY, CLASS_INDEX_SCOPED( plSceneNode ), _TCFL("kGameGUIDynamicDlg_KEY"), }, - { kVirtualCamera1_KEY, CLASS_INDEX_SCOPED( plVirtualCam1 ), _TCFL("kVirtualCamera_KEY"), }, - { kDefaultCameraMod1_KEY, CLASS_INDEX_SCOPED( plCameraModifier1 ), _TCFL("kDefaultCameraMod1_KEY"), }, - { kKIGUIGlue_KEY, CLASS_INDEX_SCOPED( pfKI ), _TCFL("kKIGUIGlue_KEY"), }, - { kClothingMgr_KEY, CLASS_INDEX_SCOPED( plClothingMgr ), _TCFL("kClothingMgr_KEY"), }, - { kInputInterfaceMgr_KEY, CLASS_INDEX_SCOPED( plInputInterfaceMgr ), _TCFL("kInputInterfaceMgr_KEY"), }, - { kAVIWriter_KEY, CLASS_INDEX_SCOPED( plAVIWriter ), _TCFL("kAVIWriter_KEY"), }, - { kResManagerHelper_KEY, CLASS_INDEX_SCOPED( plResManagerHelper ), _TCFL("kResManagerHelper_KEY"), }, - { kAvatarMgr_KEY, CLASS_INDEX_SCOPED( plAvatarMgr ), _TCFL("kAvatarMgr_KEY"), }, - { kSimulationMgr_KEY, CLASS_INDEX_SCOPED( plSimulationMgr ), _TCFL("kSimulationMgr_KEY"), }, - { kTransitionCamera_KEY, CLASS_INDEX_SCOPED( plCameraModifier1 ), _TCFL("kTransitionCamera_KEY"), }, - { kCCRMgr_KEY, CLASS_INDEX_SCOPED( plCCRMgr ), _TCFL("kCCRMgr_KEY"), }, - { kNetClientCloneRoom_KEY, CLASS_INDEX_SCOPED( plSceneNode ), _TCFL("kNetClientCloneRoom_KEY"), }, - { kMarkerMgr_KEY, CLASS_INDEX_SCOPED( pfMarkerMgr ), _TCFL("kMarkerMgr_KEY"), }, - { kAutoProfile_KEY, CLASS_INDEX_SCOPED( plAutoProfile ), _TCFL("kAutoProfile_KEY"), }, - { kGlobalVisMgr_KEY, CLASS_INDEX_SCOPED( plVisMgr ), _TCFL("kGlobalVisMgr_KEY"), }, - { kFontCache_KEY, CLASS_INDEX_SCOPED( plFontCache ), _TCFL("kFontCache_KEY"), }, - { kRelevanceMgr_KEY, CLASS_INDEX_SCOPED( plRelevanceMgr ), _TCFL("kRelevanceMgr_KEY"), }, - { kJournalBookMgr_KEY, CLASS_INDEX_SCOPED( pfJournalBook ), _TCFL("kJournalBookMgr_KEY") }, - { kAgeLoader_KEY, CLASS_INDEX_SCOPED( plAgeLoader), _TCFL("kAgeLoader_KEY") }, - { kBuiltIn3rdPersonCamera_KEY, CLASS_INDEX_SCOPED( plCameraModifier1 ), _TCFL("kBuiltIn3rdPersonCamera_KEY"), }, - { kSecurePreloader_KEY, CLASS_INDEX_SCOPED( pfSecurePreloader ), _TCFL("kSecurePreloader_KEY"), }, + { kFirst_Fixed_KEY, CLASS_INDEX_SCOPED( plSceneObject ), "kFirst_Fixed_KEY", }, + + { kLOSObject_KEY, CLASS_INDEX_SCOPED( plLOSDispatch ), "kLOSObject_KEY", }, + { kTimerCallbackManager_KEY, CLASS_INDEX_SCOPED( plTimerCallbackManager ), "kTimerCallbackManager_KEY", }, + { kConsoleObject_KEY, CLASS_INDEX_SCOPED( pfConsole ), "kConsoleObject_KEY", }, + { kAudioSystem_KEY, CLASS_INDEX_SCOPED( plAudioSystem ), "kAudioSystem_KEY", }, + { kInput_KEY, CLASS_INDEX_SCOPED( plInputManager ), "kInput_KEY", }, + { kClient_KEY, CLASS_INDEX_SCOPED( plClient ), "kClient_KEY", }, + { kNetClientMgr_KEY, CLASS_INDEX_SCOPED( plNetClientMgr ), "kNetClientMgr_KEY", }, + { kListenerMod_KEY, CLASS_INDEX_SCOPED( plListener ), "kListenerMod_KEY", }, + { kTransitionMgr_KEY, CLASS_INDEX_SCOPED( plTransitionMgr ), "kTransitionMgr_KEY", }, + { kLinkEffectsMgr_KEY, CLASS_INDEX_SCOPED( plLinkEffectsMgr ), "kLinkEffectsMgr_KEY", }, + { kGameGUIMgr_KEY, CLASS_INDEX_SCOPED( pfGameGUIMgr ), "kGameGUIMgr_KEY", }, + { kGameGUIDynamicDlg_KEY, CLASS_INDEX_SCOPED( plSceneNode ), "kGameGUIDynamicDlg_KEY", }, + { kVirtualCamera1_KEY, CLASS_INDEX_SCOPED( plVirtualCam1 ), "kVirtualCamera_KEY", }, + { kDefaultCameraMod1_KEY, CLASS_INDEX_SCOPED( plCameraModifier1 ), "kDefaultCameraMod1_KEY", }, + { kKIGUIGlue_KEY, CLASS_INDEX_SCOPED( pfKI ), "kKIGUIGlue_KEY", }, + { kClothingMgr_KEY, CLASS_INDEX_SCOPED( plClothingMgr ), "kClothingMgr_KEY", }, + { kInputInterfaceMgr_KEY, CLASS_INDEX_SCOPED( plInputInterfaceMgr ), "kInputInterfaceMgr_KEY", }, + { kAVIWriter_KEY, CLASS_INDEX_SCOPED( plAVIWriter ), "kAVIWriter_KEY", }, + { kResManagerHelper_KEY, CLASS_INDEX_SCOPED( plResManagerHelper ), "kResManagerHelper_KEY", }, + { kAvatarMgr_KEY, CLASS_INDEX_SCOPED( plAvatarMgr ), "kAvatarMgr_KEY", }, + { kSimulationMgr_KEY, CLASS_INDEX_SCOPED( plSimulationMgr ), "kSimulationMgr_KEY", }, + { kTransitionCamera_KEY, CLASS_INDEX_SCOPED( plCameraModifier1 ), "kTransitionCamera_KEY", }, + { kCCRMgr_KEY, CLASS_INDEX_SCOPED( plCCRMgr ), "kCCRMgr_KEY", }, + { kNetClientCloneRoom_KEY, CLASS_INDEX_SCOPED( plSceneNode ), "kNetClientCloneRoom_KEY", }, + { kMarkerMgr_KEY, CLASS_INDEX_SCOPED( pfMarkerMgr ), "kMarkerMgr_KEY", }, + { kAutoProfile_KEY, CLASS_INDEX_SCOPED( plAutoProfile ), "kAutoProfile_KEY", }, + { kGlobalVisMgr_KEY, CLASS_INDEX_SCOPED( plVisMgr ), "kGlobalVisMgr_KEY", }, + { kFontCache_KEY, CLASS_INDEX_SCOPED( plFontCache ), "kFontCache_KEY", }, + { kRelevanceMgr_KEY, CLASS_INDEX_SCOPED( plRelevanceMgr ), "kRelevanceMgr_KEY", }, + { kJournalBookMgr_KEY, CLASS_INDEX_SCOPED( pfJournalBook ), "kJournalBookMgr_KEY", }, + { kAgeLoader_KEY, CLASS_INDEX_SCOPED( plAgeLoader), "kAgeLoader_KEY", }, + { kBuiltIn3rdPersonCamera_KEY, CLASS_INDEX_SCOPED( plCameraModifier1 ), "kBuiltIn3rdPersonCamera_KEY", }, + { kSecurePreloader_KEY, CLASS_INDEX_SCOPED( pfSecurePreloader ), "kSecurePreloader_KEY", }, - { kLast_Fixed_KEY, CLASS_INDEX_SCOPED( plSceneObject ), _TCFL("kLast_Fixed_KEY"), } + { kLast_Fixed_KEY, CLASS_INDEX_SCOPED( plSceneObject ), "kLast_Fixed_KEY", } }; #undef _TCFL diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp b/Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp index 9ecae204..e4742937 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp @@ -68,7 +68,7 @@ static uint16_t kClassType = CLASS_INDEX_SCOPED(plSceneNode); static uint32_t kCloneID = 0; bool IsTrackedKey(const plKeyImp* key) { - return (strcmp(key->GetName(), kObjName) == 0) && + return (key->GetName() == kObjName) && key->GetUoid().GetClassType() == kClassType && key->GetUoid().GetCloneID() == kCloneID; } @@ -348,7 +348,7 @@ void plKeyImp::AddNotifyCreated(plRefMsg* msg, plRefFlags::Type flags) #ifdef LOG_ACTIVE_REFS if (IsTrackedKey(this)) { - hsStatusMessageF("@@@ %s(%s) adding active ref to %s (%d total)", msg->GetReceiver(0)->GetName(), + hsStatusMessageF("@@@ %s(%s) adding active ref to %s (%d total)", msg->GetReceiver(0)->GetName().c_str(), plFactory::GetNameOfClass(msg->GetReceiver(0)->GetUoid().GetClassType()), kObjName, fNumActiveRefs+1); } #endif // LOG_ACTIVE_REFS @@ -635,7 +635,8 @@ void plKeyImp::IRelease(plKeyImp* iTargetKey) // it has been notified it is going away. #ifdef LOG_ACTIVE_REFS if (isActive && IsTrackedKey(iTargetKey)) - hsStatusMessageF("@@@ %s(%s) releasing active ref on %s (%d total)", GetName(), plFactory::GetNameOfClass(GetUoid().GetClassType()), kObjName, iTargetKey->fNumActiveRefs-1); + hsStatusMessageF("@@@ %s(%s) releasing active ref on %s (%d total)", GetName().c_str(), + plFactory::GetNameOfClass(GetUoid().GetClassType()), kObjName, iTargetKey->fNumActiveRefs-1); #endif // LOG_ACTIVE_REFS if (isActive && iTargetKey->GetActiveRefs() && !iTargetKey->DecActiveRefs()) diff --git a/Sources/Plasma/NucleusLib/pnKeyedObject/plMsgForwarder.cpp b/Sources/Plasma/NucleusLib/pnKeyedObject/plMsgForwarder.cpp index 76aa5a7b..48ebb56e 100644 --- a/Sources/Plasma/NucleusLib/pnKeyedObject/plMsgForwarder.cpp +++ b/Sources/Plasma/NucleusLib/pnKeyedObject/plMsgForwarder.cpp @@ -142,13 +142,13 @@ bool plMsgForwarder::IForwardCallbackMsg(plMessage *msg) #if 0 hsStatusMessageF("Adding CBMsg, eventSender=%s, eventRemoteMsg=%d\n", - event->GetSender() ? event->GetSender()->GetName() : "nil", fc->fNetPropogate); + event->GetSender() ? event->GetSender()->GetName().c_str() : "nil", fc->fNetPropogate); #endif } } #if 0 hsStatusMessageF("Fwding CBMsg, sender=%s, remoteMsg=%d", - msg->GetSender() ? msg->GetSender()->GetName() : "nil", msg->HasBCastFlag(plMessage::kNetNonLocal)); + msg->GetSender() ? msg->GetSender()->GetName().c_str() : "nil", msg->HasBCastFlag(plMessage::kNetNonLocal)); #endif IForwardMsg(callbackMsg); diff --git a/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp b/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp index f7285ae6..dfee7765 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp +++ b/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp @@ -275,7 +275,7 @@ void plLogicModBase::UnTrigger() #ifdef HS_DEBUGGING char str[256]; sprintf(str, "LogicModifier %s is Un-triggering, activatorType=%d\n", - GetKeyName(), HasFlag(kTypeActivator)); + GetKeyName().c_str(), HasFlag(kTypeActivator)); plNetClientApp::GetInstance()->DebugMsg(str); #endif fNotify->SetSender(this->GetKey()); diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp index 40753af6..867ca85c 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp @@ -112,7 +112,7 @@ bool plUUID::ToString( plString & out ) const plUUIDHelper::CopyToNative( g, this ); char buf[40]; uuid_unparse( g, buf ); - out = _TEMP_CONVERT_FROM_LITERAL( buf ); + out = buf; return true; } diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp index 98f58772..7eb4fbd9 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Win32.cpp @@ -90,7 +90,7 @@ bool plUUID::FromString( const char * str ) bool plUUID::ToString( plString & out ) const { - out = _TEMP_CONVERT_FROM_LITERAL(""); + out = ""; unsigned char * ubuf; RPC_STATUS s; s = UuidToString( (GUID *) this, &ubuf ); diff --git a/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.cpp b/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.cpp index e7ae52e6..4d026bfc 100644 --- a/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.cpp +++ b/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.cpp @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAgeDescription.h" #include "hsStlUtils.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "plFile/plInitFileReader.h" #include "plFile/plEncryptedStream.h" #include "hsStringTokenizer.h" diff --git a/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.cpp b/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.cpp index 3922a853..6569aa14 100644 --- a/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.cpp +++ b/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeManifest.cpp @@ -51,8 +51,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAgeManifest.h" -#include "plFile/hsFiles.h" -#include "plFile/plFileUtils.h" +#include "hsFiles.h" +#include "plFileUtils.h" #include "plFile/plInitFileReader.h" #include "hsStringTokenizer.h" diff --git a/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp b/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp index ed421c79..752ea1be 100644 --- a/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp +++ b/Sources/Plasma/PubUtilLib/plAgeLoader/plResPatcher.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAgeLoader/plAgeLoader.h" #include "plCompression/plZlibStream.h" #include "pnEncryption/plChecksum.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" #include "plMessage/plResPatcherMsg.h" #include "pnNetBase/pnNbError.h" #include "plNetGameLib/plNetGameLib.h" diff --git a/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp index 4834ac40..e835d1db 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp @@ -163,7 +163,7 @@ void plSound::IUpdateDebugPlate( void ) fDebugPlate->SetPosition( -0.5, 0 ); fDebugPlate->SetDataRange( 0, 100, 100 ); fDebugPlate->SetColors( 0x80202000 ); - fDebugPlate->SetTitle( _TEMP_CONVERT_TO_CONST_CHAR( GetKeyName() ) ); // Bleah + fDebugPlate->SetTitle( GetKeyName().c_str() ); // Bleah fDebugPlate->SetLabelText( "Desired", "Curr", "Soft", "Dist" ); } @@ -190,7 +190,7 @@ void plSound::SetCurrDebugPlate( const plKey soundKey ) { fDebugPlate->ClearData(); fDebugPlate->SetVisible( true ); - fDebugPlate->SetTitle( _TEMP_CONVERT_TO_CONST_CHAR( fCurrDebugPlateSound->GetKeyName() ) ); // Bleah + fDebugPlate->SetTitle( fCurrDebugPlateSound->GetKeyName().c_str() ); // Bleah } } } diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp index 43034cd8..b9d3253c 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp @@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsGeometry3.h" #include "plgDispatch.h" #include "plProfile.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "plWin32Sound.h" #include "plWin32StreamingSound.h" diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp index d175f66c..50049644 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp @@ -55,8 +55,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAudioCore.h" //#include "hsTimer.h" -#include "plFile/hsFiles.h" -#include "plFile/plFileUtils.h" +#include "hsFiles.h" +#include "plFileUtils.h" #include "plUnifiedTime/plUnifiedTime.h" #include "plBufferedFileReader.h" #include "plCachedFileReader.h" diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp index 6b37058d..dd902a33 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plSoundBuffer.cpp @@ -49,8 +49,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plgDispatch.h" #include "hsResMgr.h" #include "pnMessage/plRefMsg.h" -#include "plFile/plFileUtils.h" -#include "plFile/hsFiles.h" +#include "plFileUtils.h" +#include "hsFiles.h" #include "plUnifiedTime/plUnifiedTime.h" #include "plStatusLog/plStatusLog.h" #include "hsTimer.h" diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp index 950c32f3..d8fd1333 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp @@ -78,8 +78,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // ///////////////////////////////////////////////////////////////////////////////////////// #ifdef TRACK_AG_ALLOCS -extern const char *gGlobalAnimName = nil; -extern const char *gGlobalChannelName = nil; +plString gGlobalAnimName; +plString gGlobalChannelName; #endif // TRACK_AG_ALLOCS ///////////////////////////////////////////////////////////////////////////////////////// @@ -172,7 +172,7 @@ plAGAnimInstance::plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master, fFadeBlend = fFadeAmp = false; #ifdef TRACK_AG_ALLOCS - gGlobalAnimName = nil; + gGlobalAnimName = ""; #endif // TRACK_AG_ALLOCS } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h index 51c2b219..edd259f7 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h @@ -261,8 +261,8 @@ protected: //#endif #ifdef TRACK_AG_ALLOCS -extern const char *gGlobalAnimName; -extern const char *gGlobalChannelName; +extern plString gGlobalAnimName; +extern plString gGlobalChannelName; void RegisterAGAlloc(plAGChannel *object, const char *chanName, const char *animName, uint16_t classIndex); void UnRegisterAGAlloc(plAGChannel *object); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.h b/Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.h index 2d6ea5ca..4c67ca45 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.h @@ -104,10 +104,6 @@ public: void SetChannelName(const plString &name); plString GetChannelName(); - // TEMP plString REVISIT - // Because I'm TOO LAZY to keep converting all these calls to SetChannelName - void SetChannelName(const char *name) { SetChannelName(_TEMP_CONVERT_FROM_LITERAL(name)); } - /** Optionally suppress the action of this applicator. The applicator can still be forced to apply using the force paramater of the Apply function. */ diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGChannel.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGChannel.cpp index 9aa7dbda..f31602ed 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGChannel.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGChannel.cpp @@ -61,7 +61,7 @@ plAGChannel::plAGChannel() { #ifdef TRACK_AG_ALLOCS fName = gGlobalAnimName; - RegisterAGAlloc(this, gGlobalChannelName, gGlobalAnimName, this->ClassIndex()); + RegisterAGAlloc(this, gGlobalChannelName.c_str(), gGlobalAnimName.c_str(), this->ClassIndex()); #endif // TRACK_AG_ALLOCS } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp index afacbd3b..42ff1d66 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp @@ -631,7 +631,7 @@ bool plAGMasterMod::MsgReceive(plMessage* msg) plString targetName = cmdMsg->GetAnimName(); if (targetName.IsNull()) - targetName = _TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME); + targetName = ENTIRE_ANIMATION_NAME; plAGAnimInstance *inst = FindAnimInstance(targetName); if (inst != nil) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp index c4986bfa..3b158848 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp @@ -277,7 +277,7 @@ plAGAnimInstance * plAnimStage::Attach(plArmatureMod *armature, plArmatureBrain if(fAnimInstance) { fAnimInstance->Stop(); // we'll be setting the time directly. - fAnimatedHandle = (fAnimInstance->GetAnimation()->GetChannel(_TEMP_CONVERT_FROM_LITERAL("Handle")) != nil); + fAnimatedHandle = (fAnimInstance->GetAnimation()->GetChannel("Handle") != nil); fAttached = true; // this is too early to send the enter notify. we're attached, but we may not // have faded in yet. diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp index 5dd9c555..018ccb09 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp @@ -663,7 +663,7 @@ void plArmatureMod::IInitDefaults() fDontPanicLink = false; fBodyAgeName = "GlobalAvatars"; fBodyFootstepSoundPage = "Audio"; - fAnimationPrefix = _TEMP_CONVERT_FROM_LITERAL("Male"); + fAnimationPrefix = "Male"; fUserStr = ""; } @@ -1034,7 +1034,7 @@ void plArmatureMod::PanicLink(bool playLinkOutAnim /* = true */) plString animName = MakeAnimationName("FallingLinkOut"); task->SetAnimName(animName); - task->SetMarkerName(_TEMP_CONVERT_FROM_LITERAL("touch")); + task->SetMarkerName("touch"); plAvTaskMsg *taskMsg = new plAvTaskMsg(GetKey(), GetKey(), task); taskMsg->Send(); @@ -1057,7 +1057,7 @@ void plArmatureMod::PersonalLink() plAvOneShotLinkTask *task = new plAvOneShotLinkTask; plString animName = MakeAnimationName("PersonalLink"); task->SetAnimName(animName); - task->SetMarkerName(_TEMP_CONVERT_FROM_LITERAL("touch")); + task->SetMarkerName("touch"); plAvTaskMsg *taskMsg = new plAvTaskMsg(GetKey(), GetKey(), task); taskMsg->SetBCastFlag(plMessage::kNetPropagate); @@ -1781,7 +1781,7 @@ void plArmatureMod::Read(hsStream * stream, hsResMgr *mgr) if (gLoc.IsValid()) { const plUoid &myUoid = GetKey()->GetUoid(); - plUoid SOUoid(gLoc, plSceneObject::Index(), _TEMP_CONVERT_FROM_LITERAL("FootstepSoundObject")); + plUoid SOUoid(gLoc, plSceneObject::Index(), "FootstepSoundObject"); fFootSoundSOKey = mgr->FindKey(SOUoid); if (fFootSoundSOKey) { @@ -1791,7 +1791,7 @@ void plArmatureMod::Read(hsStream * stream, hsResMgr *mgr) } // Add the effect to our effects manager - plUoid effectUoid(gLoc, plArmatureEffectFootSound::Index(), _TEMP_CONVERT_FROM_LITERAL("FootstepSounds") ); + plUoid effectUoid(gLoc, plArmatureEffectFootSound::Index(), "FootstepSounds"); plKey effectKey = mgr->FindKey(effectUoid); if (effectKey) { @@ -1802,7 +1802,7 @@ void plArmatureMod::Read(hsStream * stream, hsResMgr *mgr) mgr->AddViaNotify(effectKey, new plGenRefMsg(effectMgrKey, plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); // Get the linking sound - plUoid LinkUoid(gLoc, plSceneObject::Index(), _TEMP_CONVERT_FROM_LITERAL("LinkSoundSource")); + plUoid LinkUoid(gLoc, plSceneObject::Index(), "LinkSoundSource"); fLinkSoundSOKey = mgr->FindKey(LinkUoid); if (fLinkSoundSOKey) { @@ -1896,7 +1896,7 @@ void plArmatureMod::ICustomizeApplicator() { plArmatureModBase::ICustomizeApplicator(); - const plAGModifier *agMod = GetChannelMod(_TEMP_CONVERT_FROM_LITERAL("Bone_Root"), true); + const plAGModifier *agMod = GetChannelMod("Bone_Root", true); if (agMod) { // are there any applicators that manipulate the transform? @@ -2379,7 +2379,7 @@ bool plArmatureMod::FindMatchingGenericBrain(const char *names[], int count) plString plArmatureMod::MakeAnimationName(const char *baseName) const { - return fAnimationPrefix + _TEMP_CONVERT_FROM_LITERAL(baseName); + return fAnimationPrefix + baseName; } plString plArmatureMod::GetRootName() diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp index c9bf3a8f..5bf9747c 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp @@ -714,7 +714,7 @@ void plAvBrainClimb::ICalcProbeLengths() hsAssert(up, "Couldn't find ClimbUp animation."); if(up) { - GetStartToEndTransform(up, &upMove, nil, _TEMP_CONVERT_FROM_LITERAL("Handle")); + GetStartToEndTransform(up, &upMove, nil, "Handle"); fVerticalProbeLength = upMove.GetTranslate().fZ; } else fVerticalProbeLength = 4.0f; // guess @@ -722,7 +722,7 @@ void plAvBrainClimb::ICalcProbeLengths() hsAssert(left, "Couldn't find ClimbLeft animation."); if(left) { - GetStartToEndTransform(left, &leftMove, nil, _TEMP_CONVERT_FROM_LITERAL("Handle")); + GetStartToEndTransform(left, &leftMove, nil, "Handle"); fHorizontalProbeLength = leftMove.GetTranslate().fX; } else fHorizontalProbeLength = 3.0f; // guess diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp index a3d721a6..dcc7bfdb 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp @@ -300,7 +300,7 @@ std::string plAvBrainCritter::BehaviorName(int behavior) const plString plAvBrainCritter::AnimationName(int behavior) const { if ((behavior >= fBehaviors.Count()) || (behavior < 0)) - return _TEMP_CONVERT_FROM_LITERAL(""); + return ""; return ((CritterBehavior*)fBehaviors[behavior])->AnimName(); } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp index cb2e4da9..fe7f4923 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp @@ -309,7 +309,7 @@ void plAvBrainHuman::IInitBoneMap() for(int i = 0; i < numTuples; i++) { HumanBoneID id = tupleMap[i].fID; - plString name = _TEMP_CONVERT_FROM_LITERAL(tupleMap[i].fName); + plString name = tupleMap[i].fName; const plSceneObject * bone = this->fAvMod->FindBone(name); if( bone ) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp index a6ef5409..1207a180 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp @@ -535,7 +535,7 @@ bool plAvTaskSeek::IUpdateObjective(plArmatureMod *avatar) plAGAnim *anim = avatar->FindCustomAnim(fAnimName); // don't need to do this every frame; the animation doesn't change. // *** cache the adjustment; - GetStartToEndTransform(anim, nil, &adjustment, _TEMP_CONVERT_FROM_LITERAL("Handle")); // actually getting end-to-start + GetStartToEndTransform(anim, nil, &adjustment, "Handle"); // actually getting end-to-start // ... but we do still need to multiply by the (potentially changed) target targL2W = targL2W * adjustment; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp index 7f6ca61c..a1b14e73 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp @@ -199,9 +199,9 @@ plKey plAvatarMgr::LoadAvatar(const char *name, const char *accountName, bool is const plLocation& loc = (globalLoc.IsValid() ? globalLoc : custLoc.IsValid() ? custLoc : maleLoc); #endif - plString theName = _TEMP_CONVERT_FROM_LITERAL(name); + plString theName = name; if ( loc == maleLoc ) - theName = _TEMP_CONVERT_FROM_LITERAL("Male"); + theName = "Male"; if (loc.IsValid()) { @@ -1012,7 +1012,7 @@ void plAvatarMgr::OfferLinkingBook(plKey hostKey, plKey guestKey, plMessage *lin brainG->AddStage(guestAccept); brainG->AddStage(guestAcceptIdle); - plCoopCoordinator *coord = new plCoopCoordinator(hostKey, guestKey, brainH, brainG, _TEMP_CONVERT_FROM_LITERAL("Convergence"), 1, 1, linkMsg, true); + plCoopCoordinator *coord = new plCoopCoordinator(hostKey, guestKey, brainH, brainG, "Convergence", 1, 1, linkMsg, true); plAvCoopMsg *coMg = new plAvCoopMsg(hostKey, coord); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.cpp index 258ba5e4..b05d666c 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.cpp @@ -249,7 +249,7 @@ bool plAvSeekTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double t { hsMatrix44 adjustment; plAGAnim *anim = avatar->FindCustomAnim(fAnimName); - GetStartToEndTransform(anim, nil, &adjustment, _TEMP_CONVERT_FROM_LITERAL("Handle")); // actually getting end-to-start + GetStartToEndTransform(anim, nil, &adjustment, "Handle"); // actually getting end-to-start targetL2W = targetL2W * adjustment; } break; @@ -624,7 +624,7 @@ bool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, doubl plgDispatch::MsgSend( pMsg ); // whoosh... off it goes } - fMoveHandle = (fAnimInstance->GetAnimation()->GetChannel(_TEMP_CONVERT_FROM_LITERAL("Handle")) != nil); + fMoveHandle = (fAnimInstance->GetAnimation()->GetChannel("Handle") != nil); if(fMoveHandle) { plMatrixDifferenceApp *differ = avatar->GetRootAnimator(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.cpp index 149b3bb9..c54cdc30 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.cpp @@ -161,7 +161,7 @@ bool plMultistageBehMod::MsgReceive(plMessage* msg) #ifdef DEBUG_MULTISTAGE char sbuf[256]; - sprintf(sbuf,"plMultistageModMsg - starting multistage from %s",sender->GetName()); + sprintf(sbuf,"plMultistageModMsg - starting multistage from %s",sender->GetName().c_str()); plAvatarMgr::GetInstance()->GetLog()->AddLine(sbuf); #endif plAvSeekMsg *seeker = new plAvSeekMsg(nil, avModKey, seekKey, 1.0f, fSmartSeek); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp index 1c66ad56..8fd488f9 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp @@ -279,7 +279,7 @@ bool IIsClosestAnim(const char *animName, hsMatrix44 &sitGoal, float &closestDis // The first step is to get the transform from the end to the beginning of the // animation. That's what this next line is doing. It's a bit unintuitive // until you look at the parameter definitions. - GetStartToEndTransform(anim, nil, &animEndToStart, _TEMP_CONVERT_FROM_LITERAL("Handle")); + GetStartToEndTransform(anim, nil, &animEndToStart, "Handle"); hsMatrix44 candidateGoal = sitGoal * animEndToStart; hsPoint3 distP = candidateGoal.GetTranslate() - curPosition; hsVector3 distV(distP.fX, distP.fY, distP.fZ); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp index b31edc7a..27078fb9 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp @@ -197,7 +197,7 @@ void plDrawableSpans::Write( hsStream* s, hsResMgr* mgr ) hsUNIXStream log; log.Open("log\\GBuf.log", "ab"); char buf[256]; - sprintf(buf, "Drawable Span: %s, GroupNum: %u\r\n", GetKeyName(), i); + sprintf(buf, "Drawable Span: %s, GroupNum: %u\r\n", GetKeyName().c_str(), i); log.WriteString(buf); log.Close(); #endif @@ -386,8 +386,8 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan* uint32_t ptr = cell->fVtxStart + span->fCellOffset * stride; statusLog->AddLineF("From obj <%s> mat <%s> size %d bytes grp=%d (%d offset)", - geo->fMaxOwner.s_str(""), - geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "", + geo->fMaxOwner.c_str(""), + geo->fMaterial ? geo->fMaterial->GetKeyName().c_str() : "", geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(uint16_t) * geo->fNumIndices, span->fGroupIdx, ptr @@ -404,8 +404,8 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan* else { statusLog->AddLineF("Instanced obj <%s> mat <%s> grp=%d (%d/%d/%d/%d/%d/%d/%d/%d)", - geo->fMaxOwner.s_str(""), - geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "", + geo->fMaxOwner.c_str(""), + geo->fMaterial ? geo->fMaterial->GetKeyName().c_str() : "", span->fGroupIdx, span->fVBufferIdx, span->fCellIdx, @@ -423,8 +423,8 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan* if( geo->fProps & plGeometrySpan::kFirstInstance ) { statusLog->AddLineF("From obj <%s> mat <%s> size %d bytes grp=%d (%d/%d/%d/%d/%d)", - geo->fMaxOwner.s_str(""), - geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "", + geo->fMaxOwner.c_str(""), + geo->fMaterial ? geo->fMaterial->GetKeyName().c_str() : "", geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(uint16_t) * geo->fNumIndices, span->fGroupIdx, span->fVBufferIdx, @@ -437,8 +437,8 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan* else { statusLog->AddLineF("Instanced obj <%s> mat <%s> grp=%d (%d/%d/%d/%d/%d)", - geo->fMaxOwner.s_str(""), - geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "", + geo->fMaxOwner.c_str(""), + geo->fMaterial ? geo->fMaterial->GetKeyName().c_str() : "", span->fGroupIdx, span->fVBufferIdx, span->fCellIdx, diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plInstanceDrawInterface.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plInstanceDrawInterface.cpp index f90e0607..c8e3e00a 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plInstanceDrawInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plInstanceDrawInterface.cpp @@ -114,7 +114,7 @@ void plInstanceDrawInterface::AddSharedMesh(plSharedMesh *mesh, hsGMaterial *mat #ifdef MF_NOSHADOW_ACC // TESTHACKERY FOLLOWS - GlassesNoShadow uint32_t noShadHack = 0; - if( mesh->GetKey() && (strstr(mesh->GetKey()->GetName(), "lasses") || strstr(mesh->GetKey()->GetName(), "oggles")) ) + if( mesh->GetKey() && (mesh->GetKey()->GetName().Find("lasses") >= 0 || mesh->GetKey()->GetName().Find("oggles") >= 0) ) noShadHack = plGeometrySpan::kPropNoShadowCast; #endif // MF_NOSHADOW_ACC diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp index 8d0409a1..53624dcf 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp @@ -158,10 +158,10 @@ hsGMaterial* plProxyGen::IMakeProxyMaterial() const hsGMaterial* retVal = new hsGMaterial(); plString buff; - if( !GetKey()->GetName().IsNull() ) - buff = plString::Format("%s_Material", GetKey()->GetName().c_str()); + if( !GetKeyName().IsNull() ) + buff = plString::Format("%s_Material", GetKeyName().c_str()); else - buff = _TEMP_CONVERT_FROM_LITERAL("ProxyMaterial"); + buff = "ProxyMaterial"; hsgResMgr::ResMgr()->NewKey( buff, retVal, GetKey() ? GetKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc ); plLayer *lay = retVal->MakeBaseLayer(); @@ -233,10 +233,10 @@ void plProxyGen::IGenerateProxy() if( fProxyDrawables[idx] && !fProxyDrawables[idx]->GetKey() ) { plString buff; - if( !GetKey()->GetName().IsNull() ) - buff = plString::Format("%s_ProxyDrawable", GetKey()->GetName().c_str()); + if( !GetKeyName().IsNull() ) + buff = plString::Format("%s_ProxyDrawable", GetKeyName().c_str()); else - buff = _TEMP_CONVERT_FROM_LITERAL("ProxyDrawable"); + buff = "ProxyDrawable"; hsgResMgr::ResMgr()->NewKey( buff, fProxyDrawables[ idx ], GetKey() ? GetKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc ); } diff --git a/Sources/Plasma/PubUtilLib/plFile/CMakeLists.txt b/Sources/Plasma/PubUtilLib/plFile/CMakeLists.txt index 46528416..05a735af 100644 --- a/Sources/Plasma/PubUtilLib/plFile/CMakeLists.txt +++ b/Sources/Plasma/PubUtilLib/plFile/CMakeLists.txt @@ -5,26 +5,16 @@ include_directories("../../PubUtilLib") include_directories(${ZLIB_INCLUDE_DIR}) set(plFile_SOURCES - hsFiles.cpp plBrowseFolder.cpp plEncryptedStream.cpp - plFileUtils.cpp plInitFileReader.cpp plSecureStream.cpp plStreamSource.cpp ) -if(WIN32) - set(plFile_SOURCES ${plFile_SOURCES} hsFiles_Win.cpp) -else(WIN32) - set(plFile_SOURCES ${plFile_SOURCES} hsFiles_Unix.cpp) -endif(WIN32) - set(plFile_HEADERS - hsFiles.h plBrowseFolder.h plEncryptedStream.h - plFileUtils.h plInitFileReader.h plSecureStream.h plStreamSource.h diff --git a/Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp b/Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp index 263bced5..c090e7f8 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/plSecureStream.cpp @@ -62,6 +62,9 @@ static const int kFileStartOffset = kMagicStringLen + sizeof(uint32_t); static const int kMaxBufferedFileSize = 10*1024; +const char plSecureStream::kKeyFilename[] = "encryption.key"; +const wchar_t plSecureStream::kWKeyFilename[] = L"encryption.key"; + plSecureStream::plSecureStream(bool deleteOnExit, uint32_t* key) : fRef(INVALID_HANDLE_VALUE), fActualFileSize(0), @@ -757,3 +760,61 @@ hsStream* plSecureStream::OpenSecureFileWrite(const wchar_t* fileName, uint32_t* s->Open(fileName, L"wb"); return s; } + +//// GetSecureEncryptionKey ////////////////////////////////////////////////// + +bool plSecureStream::GetSecureEncryptionKey(const char* filename, uint32_t* key, unsigned length) +{ + wchar_t* wFilename = hsStringToWString(filename); + bool ret = GetSecureEncryptionKey(wFilename, key, length); + delete [] wFilename; + return ret; +} + +bool plSecureStream::GetSecureEncryptionKey(const wchar_t* filename, uint32_t* key, unsigned length) +{ + // looks for an encryption key file in the same directory, and reads it + std::wstring sFilename = filename; + + // grab parent directory + size_t loc = sFilename.rfind(L"\\"); + if (loc == std::wstring::npos) + loc = sFilename.rfind(L"/"); + + std::wstring sDir; + if (loc != std::wstring::npos) + sDir = sFilename.substr(0, loc); + else // no directory + sDir = L"./"; + if ((sDir[sDir.length()-1] != L'/') && (sDir[sDir.length()-1] != L'\\')) + sDir += L'/'; // add the slash, if it doesn't has one + + // now add the key filename + std::wstring keyFile = sDir + kWKeyFilename; + + if (plFileUtils::FileExists(keyFile.c_str())) + { + // file exists, read from it + hsUNIXStream file; + file.Open(keyFile.c_str(), L"rb"); + + unsigned bytesToRead = length * sizeof(uint32_t); + uint8_t* buffer = (uint8_t*)malloc(bytesToRead); + unsigned bytesRead = file.Read(bytesToRead, buffer); + + file.Close(); + + unsigned memSize = min(bytesToRead, bytesRead); + memcpy(key, buffer, memSize); + free(buffer); + + return true; + } + + // file doesn't exist, use default key + unsigned memSize = min(length, arrsize(plSecureStream::kDefaultKey)); + memSize *= sizeof(uint32_t); + memcpy(key, plSecureStream::kDefaultKey, memSize); + + return false; +} diff --git a/Sources/Plasma/PubUtilLib/plFile/plSecureStream.h b/Sources/Plasma/PubUtilLib/plFile/plSecureStream.h index a1981642..59b30d6f 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plSecureStream.h +++ b/Sources/Plasma/PubUtilLib/plFile/plSecureStream.h @@ -131,6 +131,15 @@ public: static hsStream* OpenSecureFileWrite(const wchar_t* fileName, uint32_t* key = nil); static const uint32_t kDefaultKey[4]; // our default encryption key + + // searches the parent directory of filename for the encryption key file, and reads it + // into the key passed in. Returns false if the key file didn't exist (and sets key to + // the default key) + static bool GetSecureEncryptionKey(const char* filename, uint32_t* key, unsigned length); + static bool GetSecureEncryptionKey(const wchar_t* filename, uint32_t* key, unsigned length); + + static const char kKeyFilename[]; + static const wchar_t kWKeyFilename[]; }; #endif // plSecureStream_h_inc diff --git a/Sources/Plasma/PubUtilLib/plFile/plStreamSource.cpp b/Sources/Plasma/PubUtilLib/plFile/plStreamSource.cpp index 4ec95793..8c57804c 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plStreamSource.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/plStreamSource.cpp @@ -128,7 +128,7 @@ hsStream* plStreamSource::GetFile(std::wstring filename) if (plSecureStream::IsSecureFile(sFilename.c_str())) { uint32_t encryptionKey[4]; - if (!plFileUtils::GetSecureEncryptionKey(sFilename.c_str(), encryptionKey, 4)) + if (!plSecureStream::GetSecureEncryptionKey(sFilename.c_str(), encryptionKey, 4)) { FATAL("Hey camper... You need an NTD key file!"); return nil; diff --git a/Sources/Plasma/PubUtilLib/plGImage/plFontCache.cpp b/Sources/Plasma/PubUtilLib/plGImage/plFontCache.cpp index 069ba79c..ebbf6558 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plFontCache.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plFontCache.cpp @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plFont.h" #include "plStatusLog/plStatusLog.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "pnMessage/plRefMsg.h" #include "hsResMgr.h" diff --git a/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp b/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp index 3f17f5ee..edcd4d4d 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plMipmap.cpp @@ -2138,7 +2138,7 @@ void plMipmap::IAddToMemRecord( plMipmap *mip, plRecord::Method method ) if( mip->GetKey() ) newRecord->fKeyName = mip->GetKeyName(); else - newRecord->fKeyName = _TEMP_CONVERT_FROM_LITERAL( "" ); + newRecord->fKeyName = ""; if( mip->fCompressionType != kDirectXCompression ) newRecord->fUncompressedInfo.fType = mip->fUncompressedInfo.fType; else diff --git a/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.cpp b/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.cpp index 968a40c1..16e959a8 100644 --- a/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.cpp +++ b/Sources/Plasma/PubUtilLib/plGImage/plWinFontCache.cpp @@ -63,7 +63,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plWinFontCache.h" #include "plStatusLog/plStatusLog.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "plGImage/plDynSurfaceWriter.h" #if HS_BUILD_FOR_WIN32 diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp index fe0f4d5a..b4625f63 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp @@ -292,12 +292,12 @@ void plMouseDevice::IUpdateCursorSize() } } -void plMouseDevice::AddNameToCursor(const char* name) +void plMouseDevice::AddNameToCursor(const plString& name) { - if (fInstance && name) + if (fInstance && !name.IsNull()) { plDebugText &txt = plDebugText::Instance(); - txt.DrawString(fInstance->fWXPos + 12 ,fInstance->fWYPos - 7,name); + txt.DrawString(fInstance->fWXPos + 12 ,fInstance->fWYPos - 7,name.c_str()); } } void plMouseDevice::AddCCRToCursor() diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h index 0a3b2df6..cd373fa0 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h @@ -188,8 +188,7 @@ public: static void SetCursorOpacity( float opacity = 1.f ); static bool GetInverted() { return plMouseDevice::bInverted; } static void SetInverted(bool inverted) { plMouseDevice::bInverted = inverted; } - static void AddNameToCursor(const char* name); - static void AddNameToCursor(const plString& name) { AddNameToCursor(_TEMP_CONVERT_TO_CONST_CHAR(name)); } + static void AddNameToCursor(const plString& name); static void AddIDNumToCursor(uint32_t idNum); static void AddCCRToCursor(); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.cpp index 880be1d0..00f26a4c 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.cpp @@ -56,26 +56,6 @@ void plAnimCmdMsg::ClearCmd() fCmd.Clear(); } -void plAnimCmdMsg::SetAnimName(const plString &name) -{ - fAnimName = name; -} - -plString plAnimCmdMsg::GetAnimName() -{ - return fAnimName; -} - -void plAnimCmdMsg::SetLoopName(const plString &name) -{ - fLoopName = name; -} - -plString plAnimCmdMsg::GetLoopName() -{ - return fLoopName; -} - bool plAnimCmdMsg::CmdChangesAnimTime() { return (Cmd(kContinue) || diff --git a/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.h index 87b12e70..0cffb8c3 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.h @@ -111,16 +111,12 @@ public: bool Cmd(int n) const { return fCmd.IsBitSet(n); } void SetCmd(int n) { fCmd.SetBit(n); } void ClearCmd(); - void SetAnimName(const plString &name); - plString GetAnimName(); + void SetAnimName(const plString &name) { fAnimName = name; } + plString GetAnimName() { return fAnimName; } bool CmdChangesAnimTime(); // Will this command cause an update to the current anim time? - // TEMP plString REVISIT - // Because I'm TOO LAZY to keep converting all these calls to SetAnimName - void SetAnimName(const char *name) { SetAnimName(_TEMP_CONVERT_FROM_LITERAL(name)); } - - void SetLoopName(const plString &name); - plString GetLoopName(); + void SetLoopName(const plString &name) { fLoopName = name; } + plString GetLoopName() { return fLoopName; } float fBegin; float fEnd; diff --git a/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.cpp index d11bdf9a..3b4861fc 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.cpp @@ -253,7 +253,7 @@ void plDynamicTextMsg::Write( hsStream *s, hsResMgr *mgr ) fClearColor.Write( s ); fColor.Write( s ); - s->WriteSafeWString( fString ); + s->WriteSafeWString( plString::FromWchar(fString) ); mgr->WriteKey( s, fImageKey ); s->WriteLE( fFlags ); @@ -360,7 +360,7 @@ void plDynamicTextMsg::WriteVersion(hsStream* s, hsResMgr* mgr) fColor.Write( s ); // kDynTextMsgString - s->WriteSafeWString( fString ); + s->WriteSafeWString( plString::FromWchar(fString) ); // kDynTextMsgImageKey mgr->WriteKey( s, fImageKey ); diff --git a/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.h index 21061100..9de28e8b 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plDynamicTextMsg.h @@ -59,13 +59,13 @@ class plDynamicTextMsg : public plMessage friend class plDynamicTextMap; protected: - uint16_t fCmd; + uint16_t fCmd; // Position (fX is also used for font size) - int16_t fX, fY; + int16_t fX, fY; // A rectangle - uint16_t fLeft, fTop, fRight, fBottom; + uint16_t fLeft, fTop, fRight, fBottom; // Colors hsColorRGBA fClearColor; @@ -78,10 +78,10 @@ protected: plKey fImageKey; // Misc flags field - uint32_t fFlags; + uint32_t fFlags; bool fBlockRGB; - int16_t fLineSpacing; + int16_t fLineSpacing; public: plDynamicTextMsg() : plMessage( nil, nil, nil ) { fCmd = 0; fString = nil; fImageKey = nil; fFlags = 0; fBlockRGB = false; } diff --git a/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.cpp index 072d254c..47102826 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.cpp @@ -106,7 +106,7 @@ plKey plCloneSpawnModifier::SpawnClone(const char* cloneName, const char* cloneA const plLocation& loc = plKeyFinder::Instance().FindLocation(cloneAge, "BuiltIn"); // Find the clone template key - plUoid objUoid(loc, plSceneObject::Index(), _TEMP_CONVERT_FROM_LITERAL(cloneName)); + plUoid objUoid(loc, plSceneObject::Index(), cloneName); plKey key = resMgr->FindKey(objUoid); if (key) diff --git a/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.cpp index 63109bd8..7def6966 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.cpp @@ -775,7 +775,7 @@ void plResponderModifier::ILog(uint32_t color, const char* format, ...) if (!format || *format == '\0') return; - const char* keyName = _TEMP_CONVERT_TO_CONST_CHAR(GetKeyName()); + const char* keyName = GetKeyName().c_str(); // Make sure this key isn't in our list of keys to deny for (int i = 0; i < gNoLogStrings.size(); i++) diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp index 60eeb30e..97fd9608 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp @@ -181,7 +181,7 @@ void plNCAgeJoiner::IDispatchMsgReceiveCallback () { void plNCAgeJoiner::IResMgrProgressBarCallback (plKey key) { #ifndef PLASMA_EXTERNAL_RELEASE if (s_instance) - s_instance->progressBar->SetStatusText(_TEMP_CONVERT_TO_CONST_CHAR(key->GetName())); + s_instance->progressBar->SetStatusText(key->GetName().c_str()); #endif } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp index 12272d9a..6c1a6757 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp @@ -645,7 +645,7 @@ void plNetClientMgr::ICheckPendingStateLoad(double secs) #ifdef HS_DEBUGGING if (plNetObjectDebugger::GetInstance()->IsDebugObject(so)) { - hsLogEntry( DebugMsg( "Delivering SDL state %s:%s", pl->fKey->GetName(), pl->fSDRec->GetDescriptor()->GetName() ) ); + hsLogEntry( DebugMsg( "Delivering SDL state %s:%s", pl->fKey->GetName().c_str(), pl->fSDRec->GetDescriptor()->GetName() ) ); // hsLogEntry(plNetObjectDebugger::GetInstance()->LogMsg(xtl::format("Dispatching SDL state, type %s to object:%s, locallyOwned=%d, st=%.3f rt=%.3f", // pl->fSDRec->GetDescriptor()->GetName(), pl->fKey->GetName(), // so->IsLocallyOwned()==plSynchedObject::kYes, secs, hsTimer::GetSeconds()).c_str())); @@ -1457,8 +1457,8 @@ bool plNetClientMgr::IFindModifier(plSynchedObject* obj, int16_t classIdx) cnt++; } - hsAssert(cnt<2, xtl::format("Object %s has multiple SDL modifiers of the same kind (%s)?", - obj->GetKeyName(), plFactory::GetNameOfClass(classIdx)).c_str()); + hsAssert(cnt<2, plString::Format("Object %s has multiple SDL modifiers of the same kind (%s)?", + obj->GetKeyName().c_str(), plFactory::GetNameOfClass(classIdx)).c_str()); return cnt==0 ? false : true; } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp index a3409946..2fd908cb 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp @@ -159,7 +159,7 @@ void plNetClientMgr::ISendCCRPetition(plCCRPetitionMsg* petMsg) char buffy[20]; sprintf( buffy, "%lu", GetPlayerID() ); info.AddValue( "Petition", "PlayerID", buffy ); - info.AddValue( "Petition", "PlayerName", _TEMP_CONVERT_TO_CONST_CHAR(GetPlayerName()) ); + info.AddValue( "Petition", "PlayerName", GetPlayerName().c_str() ); // write config info formatted like an ini file to a buffer hsRAMStream ram; @@ -396,9 +396,9 @@ int plNetClientMgr::ISendGameMessage(plMessage* msg) { #if 0 hsLogEntry(plNetObjectDebugger::GetInstance()->LogMsg( - xtl::format(" object:%s, rcvr %s %s", - msg->GetSender(), - msg->GetNumReceivers() ? msg->GetReceiver(0)->GetName() : "?", + plString::Format(" object:%s, rcvr %s %s", + msg->GetSender().GetKeyName().c_str(), + msg->GetNumReceivers() ? msg->GetReceiver(0)->GetName().c_str() : "?", netMsgWrap->AsStdString().c_str()).c_str())); #endif } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp index 98da3ac4..8c4bd094 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp @@ -231,8 +231,8 @@ void plNetClientMgr::IShowRelevanceRegions() // uint32_t maxPlayerName = 0; - txt.DrawString(x, y, _TEMP_CONVERT_TO_CONST_CHAR(GetPlayerName())); - maxPlayerName = hsMaximum(maxPlayerName, txt.CalcStringWidth(_TEMP_CONVERT_TO_CONST_CHAR(GetPlayerName()))); + txt.DrawString(x, y, GetPlayerName().c_str()); + maxPlayerName = hsMaximum(maxPlayerName, txt.CalcStringWidth(GetPlayerName().c_str())); y += yOff; int i; @@ -244,8 +244,8 @@ void plNetClientMgr::IShowRelevanceRegions() continue; const plString& name = mbr->GetPlayerName(); - txt.DrawString(x, y, _TEMP_CONVERT_TO_CONST_CHAR(name)); - maxPlayerName = hsMaximum(maxPlayerName, txt.CalcStringWidth(_TEMP_CONVERT_TO_CONST_CHAR(name))); + txt.DrawString(x, y, name.c_str()); + maxPlayerName = hsMaximum(maxPlayerName, txt.CalcStringWidth(name.c_str())); y += yOff; } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp index d06c3c0e..2d24ffca 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp @@ -63,7 +63,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plNetMessage/plNetMessage.h" #include "plAvatar/plAvatarMgr.h" #include "plAvatar/plArmatureMod.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" /***************************************************************************** @@ -947,7 +947,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) title = plString::Format("%s'", nc->GetPlayerName().c_str()); else title = plString::Format("%s's", nc->GetPlayerName().c_str()); - info->SetAgeUserDefinedName(_TEMP_CONVERT_TO_CONST_CHAR(title)); + info->SetAgeUserDefinedName(title.c_str()); } if (!info->HasAgeDescription()) { @@ -986,7 +986,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) title = plString::Format("%s'", nc->GetPlayerName().c_str()); else title = plString::Format("%s's", nc->GetPlayerName().c_str()); - info->SetAgeUserDefinedName(_TEMP_CONVERT_TO_CONST_CHAR(title)); + info->SetAgeUserDefinedName(title.c_str()); } if (!info->HasAgeDescription()) @@ -998,7 +998,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) desc = plString::Format("%s' %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName()); else desc = plString::Format("%s's %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName()); - info->SetAgeDescription( _TEMP_CONVERT_TO_CONST_CHAR(desc) ); + info->SetAgeDescription( desc.c_str() ); } if (!info->HasAgeInstanceGuid()) { diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.cpp index 27561b63..d5fbdbb2 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.cpp @@ -130,7 +130,7 @@ bool plNetObjectDebugger::DebugObject::ObjectMatches(const hsKeyedObject* obj) if ((fFlags & kPageMatch)==0) { // match based on object name only - return StringMatches(_TEMP_CONVERT_TO_CONST_CHAR(obj->GetKeyName())); + return StringMatches(obj->GetKeyName().c_str()); } return (obj->GetKey()->GetUoid().GetLocation()==fLoc); diff --git a/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp b/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp index dc43052d..67d68dad 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClientRecorder/plNetClientRecorder.cpp @@ -56,7 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plMessage/plAgeLoadedMsg.h" #include "plStatusLog/plStatusLog.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" plNetClientRecorder::plNetClientRecorder(TimeWrapper* timeWrapper) : fTimeWrapper(timeWrapper) diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp index fe37d8cc..e1801a97 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetServerSessionInfo.cpp @@ -663,11 +663,11 @@ plString plNetServerSessionInfo::AsLogString() const const char* spacer = kSemicolon; plStringStream ss; - plString typeName = _TEMP_CONVERT_FROM_LITERAL(""); + plString typeName; if (HasServerType()) { - typeName = _TEMP_CONVERT_FROM_LITERAL(plNetServerConstants::GetServerTypeStr(fServerType)); + typeName = plNetServerConstants::GetServerTypeStr(fServerType); } if (HasServerName()) diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp index ff42652a..0806a0cc 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp @@ -2196,7 +2196,7 @@ static bool Recv_ServerAddr ( s_active->token = msg.token; s_active->addr.SetHost(msg.srvAddr); - plString logmsg = _TEMP_CONVERT_FROM_LITERAL("SrvAuth addr: "); + plString logmsg = "SrvAuth addr: "; logmsg += s_active->addr.GetHostString(); LogMsg(kLogPerf, L"SrvAuth addr: %s", logmsg.c_str()); } @@ -2789,8 +2789,8 @@ bool AgeRequestTrans::Recv ( //============================================================================ AccountCreateRequestTrans::AccountCreateRequestTrans ( - const wchar_t accountName[], - const wchar_t password[], + const wchar_t accountName[], + const wchar_t password[], unsigned accountFlags, unsigned billingType, FNetCliAuthAccountCreateRequestCallback callback, @@ -2804,8 +2804,8 @@ AccountCreateRequestTrans::AccountCreateRequestTrans ( StrCopy(m_accountName, accountName, arrsize(m_accountName)); CryptHashPassword( - _TEMP_CONVERT_FROM_WCHAR_T(m_accountName), - _TEMP_CONVERT_FROM_WCHAR_T(password), + plString::FromWchar(m_accountName), + plString::FromWchar(password), m_namePassHash ); } @@ -2859,8 +2859,8 @@ bool AccountCreateRequestTrans::Recv ( //============================================================================ AccountCreateFromKeyRequestTrans::AccountCreateFromKeyRequestTrans ( - const wchar_t accountName[], - const wchar_t password[], + const wchar_t accountName[], + const wchar_t password[], const Uuid & key, unsigned billingType, FNetCliAuthAccountCreateFromKeyRequestCallback callback, @@ -2874,8 +2874,8 @@ AccountCreateFromKeyRequestTrans::AccountCreateFromKeyRequestTrans ( StrCopy(m_accountName, accountName, arrsize(m_accountName)); CryptHashPassword( - _TEMP_CONVERT_FROM_WCHAR_T(m_accountName), - _TEMP_CONVERT_FROM_WCHAR_T(password), + plString::FromWchar(m_accountName), + plString::FromWchar(password), m_namePassHash ); } @@ -3161,8 +3161,8 @@ bool SetPlayerRequestTrans::Recv ( //============================================================================ AccountChangePasswordRequestTrans::AccountChangePasswordRequestTrans ( - const wchar_t accountName[], - const wchar_t password[], + const wchar_t accountName[], + const wchar_t password[], FNetCliAuthAccountChangePasswordRequestCallback callback, void * param ) : NetAuthTrans(kAccountChangePasswordRequestTrans) @@ -3172,8 +3172,8 @@ AccountChangePasswordRequestTrans::AccountChangePasswordRequestTrans ( StrCopy(m_accountName, accountName, arrsize(m_accountName)); CryptHashPassword( - _TEMP_CONVERT_FROM_WCHAR_T(m_accountName), - _TEMP_CONVERT_FROM_WCHAR_T(password), + plString::FromWchar(m_accountName), + plString::FromWchar(password), m_namePassHash ); } diff --git a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp index 94f16859..636a1c02 100644 --- a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp +++ b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp @@ -1104,7 +1104,7 @@ int plNetMsgMemberUpdate::IPokeBuffer(hsStream* stream, uint32_t peekOptions) if (bytes) { // FIX ME to something nice - fMemberInfo.GetClientGuid()->SetClientKey(_TEMP_CONVERT_FROM_LITERAL("")); + fMemberInfo.GetClientGuid()->SetClientKey(""); fMemberInfo.GetClientGuid()->SetAccountUUID(plUUID()); fMemberInfo.Poke(stream, peekOptions); stream->WriteByte(fAddMember); diff --git a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.cpp b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.cpp index 4a23e469..7d75e8a0 100644 --- a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.cpp +++ b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.cpp @@ -505,7 +505,7 @@ int plNetMsgMemberListHelper::Poke(hsStream* stream, const uint32_t peekOptions) int i; for(i=0;iGetClientGuid()->SetClientKey(_TEMP_CONVERT_FROM_LITERAL("")); + fMembers[i]->GetClientGuid()->SetClientKey(""); fMembers[i]->GetClientGuid()->SetAccountUUID(plUUID()); fMembers[i]->Poke(stream, peekOptions); } diff --git a/Sources/Plasma/PubUtilLib/plNetTransport/plNetTransportMember.cpp b/Sources/Plasma/PubUtilLib/plNetTransport/plNetTransportMember.cpp index 0c7b7271..fda83771 100644 --- a/Sources/Plasma/PubUtilLib/plNetTransport/plNetTransportMember.cpp +++ b/Sources/Plasma/PubUtilLib/plNetTransport/plNetTransportMember.cpp @@ -77,7 +77,7 @@ plString plNetTransportMember::AsString() const { if (IsServer()) { - return _TEMP_CONVERT_FROM_LITERAL("(server)"); + return "(server)"; } else { diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp index 361a77c0..32d6ba18 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp @@ -616,7 +616,7 @@ bool plPXPhysical::HandleRefMsg(plGenRefMsg* refMsg) plKey ourKey = GetKey(); PhysRefType refType = PhysRefType(refMsg->fType); - plString refKeyName = refKey ? refKey->GetName() : _TEMP_CONVERT_FROM_LITERAL("MISSING"); + plString refKeyName = refKey ? refKey->GetName() : "MISSING"; if (refType == kPhysRefWorld) { @@ -694,7 +694,7 @@ plPhysical& plPXPhysical::SetProperty(int prop, bool status) case plSimulationInterface::kNoSynchronize: propName = "kNoSynchronize"; break; } - plString name = _TEMP_CONVERT_FROM_LITERAL("(unknown)"); + plString name = "(unknown)"; if (GetKey()) name = GetKeyName(); if (plSimulationMgr::fExtraProfile) diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.cpp index 8ff03da7..41d32caa 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.cpp @@ -220,22 +220,22 @@ void plPhysicalSDLModifier::ILogState(const plStateDataRecord* state, bool useDi if (isPosSet) log += plString::Format(" Pos=%.1f %.1f %.1f", pos.fX, pos.fY, pos.fZ); else - log += _TEMP_CONVERT_FROM_LITERAL(" Pos=None"); + log += " Pos=None"; if (isLinVSet) log += plString::Format(" LinV=%.1f %.1f %.1f", linV.fX, linV.fY, linV.fZ); else - log += _TEMP_CONVERT_FROM_LITERAL(" LinV=None"); + log += " LinV=None"; if (isAngVSet) log += plString::Format(" AngV=%.1f %.1f %.1f", angV.fX, angV.fY, angV.fZ); else - log += _TEMP_CONVERT_FROM_LITERAL(" AngV=None"); + log += " AngV=None"; if (isRotSet) log += plString::Format(" Rot=%.1f %.1f %.1f %.1f", rot.fX, rot.fY, rot.fZ, rot.fW); else - log += _TEMP_CONVERT_FROM_LITERAL(" Rot=None"); + log += " Rot=None"; IGetLog()->AddLine(log.c_str(), color); } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp index d0c14736..6e0f8779 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp @@ -1341,10 +1341,10 @@ bool plDXPipeline::ICreateDeviceObjects() /// Ok, we're done now #if MCN_BOUNDS_SPANS fBoundsSpans = new plDrawableSpans(); - hsgResMgr::ResMgr()->NewKey( _TEMP_CONVERT_FROM_LITERAL("BoundsSpans"), fBoundsSpans, plLocation::kGlobalFixedLoc ); + hsgResMgr::ResMgr()->NewKey( "BoundsSpans", fBoundsSpans, plLocation::kGlobalFixedLoc ); fBoundsSpans->SetNativeProperty( plDrawable::kPropVolatile, true ); fBoundsMat = new hsGMaterial(); - hsgResMgr::ResMgr()->NewKey( _TEMP_CONVERT_FROM_LITERAL("BoundsMaterial"), fBoundsMat, plLocation::kGlobalFixedLoc ); + hsgResMgr::ResMgr()->NewKey( "BoundsMaterial", fBoundsMat, plLocation::kGlobalFixedLoc ); plLayer *lay = fBoundsMat->MakeBaseLayer(); lay->SetMiscFlags( hsGMatState::kMiscWireFrame | hsGMatState::kMiscTwoSided ); lay->SetShadeFlags( lay->GetShadeFlags() | hsGMatState::kShadeWhite ); @@ -9375,7 +9375,7 @@ void plDXPipeline::IMakeOcclusionSnap() ident.Reset(); hsGMaterial* mat = new hsGMaterial; - hsgResMgr::ResMgr()->NewKey( _TEMP_CONVERT_FROM_LITERAL("OcclusionSnapMat"), mat, plLocation::kGlobalFixedLoc ); + hsgResMgr::ResMgr()->NewKey( "OcclusionSnapMat", mat, plLocation::kGlobalFixedLoc ); plLayer *lay = mat->MakeBaseLayer(); lay->SetZFlags(hsGMatState::kZNoZWrite); lay->SetPreshadeColor(hsColorRGBA().Set(1.f, 0.5f, 0.5f, 1.f)); diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp index 998f9e94..c8cea5da 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp @@ -109,7 +109,7 @@ bool NameMatches(const char* obName, const char* pKName, bool subString) } else { - if (_TEMP_CONVERT_FROM_LITERAL(p).Find(o, plString::kCaseInsensitive) >= 0) + if (plString(p).Find(o, plString::kCaseInsensitive) >= 0) return true; } @@ -264,12 +264,12 @@ void plKeyFinder::IGetNames(std::vector& names, const plString& search void plKeyFinder::GetResponderNames(std::vector& names) { - IGetNames(names, _TEMP_CONVERT_FROM_LITERAL(""), CLASS_INDEX_SCOPED(plResponderModifier)); + IGetNames(names, "", CLASS_INDEX_SCOPED(plResponderModifier)); } void plKeyFinder::GetActivatorNames(std::vector& names) { - IGetNames(names, _TEMP_CONVERT_FROM_LITERAL(""), CLASS_INDEX_SCOPED(plLogicModifier)); + IGetNames(names, "", CLASS_INDEX_SCOPED(plLogicModifier)); } class plKeyFinderIterator : public plRegistryKeyIterator, public plRegistryPageIterator diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.cpp index 1ff2851c..46afb922 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plLocalization.cpp @@ -41,7 +41,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "HeadSpin.h" #include "plLocalization.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" plLocalization::Language plLocalization::fLanguage = plLocalization::kEnglish; diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp index 31f70703..c1c173f6 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnKeyedObject/plKeyImp.h" #include "plStatusLog/plStatusLog.h" #include "pnFactory/plFactory.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" #include "hsStlUtils.h" #include "plVersion.h" diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp index 66278a2a..5de1d7dc 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp @@ -60,8 +60,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnMessage/plObjRefMsg.h" #include "plMessage/plAgeLoadedMsg.h" #include "pnMessage/plClientMsg.h" -#include "plFile/hsFiles.h" -#include "plFile/plFileUtils.h" +#include "hsFiles.h" +#include "plFileUtils.h" #include "pnFactory/plCreator.h" #include "pnNetCommon/plSynchedObject.h" #include "pnNetCommon/plNetApp.h" @@ -536,9 +536,9 @@ inline plKeyImp* IFindKeyLocalized(const plUoid& uoid, plRegistryPageNode* page) if ((!objectName.IsNull()) && plLocalization::IsLocalized()) { char localName[256]; - if (plLocalization::GetLocalized(_TEMP_CONVERT_TO_CONST_CHAR(objectName), localName)) + if (plLocalization::GetLocalized(objectName.c_str(), localName)) { - plKeyImp* localKey = page->FindKey(uoid.GetClassType(), _TEMP_CONVERT_FROM_LITERAL(localName)); + plKeyImp* localKey = page->FindKey(uoid.GetClassType(), localName); if (localKey != nil) return localKey; } @@ -921,7 +921,7 @@ plKey plResManager::ICloneKey(const plUoid& objUoid, uint32_t playerID, uint32_t fCurCloneID = cloneID; fCurClonePlayerID = playerID; - plKey cloneKey = ReRegister(_TEMP_CONVERT_FROM_LITERAL(""), objUoid); + plKey cloneKey = ReRegister("", objUoid); fCurClonePlayerID = 0; fCurCloneID = 0; @@ -1272,7 +1272,7 @@ public: { if (stricmp(page->GetPageInfo().GetAge(), fAgeName) == 0) { - plUoid uoid(page->GetPageInfo().GetLocation(), 0, _TEMP_CONVERT_FROM_LITERAL("")); + plUoid uoid(page->GetPageInfo().GetLocation(), 0, ""); fLocations.push_back(uoid.GetLocation()); } return true; diff --git a/Sources/Plasma/PubUtilLib/plSDL/plSDLParser.cpp b/Sources/Plasma/PubUtilLib/plSDL/plSDLParser.cpp index f08a95e6..1f8994d4 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plSDLParser.cpp +++ b/Sources/Plasma/PubUtilLib/plSDL/plSDLParser.cpp @@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include "hsStlUtils.h" #include "plSDL.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "plFile/plStreamSource.h" #include "pnNetCommon/pnNetCommon.h" #include "pnNetCommon/plNetApp.h" diff --git a/Sources/Plasma/PubUtilLib/plSDL/plStateDataRecord.cpp b/Sources/Plasma/PubUtilLib/plSDL/plStateDataRecord.cpp index 2da31107..4dc5936a 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plStateDataRecord.cpp +++ b/Sources/Plasma/PubUtilLib/plSDL/plStateDataRecord.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plNetMessage/plNetMessage.h" #include "pnNetCommon/plNetApp.h" -const plString plSDL::kAgeSDLObjectName = _TEMP_CONVERT_FROM_LITERAL("AgeSDLHook"); +const plString plSDL::kAgeSDLObjectName = "AgeSDLHook"; // static const uint8_t plStateDataRecord::kIOVersion=6; @@ -737,7 +737,7 @@ void plStateDataRecord::DumpToObjectDebugger(const char* msg, bool dirtyOnly, in plString pad; int i; for(i=0;iWrite(logStr.GetSize(), logStr.c_str()); } diff --git a/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp b/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp index 55e7a34f..ea51353c 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp +++ b/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp @@ -1790,7 +1790,7 @@ plString plSimpleStateVariable::GetKeyName(int idx) const } } hsAssert(false, "passing wrong value type to SDL variable"); - return _TEMP_CONVERT_FROM_LITERAL("(nil)"); + return "(nil)"; } #pragma optimize( "g", off ) // disable float optimizations diff --git a/Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.cpp b/Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.cpp index 8f2c55c1..a604d83f 100644 --- a/Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.cpp @@ -222,7 +222,7 @@ void plRelevanceMgr::ParseCsvInput(hsStream *s) plRegionInfo *info = new plRegionInfo; regions.Append(info); info->fName = hsStrcpy(buff); - info->fIndex = GetIndex(_TEMP_CONVERT_FROM_LITERAL(buff)); + info->fIndex = GetIndex(buff); } } else // parsing actual settings. @@ -231,7 +231,7 @@ void plRelevanceMgr::ParseCsvInput(hsStream *s) if (!toke.Next(buff, kBufSize)) continue; - int rowIndex = GetIndex(_TEMP_CONVERT_FROM_LITERAL(buff)); + int rowIndex = GetIndex(buff); int column = 0; while (toke.Next(buff, kBufSize) && column < regions.GetCount()) { @@ -252,20 +252,20 @@ plString plRelevanceMgr::GetRegionNames(hsBitVector regions) { plString retVal; if (regions.IsBitSet(0)) - retVal = _TEMP_CONVERT_FROM_LITERAL("-Nowhere (0)-"); + retVal = "-Nowhere (0)-"; for (int i = 0; i < fRegions.GetCount(); ++i) { if (regions.IsBitSet(i + 1)) { if (!retVal.IsEmpty()) - retVal += _TEMP_CONVERT_FROM_LITERAL(", "); + retVal += ", "; if (fRegions[i]) retVal += fRegions[i]->GetKeyName(); } } if (retVal.IsEmpty()) - retVal = _TEMP_CONVERT_FROM_LITERAL(""); + retVal = ""; return retVal; } diff --git a/Sources/Plasma/PubUtilLib/plStatGather/plAutoProfile.cpp b/Sources/Plasma/PubUtilLib/plStatGather/plAutoProfile.cpp index ae8b4dd1..27866480 100644 --- a/Sources/Plasma/PubUtilLib/plStatGather/plAutoProfile.cpp +++ b/Sources/Plasma/PubUtilLib/plStatGather/plAutoProfile.cpp @@ -57,7 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnMessage/plClientMsg.h" #include "plAgeLoader/plAgeLoader.h" #include "plProfileManagerFull.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" #include "plPipeline/plDebugText.h" #include "pnMessage/plTimeMsg.h" @@ -219,7 +219,7 @@ void plAutoProfileImp::INextProfile() if (!fLastSpawnPointName.IsNull()) { const char * ageName = NetCommGetAge()->ageDatasetName; - plProfileManagerFull::Instance().LogStats(ageName, _TEMP_CONVERT_TO_CONST_CHAR(fLastSpawnPointName)); + plProfileManagerFull::Instance().LogStats(ageName, fLastSpawnPointName.c_str()); plMipmap mipmap; if (plClient::GetInstance()->GetPipeline()->CaptureScreen(&mipmap)) @@ -276,8 +276,8 @@ bool plAutoProfileImp::INextAge() link.SetLinkingRules(plNetCommon::LinkingRules::kBasicLink); plNetLinkingMgr::GetInstance()->LinkToAge(&link); - fStatusMessage = _TEMP_CONVERT_FROM_LITERAL("Linking to age "); - fStatusMessage += _TEMP_CONVERT_FROM_LITERAL(ageName); + fStatusMessage = "Linking to age "; + fStatusMessage += ageName; return true; } @@ -299,7 +299,7 @@ bool plAutoProfileImp::INextSpawnPoint() if (fLastSpawnPointName.CompareN(kPerfSpawnPrefix, kPerfSpawnLen) == 0) { - fStatusMessage = _TEMP_CONVERT_FROM_LITERAL("Profiling spawn point "); + fStatusMessage = "Profiling spawn point "; fStatusMessage += fLastSpawnPointName; foundGood = true; @@ -312,7 +312,7 @@ bool plAutoProfileImp::INextSpawnPoint() if (!foundGood) { fLastSpawnPointName = plString::Null; - fStatusMessage = _TEMP_CONVERT_FROM_LITERAL("No profile spawn point found"); + fStatusMessage = "No profile spawn point found"; return false; } @@ -368,7 +368,7 @@ bool plAutoProfileImp::MsgReceive(plMessage* msg) ms); } - fStatusMessage = _TEMP_CONVERT_FROM_LITERAL("Age loaded. Preparing to profile."); + fStatusMessage = "Age loaded. Preparing to profile."; // Age is loaded, start profiling in 5 seconds (to make sure the avatar is linked in all the way) plTimerCallbackMsg* timerMsg = new plTimerCallbackMsg(GetKey()); diff --git a/Sources/Plasma/PubUtilLib/plStatGather/plProfileManagerFull.cpp b/Sources/Plasma/PubUtilLib/plStatGather/plProfileManagerFull.cpp index 28922a0f..93f520bd 100644 --- a/Sources/Plasma/PubUtilLib/plStatGather/plProfileManagerFull.cpp +++ b/Sources/Plasma/PubUtilLib/plStatGather/plProfileManagerFull.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsStream.h" #include "pnUtils/pnUtils.h" #include "plUnifiedTime/plUnifiedTime.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" plProfileManagerFull::plProfileManagerFull() : fVars(plProfileManager::Instance().fVars), diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plLoggable.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plLoggable.cpp index 0a940a80..92944f90 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plLoggable.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plLoggable.cpp @@ -121,22 +121,22 @@ bool plLoggable::LogV( const char * fmt, va_list args ) const bool plLoggable::DebugMsgV(const char* fmt, va_list args) const { - return Log(_TEMP_CONVERT_FROM_LITERAL("DBG: ") + plString::IFormat(fmt, args)); + return Log(plString("DBG: ") + plString::IFormat(fmt, args)); } bool plLoggable::ErrorMsgV(const char* fmt, va_list args) const { - return Log(_TEMP_CONVERT_FROM_LITERAL("ERR: ") + plString::IFormat(fmt, args)); + return Log(plString("ERR: ") + plString::IFormat(fmt, args)); } bool plLoggable::WarningMsgV(const char* fmt, va_list args) const { - return Log(_TEMP_CONVERT_FROM_LITERAL("WRN: ") + plString::IFormat(fmt, args)); + return Log(plString("WRN: ") + plString::IFormat(fmt, args)); } bool plLoggable::AppMsgV(const char* fmt, va_list args) const { - return Log(_TEMP_CONVERT_FROM_LITERAL("APP: ") + plString::IFormat(fmt, args)); + return Log(plString("APP: ") + plString::IFormat(fmt, args)); } /////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp index 00193189..6a729327 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp @@ -61,10 +61,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "hsTemplates.h" #include "hsTimer.h" #include "hsStlUtils.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" #include "plStatusLog.h" #include "hsStlUtils.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "plUnifiedTime/plUnifiedTime.h" #include "pnProduct/pnProduct.h" diff --git a/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.cpp b/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.cpp index cd2c6003..b5ef858b 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.cpp @@ -133,10 +133,10 @@ plLayer* hsGMaterial::MakeBaseLayer() hsAssert(GetKey(), "All materials need a key (or temp key)"); plString buff; - if( !GetKey()->GetName().IsNull() ) - buff = plString::Format("%s_Layer", GetKey()->GetName().c_str()); + if( !GetKeyName().IsNull() ) + buff = plString::Format("%s_Layer", GetKeyName().c_str()); else - buff = _TEMP_CONVERT_FROM_LITERAL("Layer"); + buff = "Layer"; hsgResMgr::ResMgr()->NewKey( buff, newLay, GetKey() != nil ? GetKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc ); // Add layer so we have it now. diff --git a/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp b/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp index 78e913a0..0a23993f 100644 --- a/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp +++ b/Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp @@ -40,6 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include +#include #include "plUnifiedTime.h" #include "hsStlUtils.h" diff --git a/Sources/Tools/MaxComponent/plAnimComponent.cpp b/Sources/Tools/MaxComponent/plAnimComponent.cpp index b74bfff5..7dc065c0 100644 --- a/Sources/Tools/MaxComponent/plAnimComponent.cpp +++ b/Sources/Tools/MaxComponent/plAnimComponent.cpp @@ -719,7 +719,7 @@ bool plAnimComponentBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg) plString animName = plString::FromUtf8(fCompPB->GetStr(kAnimName)); if (animName.IsEmpty()) - animName = _TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME); + animName = ENTIRE_ANIMATION_NAME; if (fCompPB->GetInt(ParamID(kAnimUseGlobal))) { @@ -995,7 +995,7 @@ plString plAnimComponentBase::GetIfaceSegmentName( bool allowNil ) plString name = GetAnimName(); if( allowNil || !name.IsNull() ) return name; - return _TEMP_CONVERT_FROM_LITERAL( ENTIRE_ANIMATION_NAME ); + return ENTIRE_ANIMATION_NAME; } //// Hit Callback for Animations ///////////////////////////////////////////// diff --git a/Sources/Tools/MaxComponent/plAudioComponents.cpp b/Sources/Tools/MaxComponent/plAudioComponents.cpp index 1411869b..4ef8b904 100644 --- a/Sources/Tools/MaxComponent/plAudioComponents.cpp +++ b/Sources/Tools/MaxComponent/plAudioComponents.cpp @@ -92,7 +92,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAudio/plWin32StreamingSound.h" #include "plAudio/plWin32GroupedSound.h" #include "plAudioCore/plSoundBuffer.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" // Valdez Asset Manager Related #ifdef MAXASS_AVAILABLE @@ -622,7 +622,7 @@ plSoundBuffer *plBaseSoundEmitterComponent::IGetSourceBuffer( const char *file char tempPath[ MAX_PATH ]; strncpy(tempPath, fileName, MAX_PATH); ::PathStripPath( tempPath ); - keyName = _TEMP_CONVERT_FROM_LITERAL( tempPath ); + keyName = tempPath; // TEMP HACK until we get packed sounds: // Given the source filename, we check to see if it's in our plasma game directory. If not, or if @@ -638,7 +638,7 @@ plSoundBuffer *plBaseSoundEmitterComponent::IGetSourceBuffer( const char *file plFileUtils::CreateDir( fullPath ); // Now finish the path... - strcat( fullPath, _TEMP_CONVERT_TO_CONST_CHAR( keyName ) ); + strcat( fullPath, keyName.c_str() ); // Check filestamp WIN32_FILE_ATTRIBUTE_DATA oldFileAttrib, newFileAttrib; @@ -667,9 +667,9 @@ plSoundBuffer *plBaseSoundEmitterComponent::IGetSourceBuffer( const char *file // Additional info for the keyName--need some flag mangling, specifically for the left/right channel mangling if( srcBufferFlags & plSoundBuffer::kOnlyLeftChannel ) - keyName += _TEMP_CONVERT_FROM_LITERAL( ":L" ); + keyName += ":L"; else if( srcBufferFlags & plSoundBuffer::kOnlyRightChannel ) - keyName += _TEMP_CONVERT_FROM_LITERAL( ":R" ); + keyName += ":R"; key = srcNode->FindPageKey( plSoundBuffer::Index(), keyName ); if( key != nil ) diff --git a/Sources/Tools/MaxComponent/plAvatarComponent.cpp b/Sources/Tools/MaxComponent/plAvatarComponent.cpp index 6ee021c5..7f90aaaf 100644 --- a/Sources/Tools/MaxComponent/plAvatarComponent.cpp +++ b/Sources/Tools/MaxComponent/plAvatarComponent.cpp @@ -264,11 +264,11 @@ bool plArmatureComponent::Convert(plMaxNode* node, plErrorMsg *pErrMsg) { // MakeCharacterHierarchy will attach agmodifiers to all the bones in the hierarchy; // have to manually add any for non-bone objects... - agMod = new plAGModifier(_TEMP_CONVERT_FROM_LITERAL("Handle")); // the player root is known as the handle + agMod = new plAGModifier("Handle"); // the player root is known as the handle node->AddModifier(agMod, IGetUniqueName(node)); } - agMod->SetChannelName(_TEMP_CONVERT_FROM_LITERAL("Handle")); + agMod->SetChannelName("Handle"); // Get the position and radius of the head and torso physicals if (ClassID() == AVATAR_CLASS_ID || ClassID() == LOD_AVATAR_CLASS_ID) @@ -685,7 +685,7 @@ bool plCompoundCtrlComponent::Convert(plMaxNode* node, plErrorMsg *pErrMsg) plString name = node->GetKey()->GetName(); node->MakeCharacterHierarchy(pErrMsg); - node->SetupBonesAliasesRecur(_TEMP_CONVERT_TO_CONST_CHAR(name)); + node->SetupBonesAliasesRecur(name.c_str()); // create and register the player modifier diff --git a/Sources/Tools/MaxComponent/plClickDragComponent.cpp b/Sources/Tools/MaxComponent/plClickDragComponent.cpp index aa82551b..aeeea573 100644 --- a/Sources/Tools/MaxComponent/plClickDragComponent.cpp +++ b/Sources/Tools/MaxComponent/plClickDragComponent.cpp @@ -453,7 +453,7 @@ bool plClickDragComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { //pMsg->SetAnimName(ENTIRE_ANIMATION_NAME); pMsg->SetAnimName(pAnim->GetModKey(node)->GetName()); - pAxis->SetAnimLabel(_TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME)); + pAxis->SetAnimLabel(ENTIRE_ANIMATION_NAME); } else { diff --git a/Sources/Tools/MaxComponent/plFootstepComponent.cpp b/Sources/Tools/MaxComponent/plFootstepComponent.cpp index 92c357e9..745a0d71 100644 --- a/Sources/Tools/MaxComponent/plFootstepComponent.cpp +++ b/Sources/Tools/MaxComponent/plFootstepComponent.cpp @@ -115,7 +115,7 @@ bool plFootstepSoundComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plArmatureEffectFootSound *effect = new plArmatureEffectFootSound(); // Note: MUST be a hard-coded keyname, since we search for same name in plArmatureMod.cpp - hsgResMgr::ResMgr()->NewKey( _TEMP_CONVERT_FROM_LITERAL("FootstepSounds"), effect, node->GetLocation()); + hsgResMgr::ResMgr()->NewKey( "FootstepSounds", effect, node->GetLocation()); int i; for (i = 0; i < plArmatureEffectsMgr::kMaxSurface; i++) diff --git a/Sources/Tools/MaxComponent/plGUIComponents.cpp b/Sources/Tools/MaxComponent/plGUIComponents.cpp index a6797d8a..196694d6 100644 --- a/Sources/Tools/MaxComponent/plGUIComponents.cpp +++ b/Sources/Tools/MaxComponent/plGUIComponents.cpp @@ -115,7 +115,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAgeDescription/plAgeDescription.h" #include "MaxMain/plMaxCFGFile.h" #include "MaxMain/plAgeDescInterface.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "MaxConvert/plConvert.h" #include "MaxPlasmaMtls/Layers/plDynamicTextLayer.h" #include "MaxPlasmaMtls/Layers/plLayerTexBitmapPB.h" @@ -2728,7 +2728,7 @@ bool plGUIKnobCtrlComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plAGMasterMod *master = node->GetAGMasterMod(); hsTArray keys; keys.Append( master->GetKey() ); - ctrl->SetAnimationKeys( keys, _TEMP_CONVERT_FROM_LITERAL( ENTIRE_ANIMATION_NAME ) ); + ctrl->SetAnimationKeys( keys, ENTIRE_ANIMATION_NAME ); } if( fCompPB->GetInt( kRefOrientation ) == 1 ) @@ -4450,7 +4450,7 @@ bool plGUIProgressCtrlComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) plAGMasterMod *master = node->GetAGMasterMod(); hsTArray keys; keys.Append( master->GetKey() ); - ctrl->SetAnimationKeys( keys, _TEMP_CONVERT_FROM_LITERAL( ENTIRE_ANIMATION_NAME ) ); + ctrl->SetAnimationKeys( keys, ENTIRE_ANIMATION_NAME ); } const char *errMsg = ISetSoundIndex( kRefAnimateSound, kRefAnimateSoundComp, pfGUIProgressCtrl::kAnimateSound, node ); diff --git a/Sources/Tools/MaxComponent/plMaxAnimUtils.cpp b/Sources/Tools/MaxComponent/plMaxAnimUtils.cpp index 450863e4..64f9a450 100644 --- a/Sources/Tools/MaxComponent/plMaxAnimUtils.cpp +++ b/Sources/Tools/MaxComponent/plMaxAnimUtils.cpp @@ -210,8 +210,8 @@ void GetSegment(const char *note, float time, SegmentMap *segMap, plErrorMsg *pE int matchedFields = sscanf(note, " %[^@] @ %s ", segName, segSuffix); - plString name = _TEMP_CONVERT_FROM_LITERAL(segName); - plString suffix = _TEMP_CONVERT_FROM_LITERAL(segSuffix); + plString name = segName; + plString suffix = segSuffix; if (matchedFields == 2) { diff --git a/Sources/Tools/MaxComponent/plMiscComponents.cpp b/Sources/Tools/MaxComponent/plMiscComponents.cpp index 8ad72831..4a494477 100644 --- a/Sources/Tools/MaxComponent/plMiscComponents.cpp +++ b/Sources/Tools/MaxComponent/plMiscComponents.cpp @@ -70,7 +70,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plInterp/plController.h" #include "MaxMain/plMaxNode.h" #include "pnKeyedObject/plKey.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" // Follow mod #include "plInterp/plAnimPath.h" @@ -95,7 +95,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAgeDescription/plAgeDescription.h" #include "MaxMain/plMaxCFGFile.h" #include "MaxMain/plAgeDescInterface.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "plResMgr/plPageInfo.h" #include "plDrawable/plGeometrySpan.h" diff --git a/Sources/Tools/MaxComponent/plPythonFileComponent.cpp b/Sources/Tools/MaxComponent/plPythonFileComponent.cpp index 6e9cb6f7..f66d5f98 100644 --- a/Sources/Tools/MaxComponent/plPythonFileComponent.cpp +++ b/Sources/Tools/MaxComponent/plPythonFileComponent.cpp @@ -457,7 +457,7 @@ bool plPythonFileComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) break; case plAutoUIParam::kTypeString: - pyParam.SetToString(_TEMP_CONVERT_FROM_LITERAL(param->GetString(pb))); + pyParam.SetToString(param->GetString(pb)); mod->AddParameter(pyParam); break; @@ -807,7 +807,7 @@ bool plPythonFileComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // save out the animation name first plString tempAnimName = animcomp->GetAnimName(); if (tempAnimName.IsNull()) - pyParam.SetToAnimationName(_TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME)); + pyParam.SetToAnimationName(ENTIRE_ANIMATION_NAME); else pyParam.SetToAnimationName(tempAnimName); mod->AddParameter(pyParam); @@ -929,7 +929,7 @@ bool plPythonFileComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) break; case plAutoUIParam::kTypeDropDownList: - pyParam.SetToString(_TEMP_CONVERT_FROM_LITERAL(param->GetString(pb))); + pyParam.SetToString(param->GetString(pb)); mod->AddParameter(pyParam); break; diff --git a/Sources/Tools/MaxComponent/plResponderLink.cpp b/Sources/Tools/MaxComponent/plResponderLink.cpp index 1c97d009..0ad774e1 100644 --- a/Sources/Tools/MaxComponent/plResponderLink.cpp +++ b/Sources/Tools/MaxComponent/plResponderLink.cpp @@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plMiscComponents.h" // Needed for the dialog #include "MaxMain/plMaxCFGFile.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "plAgeDescription/plAgeDescription.h" // Needed to create the message diff --git a/Sources/Tools/MaxComponent/plResponderMtl.cpp b/Sources/Tools/MaxComponent/plResponderMtl.cpp index 5c1e323b..80162c53 100644 --- a/Sources/Tools/MaxComponent/plResponderMtl.cpp +++ b/Sources/Tools/MaxComponent/plResponderMtl.cpp @@ -276,10 +276,9 @@ void ISearchLayerRecur(plLayerInterface *layer, const plString &segName, hsTArra int ISearchLayerRecur(hsGMaterial* mat, const plString &segName, hsTArray& keys) { - plString name = segName.IsNull() ? _TEMP_CONVERT_FROM_LITERAL("") : segName; int i; for( i = 0; i < mat->GetNumLayers(); i++ ) - ISearchLayerRecur(mat->GetLayer(i), name, keys); + ISearchLayerRecur(mat->GetLayer(i), segName, keys); return keys.GetCount(); } diff --git a/Sources/Tools/MaxConvert/hsControlConverter.cpp b/Sources/Tools/MaxConvert/hsControlConverter.cpp index fc2723d2..89f89486 100644 --- a/Sources/Tools/MaxConvert/hsControlConverter.cpp +++ b/Sources/Tools/MaxConvert/hsControlConverter.cpp @@ -2158,7 +2158,7 @@ void hsControlConverter::IExportAnimatedCameraFOV(plMaxNode* node, hsTArray AddReceiver(pCamMod->GetKey()); pMsg->SetSender(pAnim->GetModKey(node)); pMsg->SetCmd(plAnimCmdMsg::kAddCallbacks); - pMsg->SetAnimName(_TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME)); + pMsg->SetAnimName(ENTIRE_ANIMATION_NAME); pMsg->fTime = kfArray[0][i].fFrame / MAX_FRAMES_PER_SEC; pMsg->AddCallback(pCall); hsRefCnt_SafeUnRef(pCall); diff --git a/Sources/Tools/MaxConvert/hsConverterUtils.cpp b/Sources/Tools/MaxConvert/hsConverterUtils.cpp index fba44a87..2c5e8049 100644 --- a/Sources/Tools/MaxConvert/hsConverterUtils.cpp +++ b/Sources/Tools/MaxConvert/hsConverterUtils.cpp @@ -346,7 +346,7 @@ INode* hsConverterUtils::FindINodeFromKeyedObject(hsKeyedObject* obj) { hsGuardBegin("hsConverterUtils::FindINodeFromKeyedObject"); - INode* retVal = FindINodeFromMangledName(_TEMP_CONVERT_TO_CONST_CHAR(obj->GetKey()->GetName())); + INode* retVal = FindINodeFromMangledName(obj->GetKeyName().c_str()); if( retVal ) return (retVal); diff --git a/Sources/Tools/MaxConvert/hsMaterialConverter.cpp b/Sources/Tools/MaxConvert/hsMaterialConverter.cpp index 27365129..8be1339d 100644 --- a/Sources/Tools/MaxConvert/hsMaterialConverter.cpp +++ b/Sources/Tools/MaxConvert/hsMaterialConverter.cpp @@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plSurface/hsGMaterial.h" #include "pnSceneObject/plSceneObject.h" #include "UserPropMgr.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" #include "hsConverterUtils.h" #include "hsControlConverter.h" @@ -762,7 +762,7 @@ hsMaterialConverter::CreateMaterialArray(Mtl *maxMaterial, plMaxNode *node, uint if (maxMaterial) name = plString::FromUtf8(maxMaterial->GetName()); else - name = _TEMP_CONVERT_FROM_LITERAL("nil"); + name = "nil"; /// Get the material bool isMultiMat = IsMultiMat( maxMaterial ); @@ -1183,7 +1183,7 @@ hsGMaterial *hsMaterialConverter::IProcessMaterial(Mtl *mtl, plMaxNode *node, co plLayer* hLay = new plLayer; hLay->InitToDefault(); - hsgResMgr::ResMgr()->NewKey(name + _TEMP_CONVERT_FROM_LITERAL("_DefLay"), hLay, nodeLoc); + hsgResMgr::ResMgr()->NewKey(name + "_DefLay", hLay, nodeLoc); IAddLayerToMaterial(hMat, hLay); } @@ -1337,7 +1337,7 @@ hsGMaterial *hsMaterialConverter::IAddDefaultMaterial(plMaxNode *node) plLayer *layer = new plLayer; layer->InitToDefault(); - hsgResMgr::ResMgr()->NewKey(hMat->GetKeyName() + _TEMP_CONVERT_FROM_LITERAL("_DefLay"), layer, loc); + hsgResMgr::ResMgr()->NewKey(hMat->GetKeyName() + "_DefLay", layer, loc); DWORD color = node->GetWireColor(); float r = float(GetRValue(color)) / 255.f; @@ -1353,8 +1353,8 @@ hsGMaterial *hsMaterialConverter::IAddDefaultMaterial(plMaxNode *node) plMipmap *hsMaterialConverter::IGetUVTransTexture(plMaxNode *node, bool useU /* = true */) { - plString texName = (useU ? _TEMP_CONVERT_FROM_LITERAL("ALPHA_BLEND_FILTER_U2ALPHA_TRANS_64x4") - : _TEMP_CONVERT_FROM_LITERAL("ALPHA_BLEND_FILTER_V2ALPHA_TRANS_4x64") ); + plString texName = (useU ? "ALPHA_BLEND_FILTER_U2ALPHA_TRANS_64x4" + : "ALPHA_BLEND_FILTER_V2ALPHA_TRANS_4x64" ); int w = (useU ? 64 : 4); int h = (useU ? 4 : 64); @@ -1412,7 +1412,7 @@ void hsMaterialConverter::IInsertSingleBlendLayer(plMipmap *texture, hsGMaterial plLayer* layer = new plLayer; layer->InitToDefault(); - hsgResMgr::ResMgr()->NewKey(underLay->GetKeyName() + _TEMP_CONVERT_FROM_LITERAL("_AlphaBlend"), layer, node->GetLocation()); + hsgResMgr::ResMgr()->NewKey(underLay->GetKeyName() + "_AlphaBlend", layer, node->GetLocation()); hsgResMgr::ResMgr()->AddViaNotify(texture->GetKey(), new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef); layer->SetAmbientColor(hsColorRGBA().Set(1.f, 1.f, 1.f, 1.f)); // layer->SetZFlags(hsGMatState::kZNoZWrite | hsGMatState::kZIncLayer); @@ -1848,7 +1848,7 @@ plLayerAnimation *IConvertNoteTrackAnims(plLayerAnimation *animLayer, SegmentMap void ISetDefaultAnim(plPassMtlBase* mtl, plAnimTimeConvert& tc, SegmentMap* segMap) { - plString animName = _TEMP_CONVERT_FROM_LITERAL( mtl->GetAnimName() ); + plString animName = mtl->GetAnimName(); if( segMap && !animName.IsNull() && (segMap->find(animName) != segMap->end()) ) { SegmentSpec *spec = (*segMap)[animName]; @@ -1997,12 +1997,12 @@ static plLayerInterface* IProcessLayerMovie(plPassMtlBase* mtl, plLayerTex* layT if (isBink) { movieLayer = new plLayerBink; - moviePostfix = _TEMP_CONVERT_FROM_LITERAL("_bink"); + moviePostfix = "_bink"; } else if (isAvi) { movieLayer = new plLayerAVI; - moviePostfix = _TEMP_CONVERT_FROM_LITERAL("_avi"); + moviePostfix = "_avi"; } plString movieKeyName = layerIFace->GetKeyName() + moviePostfix; @@ -2075,8 +2075,8 @@ plLayerInterface* IProcessLayerAnimation(plPassMtlBase* mtl, plLayerTex* layTex, plString segName = stealth->GetSegmentName(); bool isDefault = ( segName.IsNull() || segName.Compare( ENTIRE_ANIMATION_NAME ) == 0 ) ? true : false; - plString animName = name + ( ( isDefault ) ? _TEMP_CONVERT_FROM_LITERAL( "_LayerAnim_" ) - : ( _TEMP_CONVERT_FROM_LITERAL("_LayerAnim") + segName ) ); + plString animName = name + ( ( isDefault ) ? "_LayerAnim_" + : ( plString("_LayerAnim") + segName ) ); hsgResMgr::ResMgr()->NewKey( animName, noteAnim, node->GetLocation() ); StdUVGen *uvGen = (StdUVGen *)layTex->GetTheUVGen(); @@ -2191,8 +2191,8 @@ plLayerInterface* IProcessAnimation(plPassMtlBase *mtl, plMaxNode *node, const p plString segName = stealth->GetSegmentName(); bool isDefault = ( segName.IsNull() || segName.Compare( ENTIRE_ANIMATION_NAME ) == 0 ) ? true : false; - plString animName = name + ( ( isDefault ) ? _TEMP_CONVERT_FROM_LITERAL( "_anim" ) - : ( _TEMP_CONVERT_FROM_LITERAL("_anim_") + segName ) ); + plString animName = name + ( ( isDefault ) ? "_anim" + : ( plString("_anim_") + segName ) ); hsgResMgr::ResMgr()->NewKey( animName, noteAnim, node->GetLocation() ); plController *noteColCtl = cc.MakeColorController( maxColCtl, node ); @@ -3128,7 +3128,7 @@ void hsMaterialConverter::IAppendFunkyLayer(plMaxNode* node, Texmap* texMap, hsG plBitmap* hsMaterialConverter::IGetFunkyRamp(plMaxNode* node, uint32_t funkyType) { - plString funkName = funkyType & kFunkyAdd ? _TEMP_CONVERT_FROM_LITERAL("FunkyRampAdd") : _TEMP_CONVERT_FROM_LITERAL("FunkyRampMult"); + plString funkName = funkyType & kFunkyAdd ? "FunkyRampAdd" : "FunkyRampMult"; const int kLUTWidth = 16; const int kLUTHeight = 16; @@ -3510,7 +3510,7 @@ BitmapTex* hsMaterialConverter::GetBumpLayer(plMaxNode* node, Mtl* mtl) plMipmap *hsMaterialConverter::IGetBumpLutTexture(plMaxNode *node) { - const plString texName = _TEMP_CONVERT_FROM_LITERAL("BumpLutTexture"); + const plString texName = "BumpLutTexture"; //#define FUNKYBUMP #ifndef FUNKYBUMP @@ -4951,7 +4951,7 @@ void hsMaterialConverter::IPrintDoneMat(hsStream* stream, const char* prefix, Do stream->WriteString(buff); sprintf(buff, "\t\t\tTexture %s\n", layer->GetTexture() && layer->GetTexture()->GetKey() - ? layer->GetTexture()->GetKey()->GetName().s_str("None") + ? layer->GetTexture()->GetKeyName().c_str("None") : "None"); stream->WriteString(buff); diff --git a/Sources/Tools/MaxConvert/plBitmapCreator.cpp b/Sources/Tools/MaxConvert/plBitmapCreator.cpp index 63373c81..5e9f964e 100644 --- a/Sources/Tools/MaxConvert/plBitmapCreator.cpp +++ b/Sources/Tools/MaxConvert/plBitmapCreator.cpp @@ -548,8 +548,8 @@ plBitmap *plBitmapCreator::ICreateTexture( plBitmapData *bd, const plLocation &l else name = plString::Format( "%s*%x", temp, bd->texFlags ); if( bd->invertAlpha ) - name += _TEMP_CONVERT_FROM_LITERAL( "_inva" ); - name += _TEMP_CONVERT_FROM_LITERAL( ".hsm" ); + name += "_inva"; + name += ".hsm"; // Has this texture been used before? diff --git a/Sources/Tools/MaxExport/SimpleExport.cpp b/Sources/Tools/MaxExport/SimpleExport.cpp index 54a29075..a3a9faf2 100644 --- a/Sources/Tools/MaxExport/SimpleExport.cpp +++ b/Sources/Tools/MaxExport/SimpleExport.cpp @@ -79,7 +79,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plExportDlg.h" #include "plStatusLog/plStatusLog.h" -#include "plFile/plFileUtils.h" +#include "plFileUtils.h" #include "plAvatar/plAvatarMgr.h" diff --git a/Sources/Tools/MaxExport/plExportDlg.cpp b/Sources/Tools/MaxExport/plExportDlg.cpp index 2bfe7811..db36091e 100644 --- a/Sources/Tools/MaxExport/plExportDlg.cpp +++ b/Sources/Tools/MaxExport/plExportDlg.cpp @@ -325,7 +325,7 @@ void plExportDlgImp::IExportCurrentFile(const char* exportPath) GetCOREInterface()->ExportToFile(exportPath); } -#include "plFile/hsFiles.h" +#include "hsFiles.h" void plExportDlgImp::IDoExport() { diff --git a/Sources/Tools/MaxMain/main.cpp b/Sources/Tools/MaxMain/main.cpp index 06a79654..d435c367 100644 --- a/Sources/Tools/MaxMain/main.cpp +++ b/Sources/Tools/MaxMain/main.cpp @@ -138,7 +138,7 @@ __declspec(dllexport) ULONG LibVersion() #include "plSDL/plSDL.h" #include "plMaxCFGFile.h" #include -#include "plFile/hsFiles.h" +#include "hsFiles.h" // // DLLMAIN diff --git a/Sources/Tools/MaxMain/plAgeDescInterface.cpp b/Sources/Tools/MaxMain/plAgeDescInterface.cpp index b06f1a1c..54b1c03b 100644 --- a/Sources/Tools/MaxMain/plAgeDescInterface.cpp +++ b/Sources/Tools/MaxMain/plAgeDescInterface.cpp @@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plAgeDescInterface.h" #include "max.h" #include "resource.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "plAgeDescription/plAgeDescription.h" #include "plMaxCFGFile.h" #include "hsStream.h" diff --git a/Sources/Tools/MaxMain/plPythonMgr.cpp b/Sources/Tools/MaxMain/plPythonMgr.cpp index 24d82ce6..88dbf883 100644 --- a/Sources/Tools/MaxMain/plPythonMgr.cpp +++ b/Sources/Tools/MaxMain/plPythonMgr.cpp @@ -45,7 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxComponent/plAutoUIBlock.h" //#include "Python.h" #include "plMaxCFGFile.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #include "plgDispatch.h" #include "pfPython/cyPythonInterface.h" diff --git a/Sources/Tools/MaxMain/plTextureExportLog.cpp b/Sources/Tools/MaxMain/plTextureExportLog.cpp index de5578d7..f217c944 100644 --- a/Sources/Tools/MaxMain/plTextureExportLog.cpp +++ b/Sources/Tools/MaxMain/plTextureExportLog.cpp @@ -146,7 +146,7 @@ void plTextureExportLog::Write( void ) plRenderTarget* rend = plRenderTarget::ConvertNoRef( node->fBitmap ); // Name - IWriteTabbedString( stream, _TEMP_CONVERT_TO_CONST_CHAR( node->fBitmap->GetKeyName() ), dynText != nil ? 8 : 4 ); + IWriteTabbedString( stream, node->fBitmap->GetKeyName().c_str(), dynText != nil ? 8 : 4 ); // Size, formatted size = node->fBitmap->GetTotalSize(); diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthConvert.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthConvert.cpp index ef3c2ef8..2cae1609 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthConvert.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthConvert.cpp @@ -83,7 +83,7 @@ static void ISearchLayerRecur( plLayerInterface *layer, const plString &segName, static int ISearchLayerRecur(hsGMaterial* mat, const plString &segName, hsTArray& keys) { - plString name = (segName.IsNull() || segName.Compare( ENTIRE_ANIMATION_NAME ) == 0 ) ? _TEMP_CONVERT_FROM_LITERAL( "" ) : segName; + plString name = ( segName.Compare( ENTIRE_ANIMATION_NAME ) == 0 ) ? "" : segName; int i; for( i = 0; i < mat->GetNumLayers(); i++ ) ISearchLayerRecur(mat->GetLayer(i), name, keys); diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp index c49bbfaf..1a1feebf 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp @@ -254,7 +254,7 @@ plString plAnimStealthNode::GetSegmentName( void ) const { const char *str = fParamBlock->GetStr( (ParamID)kPBName ); if( str == nil || str[ 0 ] == 0 ) - return _TEMP_CONVERT_FROM_LITERAL( ENTIRE_ANIMATION_NAME ); + return ENTIRE_ANIMATION_NAME; return plString::FromUtf8(str); } @@ -897,7 +897,7 @@ plString plAnimStealthNode::GetLoopName( void ) const { return void plAnimStealthNode::SetLoop( bool b, const plString &name ) { fParamBlock->SetValue( (ParamID)kPBLoop, 0, (int)b ); - fParamBlock->SetValue( (ParamID)kPBLoopName, 0, (char *)name.s_str() ); + fParamBlock->SetValue( (ParamID)kPBLoopName, 0, (char *)name.c_str() ); } uint8_t plAnimStealthNode::GetEaseInType( void ) const { return (uint8_t)fParamBlock->GetInt( (ParamID)kPBEaseInType ); } diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtl.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtl.cpp index 30777b73..3b2b7ebb 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtl.cpp @@ -86,7 +86,7 @@ plBumpMtl::plBumpMtl(BOOL loading) : plPassMtlBase( loading ) // If we do this later (like, when the dialog loads) something blows up, // somewhere in Max. It didn't in 4, it does in 7. This seems to fix it. if (!loading) - IVerifyStealthPresent(_TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME)); + IVerifyStealthPresent(ENTIRE_ANIMATION_NAME); } ParamDlg* plBumpMtl::CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp) diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtl.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtl.cpp index add1dc60..49488fa7 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtl.cpp @@ -93,7 +93,7 @@ plDecalMtl::plDecalMtl(BOOL loading) : plPassMtlBase( loading ) // If we do this later (like, when the dialog loads) something blows up, // somewhere in Max. It didn't in 4, it does in 7. This seems to fix it. if (!loading) - IVerifyStealthPresent(_TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME)); + IVerifyStealthPresent(ENTIRE_ANIMATION_NAME); } ParamDlg* plDecalMtl::CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp) diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtl.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtl.cpp index 2124c830..306b5eb6 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtl.cpp @@ -96,7 +96,7 @@ plPassMtl::plPassMtl(BOOL loading) : plPassMtlBase( loading ) // If we do this later (like, when the dialog loads) something blows up, // somewhere in Max. It didn't in 4, it does in 7. This seems to fix it. if (!loading) - IVerifyStealthPresent(_TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME)); + IVerifyStealthPresent(ENTIRE_ANIMATION_NAME); } plPassMtl::~plPassMtl() diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp index 06c0b3c0..eaca018c 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp @@ -215,7 +215,7 @@ plAnimStealthNode *plPassMtlBase::IVerifyStealthPresent( const plString &animN // New segment, add a new stealth node stealth = (plAnimStealthNode *)GetCOREInterface()->CreateInstance( HELPER_CLASS_ID, ANIMSTEALTH_CLASSID ); INode *node = GetCOREInterface()->CreateObjectNode( stealth ); - stealth->SetSegment( ( animName.Compare(ENTIRE_ANIMATION_NAME) != 0 ) ? _TEMP_CONVERT_TO_CONST_CHAR(animName) : nil ); + stealth->SetSegment( ( animName.Compare(ENTIRE_ANIMATION_NAME) != 0 ) ? animName.c_str() : nil ); stealth->SetNodeName( GetName() ); node->Freeze( true ); @@ -277,7 +277,7 @@ void plPassMtlBase::IUpdateAnimNodes( void ) fStealthsChanged = false; // Verify one for "entire animation" - plAnimStealthNode *stealth = IVerifyStealthPresent( _TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME) ); + plAnimStealthNode *stealth = IVerifyStealthPresent( ENTIRE_ANIMATION_NAME ); goodNodes.Append( stealth ); // Verify segment nodes @@ -519,7 +519,7 @@ void plPassMtlBase::PostLoadAnimPBFixup( void ) plAnimStealthNode *node = (plAnimStealthNode *)fAnimPB->GetReferenceTarget( (ParamID)kPBAnimStealthNodes, 0, i ); plString name = node->GetSegmentName(); node->SetAutoStart( false ); - node->SetLoop( true, _TEMP_CONVERT_FROM_LITERAL( ENTIRE_ANIMATION_NAME ) ); + node->SetLoop( true, ENTIRE_ANIMATION_NAME ); node->SetEaseIn( plAnimEaseTypes::kNoEase, 1.f, 1.f, 1.f ); node->SetEaseOut( plAnimEaseTypes::kNoEase, 1.f, 1.f, 1.f ); } diff --git a/Sources/Tools/plResBrowser/plResBrowserWndProc.cpp b/Sources/Tools/plResBrowser/plResBrowserWndProc.cpp index b71a514a..54482223 100644 --- a/Sources/Tools/plResBrowser/plResBrowserWndProc.cpp +++ b/Sources/Tools/plResBrowser/plResBrowserWndProc.cpp @@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plResMgr/plResManager.h" #include "plResMgr/plResMgrSettings.h" #include "plWinRegistryTools.h" -#include "plFile/hsFiles.h" +#include "hsFiles.h" #define IDC_REGTREEVIEW 1000